[geeks] Copy a linux disk

Doug McLaren dougmc+sunhelp at frenzy.com
Tue May 30 23:17:35 CDT 2006


On Sat, May 27, 2006 at 11:34:19PM -0400, Joshua Boyd wrote:

| grub is starting to get annoying.  I can't figure out how to convince it
| that while the drive it is blessing is currently hdc that I really want
| it to bless that drive as if it was to be hda, since I'm moving it as
| soon as I power down.

I believe that the key is the /boot/grub/device.map file :

   % cat /boot/grub/device.map 
   # this device map was generated by anaconda
   (hd0)     /dev/sda
   (hd1)     /dev/sdb

Grub runs using your bios to access the disk, so it doesn't know the
device names.  It just knows disk0 and disk1 (and usually not anything
past that, though modern bioses might.)

In your case, I believe that you'd make device.map read like this :

   (hd0)   /dev/hdc

and then use `grub-install /dev/hdc'.

Of course, if the device.map file is actually going on the image, you
might want to correct it after running grub-install so that it doesn't
confuse somebody later.

If I'm wrong about how all of this works, then perhaps device.map should read
like this --

   (hd0)  /dev/hda

The --root-directory={whatever} option might also be useful, if you
have the grub stuff mounted somewhere other than /boot.

I've gotten this stuff to work, but haven't had to do it enough that I
rememeber the specifics, but it's something along these lines.

This question may also be relevant in the FAQ --

   http://www.gnu.org/software/grub/grub-legacy-faq.en.html#q11

Or this --

   http://www.gnu.org/software/grub/manual/grub.html#Installing-GRUB-using-grub_002dinstall
   http://www.gnu.org/software/grub/manual/grub.html#Device-map

Well, hopefully this is of some assitance.  I'm not currently trying
to make a bootable disk on another computer, so this is from memory,
but getting it right was along these lines.

Of course, I suspect it's too late ...  

-- 
Doug McLaren, dougmc at frenzy.com
Strangers have the best candy.
- t-shirt seen at DefCon 8.0



More information about the geeks mailing list