I thought I would throw up yet another post about copying disks, to add
to the several that have appeared here in the past. This certainly is
not the "right way", but it uses tools and commands I am familiar and
comfortable with.
My goal was to simply create a duplicate disk as easy as possible.
Because I have experienced several disk failures over the past 20 years,
I like to keep a duplicate hard disk around that duplicates all the
software and setup on my work computer (I also keep it at a separate
location, so that a fire or earthquake - which we have a lot of in
California - would be unlikely to destroy both). While I have been doing
this for a number of years, the other complication was that this was the
first time I had been using LVM partitions (I recently installed F7).
The method of creating partitions and making them bootable is one I have
used in the past; I simply booted the F7 installation DVD in the machine
with the new disk, and installed a minimal system. The doesn't take very
long and used tools I am familiar with. Unfortunately, as I discovered,
you cannot then mount this with the old disk and copy the partition
contents, because the old and new disks have the same LVM names.
After surfing around at what others used, I decided to give g4l a try. I
got that up and running and started the copy, but after 25 minutes, it
had only copied about 1.2GB. I had 55GB to copy (and none of that is
copyright violation material ;), so that was a no go.
I took a look clonezilla, but frankly, that looked like something that
an IT department would use for many machines. It looked like way too
much for the simple task I wanted.
Finally it occurred to me to go back to the old method. I reinstalled a
minimal system from scratch, but this time edited the LVM group name
changing VolGroup00 -> VolGroup01. Now I could mount the old and new
partitions simultaneously, so I did a simple:
mkdir /mnt/disk
First the boot partition
mount /dev/sdb1 /mnt/disk
cd /boot
cp -ax ./* /mnt/disk
Now I need to edit the grub.conf file, and alter references to
VolGroup00 to read VolGroup01. Also, I had altered the actual partitions
used, so I changed those too. Then umount it.
umount /mnt/disk
Now the main partition.
mount /dev/VolGroup01/LogVol00 /mnt/disk
cd /
cp -ax / /mnt/disk
That took about an hour to copy 55GB. I needed to edit the file
/mnt/disk/etc/fstab, and again alter references to VolGroup00 and to the
partition numbers of the swap and boot partitions.
After all that, I tried booting the disk. Grub came up fine and started
the boot process, but immediately after the LVM manager found my new
partition, a message came up about being unable to find the "resume
device" and referencing VolGroup00, the wrong one.
A bit more surfing revealed this interesting web page:
http://mhensler.de/swsusp/
In particular, I found the part interesting that begins:
"Fedora requires an initrd for booting and resuming your system. "
and continues with info on editing this file. So I decided to unpack the
initrd file that I was using and see what it looked like. And sure
enough, the "init" file within initrd turns out to be a plain text file
with several references to VolGroup00. I altered those, repacked the
initrd file according to those directions, and copied it to the boot
partition of the new disk.
I tried booting the disk and success! I logged in, the automatic update
checker thingy came up, so I let it do an update to see if that works
fine. I ran several of my licensed apps to make sure those were working.
I did a network git update of wine and recompiled and installed that.
And I checked my email and posted to fedora-list. It all seems to work
fine, so it looks like this is a good copy.