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?