LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By aus9 at 2004-10-29 02:48
Backing up or Restoring MBR on floppy

Save MBR

1) Assuming your system is booted. I don't think you would be saving a normal MBR by a rescue system. Insert a mdos or ext2 formatted floppy and mount it.
2) Open a terminal and type su to get root access then
dd if=/dev/hda of=/home/your name/mbrhda bs=512 count=1
This creates a file in your home directory. If your system has some umask permissions that don't allow automatic file creation the use the touch command first like this
touch /home/your name/mbrhda

Also, hda is for first IDE drive, change it to sda for SCSI or SATA or hdb sdb etc

3) Test it with dd if=/home/your name/mbrhda bs=512 count=1

There is no need for of=.....as we print to screen and the output will have squiggles and lilo or grub and Geom .

4)Once you see the output, save that file to floppy any way you fancy or
cp /home/your name/mbrhda /mnt/floppy



Restore MBR

1) Although you can test this on a booted system you are more likely going to try this on a non-booted system. Restore your mbr you will need a rescue floppy such as TOMS or a rescue cd such as from www.sysresccd.org or Knoppix cd.

2) I am using TOM's floppy as if you are reading this may have problems with your cd drive.
Toms is in root mode upon booting.
www.toms.net

3) Rescue cd's may need to be put into su mode such as Knoppix cd.

4) Because your rescue floppy or cd creates a ram drive you create a false /mnt to mount your floppy.

5)
mkdir /3
mount -t msdos /dev/fd0 /3
dd if=/3/mbrhda of=/dev/hda bs=512 count=1

Change hda to sda etc to suit your drive.

The restore commands may need a little more explaining?

mkdir /3 is a directory in the ramdrive and it is NOT writing to any hard drive. I chose a number which is not normally a part of real hard drive linux file system. So you know it is a ram drive folder. ie a false folder that disappears upon reboot to hard drive.

The next command mounts a msdos floppy from the first floppy hardware controller to ramdrive folder /3

The last command you need to take care in case you muck up more than you should. Please limit it to 512 bytes even tho you saved the file as a max of 512 b.

6) FINALLY
Before reboot test it
dd if=/dev/hda bs=512 count=1 and hope its what it should be.

However, I noticed some character distortion in my first terminal so I had to open a new terminal by pressing ALT and the number 2 or number 3 key etc.

or if you don't understand just do a reboot.


  



All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration