LFCS · Question #826
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 dd command can overwrite the bootloader located in the Master Boot Record (MBR) on /dev/sda without affecting the partition table or subsequent data by precisely targeting the first 440 bytes.
Question
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
(28 responses)- A14% (4)
- B7% (2)
- C75% (21)
- D4% (1)
Why each option
The `dd` command can overwrite the bootloader located in the Master Boot Record (MBR) on `/dev/sda` without affecting the partition table or subsequent data by precisely targeting the first 440 bytes.
`dd if=/dev/zero of=/dev/sda bs=512` without a `count` will overwrite the entire `/dev/sda` with zeros, including the partition table and all data.
`dd if=/dev/zero of=/dev/sda bs=512 count=1` overwrites the entire 512-byte MBR, including both the bootloader and the partition table, which is not desired.
The MBR contains the bootloader code (first 440 bytes) and the partition table (next 64 bytes). Using `dd if=/dev/zero of=/dev/sda bs=440 count=1` writes 440 bytes of zeros from `if=/dev/zero` to the beginning of `/dev/sda`, effectively wiping only the bootloader code while preserving the partition table and other data.
`dd if=/dev/zero of=/dev/sda bs=440` without a `count` will continuously write 440-byte blocks of zeros until the input stream (`/dev/zero`) is exhausted or interrupted, effectively overwriting the entire disk.
Concept tested: MBR bootloader overwrite with dd
Source: https://man7.org/linux/man-pages/man1/dd.1.html
Topics
Community Discussion
No community discussion yet for this question.