Shrink An Encrypted LUKS Partition
Jump to navigation
Jump to search
I needed to shrink my root ("/") partition in order to make my "/boot" partition larger so that could run the preupgrade utility to update from F13 to F14. My disk geometry was:
Device Boot Start End Blocks Id System /dev/sda1 * 63 3662109 1831023+ 83 Linux /dev/sda2 3665352 976773167 486553908 83 Linux
/dev/sda1 contains "/boot" as a native ext3 partition /dev/sda2 is a LUKS encrypted partition, home to a Logical Volume Group, which contains a logical swap partition and another partition which contains my root ("/") ext3 filesystem.
My steps were:
- Shrink the root partition
- Shrink the volume group that contains it
- Shrink the LUKS encrypted partition
- Shrink /dev/sda2
- Move /dev/sda2 to the end of the physical disk
- Expand /dev/sda1
- Expand the /boot filesystem
My guidance for this came from http://ubuntuforums.org/showthread.php?p=4530641
- Boot from Knoppix DVD
- Decrypt the LUKS partition
>sudo cryptsetup luksOpen /dev/sda5 crypt1
- Activate the LVM partitions
>sudo vgscan --mknodes >sudo vgchange -ay