[H-GEN] Cleaning up the MBR on a /dev/hda
Robert Webb
support at vivij.com
Thu Nov 17 05:58:10 EST 2005
Hi,
Hope this helps.
RobW
############BACKING UP MBR (to /root/recovery)############
dd if=/dev/hda of=/root/recovery/mbr.bin count=1
##to restore, reverse the command
dd of=/dev/hda if=/root/recovery/mbr.bin count=1 bs=512
##and run /sbin/lilo in case kernels or other block mappings have ##changed
since our mbr.bin snapshot was made.
##you can also just change the partition table using a few different
##parameters to dd.
#To backup
dd if =/dev/hda of=/root/recovery/ptable.bin count=66 bs=1 skip=446
#To restore
dd of=/dev/hda if=/root/recovery/ptable.bin count=66 bs=1 skip=446
####In this case you don't have to run /sbin/lilo because we havn't
####touched the bootloader code in the first 446 bytes of the MBR.
#^#From Linux System Administration. New Riders ISBN 1-56205-934-3
-----Original Message-----
From: Ewan Edwards [mailto:Edwards_Ewan_B at cat.com]
Sent: Tuesday, 15 November 2005 3:43 PM
To: general at lists.humbug.org.au
Subject: Re: [H-GEN] Cleaning up the MBR on a /dev/hda
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
On Tuesday 15 November 2005 12:17, Jason Parker-Burlingham wrote:
>
> The sfdisk manpage says:
>
> -d Dump the partitions of a device in a format useful as input
> to sfdisk. For example,
> % sfdisk -d /dev/hda > hda.out
> % sfdisk /dev/hda < hda.out
> will correct the bad last extended partition that the OS/2
> fdisk creates.
Great! Thanks, looks exactly like what I need.
> I believe that standard Linux fdisk has -lu options which would be
> similarly useful. It would probably be best to back up all your
> data, double-check the backup, and use two different fdisk programs
> to record the partition locations before making any changes.
Transfer the hdd to another box followed by a full backup and
re-partition & format was another option. But, being fundamentally
lazy I wanted to avoid that.
> Oh, and Googling says that the "dd bs=512" command you mentioned
> will not, in fact, wipe the partition table, and such is my
> recollection (though I did get burned trying to run that command
> once before).
Interesting ... some of the links Google gave me suggested exactly the
opposite. :-/ (I admit to being perplexed by that since I was of the
understanding previously that the MBR was used for a bootloader and
only a bootloader, while the partition table was stored elsewhere.)
_______________________________________________
General mailing list
General at lists.humbug.org.au
http://lists.humbug.org.au/cgi-bin/mailman/listinfo/general
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.0/168 - Release Date: 14/11/2005
More information about the General
mailing list