Resizing LVM partition that is on a crypted device.
I installed sysrescd on an USB stick to resize a partition that had too little space on it. The hitch was that it was on an encrypted partition. This is the correct order of the commands that needed to be issued.
sda3 is the encrypted device systemvg is the name of the volume group lv_usr is the name of the logical volume
1 cryptsetup luksOpen /dev/sda3 crypt 2 vgcreate systemvg /dev/mapper/crypt 3 lvm vgchange --ignorelockingfailure -P -a y 4 lvextend -L+2G /dev/systemvg/lv_usr 5 e2fsck -f /dev/systemvg/lv_usr 6 resize2fs /dev/systemvg/lv_usr
Transfer partition from one server to another
The following is an example of how to transfer a partition from one server to another.
In the example, I first create a file containing the partition, and then transfer the partition to the other server.
1 dd if=/dev/xen-1/aktagon.com-disk of=/tmp/file 2 scp /tmp/file username@host:/file
I then SSH to the other server and create the partition from the file.
1 ssh host 2 lvcreate -L 4G /dev/VG00/aktagon.com-disk 3 cat aktagon.com-disk.bz2 > /dev/aktagon-1/aktagon.com-disk
Remember to create a backup before running these commands.