grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Backup old boot sectors before installation


From: Isaac Dupree
Subject: Re: [PATCH] Backup old boot sectors before installation
Date: Mon, 28 Dec 2009 17:04:30 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Zhu Yi wrote:
On Fri, 2009-12-25 at 05:21 +0800, Robert Millan wrote:
I think making a backup is a fine idea, but I'd rather avoid the "option
creep".  It doesn't hurt to simply dump the files in /boot/grub/.  If user
later discovers that valuable data was overwritten, she can figure out
how to call dd just as she can figure out the right parameters for
grub-install.

OK. My only concern is the start position of grub core.img (as in disk
sectors) is a variable (see find_usable_region_xxx). This ends up the
backup file is not a simple dump. I used below format in my patch.

<512 bytes MBR> + <U64 start position> + <sizeof(core.img) old sectors>

Option 2 is to put the start position in a separated file.

Option 3 is to use the information in boot.img (as I used in my patch as
a verification method) to get the start position, i.e. `od -j92 -N8 -An
-td8 $grubdir/boot.img`.

Option 4 is to backup everything from MBR to the end of core.img
(including the holes in the middle). This ends up with a bigger image.

Option 1~3 requires the recover has the knowledge of the backup file
format somehow, but a simple dd is enough for option 4. What do you
think?

If the partitioning had been changed in the mean time, 4 would overwrite it with the older values. Similar problem for a weird setup with partitions in between (I dunno, might be possible with GPT or other weirdness).

I think option 2 or 3 is soundest. Option 2 would have three separate files of information, (right?), and there must be a pretty straightforwards `dd` option to skip to the correct start position. Option 3 would omit the "start position" file... but that file is really cheap, maybe we'd better keep things simple for restorers and stick with three separate files.(Or, we could do something weird like putting start-position somewhere in the filename of the backup.)

-Isaac




reply via email to

[Prev in Thread] Current Thread [Next in Thread]