nerdexam
CompTIA

LX0-103 · Question #13

Which of the following commands overwrites the bootloader located on /dev/sda without overwriting the partition table or any data following it?

The correct answer is C. dd if=/dev/zero of=/dev/sda bs=440 count=1. The MBR bootloader code occupies only the first 440 bytes of a 512-byte MBR; bytes 446-511 hold the partition table, so writing exactly 440 bytes zeros only the bootloader.

System Architecture

Question

Which of the following commands overwrites the bootloader located on /dev/sda without overwriting the partition table or any data following it?

Options

  • Add if=/dev/zero of=/dev/sda bs=512
  • Bdd if=/dev/zero of=/dev/sda bs=512 count=1
  • Cdd if=/dev/zero of=/dev/sda bs=440 count=1
  • Ddd if=/dev/zero of=/dev/sda bs=440

How the community answered

(37 responses)
  • A
    5% (2)
  • B
    30% (11)
  • C
    54% (20)
  • D
    11% (4)

Why each option

The MBR bootloader code occupies only the first 440 bytes of a 512-byte MBR; bytes 446-511 hold the partition table, so writing exactly 440 bytes zeros only the bootloader.

Add if=/dev/zero of=/dev/sda bs=512

Without a count limit, dd will write 512-byte zero blocks continuously until the entire disk is overwritten, destroying all partitions and data.

Bdd if=/dev/zero of=/dev/sda bs=512 count=1

A block size of 512 with count=1 writes a full 512 bytes, which includes bytes 446-511 containing the partition table entries and boot signature, corrupting the partition layout.

Cdd if=/dev/zero of=/dev/sda bs=440 count=1Correct

The x86 MBR layout reserves bytes 0-439 for bootstrap code (the bootloader), bytes 440-445 for disk signature and reserved space, and bytes 446-511 for partition table entries and the boot signature. Specifying bs=440 count=1 writes exactly 440 zero bytes, overwriting only the bootloader code area while leaving the partition table entries at byte offset 446 and beyond completely untouched.

Ddd if=/dev/zero of=/dev/sda bs=440

Without count=1, dd will write 440-byte zero blocks indefinitely across the entire disk, destroying all filesystem data and partition structures beyond the first block.

Concept tested: dd command targeting MBR bootloader byte range

Source: https://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html

Topics

#dd#MBR#bootloader#disk sectors

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice