How do I resize an encrypted LVM to install another copy of Ubuntu?

There are no graphical tools to resize your encrypted partition. You can do so manually from the command line.

Resizing an encrypted partition must be performed from a live CD and support for encryption and LVM are not included on the live CD.

Boot the live (Desktop) CD and install lvm2 and cryptsetup.

sudo apt-get update && sudo apt-get install lvm2 cryptsetup

Load the cryptsetup module.

sudo modprobe dm-crypt

Decrypt your file system.

sudo cryptsetup luksOpen /dev/sda5 crypt1

Get the live CD to recognize (activate) your LVM.

sudo vgscan --mknodes
sudo vgchange -ay

You can now manage your encrypted partitions, mount them, copy them, or perform maintenance (fsck, backup, resize).

Reduce the size of your file system with resize2fs (this tool works on ext2 and ext3 partitions). You need to check the file system before you can resize it.

sudo e2fsck -f /dev/mapper/hardy-root
sudo resize2fs -p /dev/mapper/hardy-root 5g

Replace the "5g" with your intended size (in Gb) of your filesystem.

Check that the file system is still intact with e2fsck.

sudo e2fsck -f /dev/mapper/hardy-root

Reduce the size of your root (LVM) Logical Volume. The -L flag is how much you want to reduce the size of your (LVM) Logical Volume, so keep this in mind.

Display your (LVM) Logical Volumes with lvdisplay.

sudo lvdisplay

Note how much you need to reduce your root (LVM) Logical Volume by (in my case it was 4.3 Gb).

sudo lvreduce -L -4.3G /dev/hardy/root

Note: You will need to change the "-4.3G" to the proper size to reduce your (LVM) Logical Volume to your desired size.

Re-display your (LVM) Logical Volumes to check the final size is correct.

sudo lvdisplay

Resize your (LVM) Physical Volume.

The physical volume used by LVM can become "fragmented" in that the (LVM) Logical Volumes within the (LVM) Physical Volume are not always in order. There is no defragmentation tool, so if you may need to manually move the logical partitions (back up the data, delete the (LVM) Logical Volume, re-create a replacement (LVM) Logical Volume, restore data from backup).

In order to resize the (LVM) Physical Volume I had to manually move (delete then recreate) the swap (LVM) Logical Volume.

Show the size of your physical volume with pvdisplay

sudo pvdisplay

Remove the swap (LVM) Logical Volume

sudo lvremove /dev/hardy/swap_1

Resize the (LVM) Physical Volume.

sudo pvresize --setphysicalvolumesize 5.6G /dev/mapper/crypt1

Now we will restore (recreate) the swap (LVM) Logical volume.

Set permissions of (LVM) Physical Volume to allow allocation (if needed)

sudo pvchange -x y /dev/mapper/crypt1

Restore the swap (LVM) Logical Volume.

sudo lvcreate -L 512m -n swap_1 hardy
sudo mkswap -L swap_1 /dev/hardy/swap1

As the mkswap command finishes it will print the new uuid to the terminal.

Update fstab with new uuid (use any editor)

Mount the root (LVM) Logical Volume.

sudo mount /dev/hardy/root /mnt

Edit /etc/fstab

gksu gedit /mnt//etc/fstab

Copy-paste the new uuid from the terminal to fstab, updating the uuid for your swap partition. Save and exit gedit Unmount the root (LVM) Logical Volume

sudo umount /mnt

Re-lock the (LVM) Physical Volume after adding the (LVM) Logical Volume swap (locking the (LVM) Physical Volume keeps it from changing).

sudo pvchange -x n /dev/mapper/crypt1

Resize your crypt.

Show the size of your crypt with cryptsetup.

sudo cryptsetup status crypt1

This shows the size of your crypt in sectors. Make note of the offset

offset: 2056 sectors

Resize with cryptsetup.

sudo cryptsetup -o 2056 -b 11800000 resize crypt1

-o = offset (get this from the status command) -b = size in sectors.

Resize your partitions with fdisk.

Unmount your LVM and crypt :

sudo vgchange -an
sudo cryptsetup luksClose crypt1

Now the scary part, use fdisk to manually resize your partitions.

If you are unfamiliar with fdisk, I advise you read how to partition with fdisk

fdisk does NOT overwrite data, so if you make a mistake you should be able to "undo" the changes.

List your partition information with fdisk.

sudo fdisk -l

WRITE THIS INFORMATION DOWN (or print it out).

Re-write your partition table. To do this, use fdisk to DELETE your partitions and RECREATE them, but in a smaller size.

sudo fdisk /dev/sda

This was my fdisk session :

The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d
Partition number (1-5): 5

Command (m for help): d
Partition number (1-5): 2

Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 2
First cylinder (32-1305, default 32):
Using default value 32
Last cylinder or +size or +sizeM or +sizeK (32-1305, default 1305): +6000M

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (32-761, default 32):
Using default value 32
Last cylinder or +size or +sizeM or +sizeK (32-761, default 761):
Using default value 761

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (762-1305, default 762):
Using default value 762
Last cylinder or +size or +sizeM or +sizeK (762-1305, default 1305):
Using default value 1305

Command (m for help): p

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000a6bf9

Device Boot Start End Blocks Id System
/dev/sda1 * 1 31 248976 83 Linux
/dev/sda2 32 761 5863725 5 Extended
/dev/sda3 762 1305 4369680 83 Linux
/dev/sda5 32 761 5863693+ 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Cancel the "Authentication" dialog that appears (the live CD is trying to auto-mount your new partition).

The LVM partition's system id should also be changed to "Linux LVM":

Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 8e
Command (m for help): w

Failure to do this may cause the beginning sector of the logical partition not to line up with where it used to be, and the LVM will be unreadable!

I HIGHLY ADVISE YOU READ THE FULL WIKI PAGE FIRST

See: https://help.ubuntu.com/community/ResizeEncryptedPartitions

Once you have free space you can use it to install ubuntu from the graphical installer.

I advise you reboot after you finish resizing and before you install.