Re: restoring MBR



On Sun, 31 Jul 2011 18:52:53 -0400 (EDT), Aaron Toponce wrote:
On Sun, Jul 31, 2011 at 04:50:35PM -0400, Stephen Powell wrote:

Sometimes restoring a backup copy of the master boot record can be
even more dangerous than wiping it out. The master boot record contains
the master boot record boot program, but it also contains the partition
table. If any partition changes were made during installation (partitions
were created, deleted, moved, resized, etc.) then simply replacing the
master boot record with an older copy will not only restore the old
master boot record boot program but will also restore the old partition
table. This can lead to permanent data loss. One must be very careful
about how one goes about restoration in such cases. In most cases, one
doesn't want to restore the entire 512-byte sector, but only a portion of
it: up to, but not including, the partition table.

It's not that difficult, if you understand haw MSDOS partitioning is setup
under GNU/Linux. The first 446 bytes are your boot loader. The next 64
bytes are your partition table. If you wish to backup just the bootloader,
it's easy with dd(1):

# dd if=/dev/sda count=1 bs=446 of=/tmp/boot.img

I generally tell my students that if they are using flat partitions, rather
than LVM or something else, then they should save a hard copy of their
partition table. Sholud you wipe that out, if you know the starting and
ending of each partition, you can recreate the table, and get back at your
data. This can be easily accomplished with fdisk(8):

# fdisk -l /dev/sda > /tmp/partitions.txt

It doesn't hurt to backup the entire MBR, all 512 bytes worth, and save
that elsewhere on disk, as it's trivial to restore, and it contains your
partition table:

# dd if=/tmp/mbr.img of=/dev/sda

Just some thoughts about the "difficulty" of managing the MBR and
partitions.

I never said it was *difficult*. I said it can be *dangerous*
(if you don't know what you're doing). Firing a gun is easy,
not difficult. But if you're aiming at your foot, it is dangerous!

--
.''`. Stephen Powell
: :' :
`. `'`
`-


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/356045725.997230.1312155809021.JavaMail.root@xxxxxxxxxxxxxxxxxxxx



Relevant Pages

  • Re: XP System Backup. ASR No floppy drive
    ... My own choice would be to install a fresh copy of Windows and then run restore using that. ... hoping to use System Tool Backup to create ASR. ... but says Invalid or damaged bootable partition when I ... The KB actually discusses which USB CD drives that the XP ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: Hard Drive Replacement
    ... are on my 'D' partition. ... you want to restore you have to restore two images, ... Remember even after a couple of days your backup is that much behind present ... is deeper and you may have to reinstall or restore the Operating System. ...
    (microsoft.public.win2000.general)
  • Re: Restoreing Dump on FreeBSD headless server
    ... Fresh install with spare partition) then restore the dump on an empty ... to tell you the truth: I am using a remote backup solution since 2.5 ...
    (freebsd-questions)
  • Re: Acronis True Image vs. SyncToy
    ... partition, to restore in its entirety if needed. ... restore the entire image, not just particular files. ... of True Image is that the backup can be highly compressed. ... local drive by assigning it a drive letter. ...
    (microsoft.public.windowsxp.general)
  • Re: Restoring an image after repartitioning the image restore drive?
    ... of insufficient disk space for storing the images, ... When one restores an image of their system drive partition, ... Suppose the backup drive ... Remember, strictly speaking, if I restore an earlier system drive ...
    (microsoft.public.windowsxp.general)