Christoffer Kjølbæk I have a blog, therefore I am…

1Nov/090

Re-install / upgrade to Ubuntu 9.10 and keep encrypted data from previous version

When Ubuntu first started with encrypted hard drive support, I made a LVM system inside the encrypted system. I do not like to upgrade Ubuntu from one version to another, and I do not want to copy all my data for each installation. My LVM system therefore have root, swap and home, so that home can survive the re-installation.

Unfortunately, the installer (the alternative one) do not recognise the encrypted hard drive, and is therefore not able to use it. This little guide helps you to reuse your LVM layout - and your data!

NB: Use this guide at your own risk!

Follow the installation until "Set up network", then press ctrl-alt F2 to start a console and run

modprobe dm-crypt
cryptsetup luksOpen /dev/sda5 sda5_crypt

Replace /dev/sda5 with your encrypted partition. You will now be prompted for your passphrase for the encrypted partition, after which you run

vgscan
vgchange -ay

in order to activate the lvm volumes.

Press ctrl-alt f1 to get back to the installer. When asked for partition method select Manual, and your encrypted LVM volumes are now on the list. You still need to set mount points etc., and remember NOT to mark them for formatting. Continue the installation.

Boot into rescue with your LVM root volume as /

Find the unique id for this "disk" from:
ls -l /dev/disk/by-uuid

Insert a line like

sda5_crypt /dev/disk/by-uuid/df05112c-65bf-44a2-b6d1-a740c3444b53 none luks

into /etc/crypttab. Remember to use the uuid found above together with what ever name you have given the device. sda5_crypt will give a device called /dev/mapper/sda5_crypt

To avoid manually typing the uuid, it is possible just to do:
ls -l /dev/disk/by-uuid >> /etc/crypttab
nano - /etc/crypttab

This will copy the entire content of "ls -l /dev/disk/by-uuid" into the bottom of /etc/crypttab, and open the file for editing with nano.

Run update-initramfs -u, reboot and you are ready to go!

Kommentarer (0) Trackbacks (0)

Ingen kommentarer endnu.


Læg en kommentar


Ingen trackbacks endnu.