Several years ago I installed Debian on my 500 GiB hard disk. During installation I chose to have encrypted filesystem. So installer created one small unencrypted boot partition (I guess that grub configuration is kept there) and one large LUKS encrypted partition. This large encrypted partition is a physical volume, which is the only member of a volume group, on which two logical volumes are created - one for swap and one for everything else. And everything was working fine in this configuration for several years without me thinking too much about it.
Few days ago I bought new 2 TiB hard drive and decided to move my system to it. I copied my old hard drive to my new hard drive - bit by bit, simple by "cat /dev/sda > /dev/sdb". After that my computer was booting fine from my new hard disk, but it was only 500 GiB large, because it had partition table copied from the old hard disk. So I tried to enlarge it.
First I created new (the third) partition on it. I created physical volume on it. I LUKS encrypted this physical volume (using "cryptsetup" command), with the same password as the old partition had. I added this physical volume to already existing volume group. I enlarged already existing logical volume, enlarging filesystem sitting on it as well. I did it all using Knoppix booted from CD. I did not alter grub configuration. Then (I was still at Knoppix) I tried to mount the filesystem from these two encrypted partitions - it worked well, it was one filesystem, 2 TiB large and all files were there.
Then I tried booting from this hard disk. Grub asked me for a password to a LUKS encrypted partition and then failed with these messages:
In these messages we can see uuid "EFc551-(...)" - I don't know what this uuid is.
Commands that grub executes while booting are those (the photo is blurry, but I hope you can read the text):
String "9e5881c3(...)" which you can see in this command is uuid of the old encrypted partition. Now I want to achieve two things:
- understand what goes on,
- be able to boot from my 2 TiB hard disk.
Could you help me to achieve those two goals?
Final solution
Marmarek's idea was the right one.
Contrary to what I thought at the beginning, in my setup (which is, I guess, default Debian setup) grub has nothing to do with LVM. Grub boots small unencrypted boot partition and it's job of that partition's init to decrypt and mount encrypted LVM volumes. So I didn't have to tinker with grub but with initrd. Marmarek suggested to recreate it under Knoppix using update-initramfs, but it did not work. Initrd created by update-initramfs lacked /conf/conf.d/cryptroot file (my original initrd had it) and because of that it didn't try to decrypt any partitions at all. I guessed that maybe it lacked that file because when I run update-initramfs command those partitions were not unencrypted and LVM volumes were not activated?
So I just unpacked my original initrd image and put into its init file such line:
cryptsetup luksOpen UUID=some-uuid udisks-luks-uuid-this-uuid
I don't know if the last argument to cryptsetup must be exactly as I gave it - I just mimicked what I saw in some examples.
The line had to be put in such place inside init where /dev is already mounted - I found such place by trial and error. This was the place right after the line:
run_scripts /scripts/init-top
When I packed back this modified initrd and booted my computer, it asked me for two passwords and worked well.