what command to restore if the boot block is corrupted in
linux



what command to restore if the boot block is corrupted in linux..

Answer / mohammed sajjad

Scenario 1: Backup the boot sector (or MBR)
If the first harddisk in the system is /dev/sda, to backup the boot sector the following command can be used:

# dd if=/dev/sda of=bsbackup.bin bs=512 count=1

Essentially this command will read the first 512 bytes of /dev/sda and write it to the file bsbackup.bin.
Scenario 2: Restore the boot sector from a file:

# dd if=bsbackup.bin of=/dev/sda bs=512 count=1

This will restore the boot sector to /dev/sda that was backed up in Scenario 1.
Scenario 3: Zero out the boot sector (leaving the partition table intact)
Sometimes a virus or other issue can leave a corrupted executable code section in the MBR. I have personally seen a boot sector that would not store grub information (and thus boot linux after its installed) properly until the first 446 bytes were zeroed out and grub re-installed. The following command will do just that:

# dd if=/dev/zero of=/dev/sda bs=446 count=1

Scenario 4: Zero out the entire MBR (this will erase the partition table as well – effectively destroying the ability to easily access data on the drive)
A variation of the last dd command will wipe out the master boot record entirely. You will have to repartition and reformat your hard disk after this:

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Networking Administration Interview Questions

Which layer packages data into frames?

1 Answers  


What will happen if we send untagged packet to a tagged port

0 Answers   HCL,


Your previous Network Administrator had subnneted your Class C network into many subnets. Only info you have is that the mask was 255.255.255.224 How many subnets did he make ? How many nodes were there per subnet ? a. 2, 62 b. 7, 30 c. 6, 30 d. 6, 62 e. 7, 62

1 Answers  


Fast Ethernet : Max distance for UTP and Fiber ? a. 200m, 1000m b. 1000m, 2000m c. 100m, 1000m d. 100m, 2000m

1 Answers  


What works at the Data Link layer of the OSI model.

1 Answers  


In what protocol, data is sent from client to server to tell their state.

1 Answers  


Explain the osi role in computer networking?

0 Answers  


how many layers are in the network protocol describe these with name?

3 Answers   IBM,


deferances between work group and domain?

2 Answers  


What is the advantage of subnetting ?

1 Answers  


what is the RAID

1 Answers   Infosys, Pursuit Technologies,


Are you familiar with automounter ?

1 Answers  


Categories
  • Networking Protocols Interview Questions Networking Protocols (671)
  • Networking Administration Interview Questions Networking Administration (1008)
  • Networking Security Interview Questions Networking Security (196)
  • Networking General Interview Questions Networking General (266)
  • Networking AllOther Interview Questions Networking AllOther (430)