Upgrading a LUKS encrypted hard drive (Ubuntu)
Recently I wanted to upgrade (plop in a bigger) my hard drive in my laptop. Currently I have Ubuntu 7.10 installed with whole disk encryption. The only change I was making was the size of my hard drive. I wasn’t sure how I’d mount an encrypted partition managed via LVM. But I was willing to learn. I also wanted to basically pick up where I had left off. I wanted all the same apps installed on the new drive as the old one. I didn’t think dd would do the trick as I’d be limited to the size of the smaller drive, thus defeating the purpose. So…two Google searches later I found what I need to get going.
- Dump a list of all the installed programs from the old system:
dpkg -l | awk '{print $2}' > installed_packages.txt - Remove old hard drive
- Install new hard drive
- Install Ubuntu 7.10 Using Alternate CD with option to install whole disk LVM encryption
- Boot into new system
- Ctrl+Alt+F1 drop to terminal
- Switch to root and stop the graphic desplay
sudo su -;/etc/init.d/gdm stop - Move the newly created home directory
mv /home/rjmolesa /home/rjmolesa.old - Attach the old hard drive with USB enclosure
- Enter LUKS password
- Locate the LVM group that the old encrypted hard drive is in:
vgscan - Create a mount point and mount the old partition
mkdir /mnt/oldhdenc;mount /dev/[LVM GROUP]/root /mnt/oldhdenc -o ro,user - Get my home dir copied over:
rsync /mnt/oldhdenc/home/rjmolesa /home/ - Install all the packages I had on the old system:
apt-get install `cat installed_packages.txt`
I think that’s about it.
References:
- Some really useful apt-get commands
- Dump a list of packages installed on Ubuntu
- Encrypt Devices using dmcrypt and LUKS
Technorati Tags: Upgrading Replacing LUKS encrypted hard drive Ubuntu 7.10

No comments yet.