Migrating a Linux (Debian Squeeze) system from one HD to another HD

Migrating a Linux (Debian Squeeze) system from one HD to another HD

Omer Zak w1 at zak.co.il
Sun Feb 19 04:03:05 IST 2012


My PC has a 500GB hard disk, and I want to migrate it to a 2TB hard
disk.
The new hard disk has been formatted to have two physical partitions,
one serves as /boot and the other is an encrypted LVM volume, which has
its own division into logical partitions.

I rsync'ed the old hard disk's contents into the new one (excluding
- /lib/init/rw/***
- /dev/shm/***
- /proc
- /sys
- /tmp/***
- /var/lock/***
- /var/tmp/***
- /cdrom/***
- /media/***
- /etc/fstab
).

I edited /etc/fstab in the new hard disk to specify the correct
partitions.

Then I ran grub-install on the new hard disk using:
  chroot /tmp/new_2T grub-install /dev/sdb
where the new hard disk's /boot and logical partitions are mounted on
subdirectories of /tmp/new_2T, and the new hard disk itself is /dev/sdb.

However the logical volume paths in the old hard disk and the new one
differ.
It turns out that the kernel and initrd images in the old hard disk have
the old logical volume paths hardwired in them.
So when trying to reboot the PC from the new hard disk, it doesn't find
the root filesystem.  The failing script is /scripts/local-top/cryptroot
(/scripts/local-top template can be found in /etc/initramfs).

So it seems that I need somehow to recreate the initrd.img's contents.

I may have missed also other things.

Questions:
1. How to recreate initrd.img's appropriate for the new hard disk?
2. Is there any guide about migrating a Debian Squeeze system inside an
encrypted LVM partition from one hard disk to another hard disk?

In conclusion: I am dismayed at the fact that migrating Linux systems,
which used to be a simple affair (like MS-DOS), is now complicated (like
versions of MS-Windows after Windows 95).

Thanks,
--- Omer


-- 
Jara Cimrman.  A name to remember.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html




More information about the Linux-il mailing list