Ubuntu LTS 18 luks volume shrink script
Disclaimer, this script is not (yet) intended for production purpose. Do not use it on anything with important data and do a backup beforehand.
This script allow to shrink an LVM on LUKS Ubuntu Volume offline
Usage:
Usage: luksShrink -p <part> -s <size> [-g <volume group name>] [-h]
-p <part> : Partition containing the LUKS volume to resize
-s <size> : New desired size for the LUKS volume
-g <volume group name> : Chose volume group instead of standard ubuntu-vg
-h : Print this
For now, it should be only used it on a fresh luks full disk Ubuntu 18/20 install offline
It has been tested with Ubuntu 18 in EFI boot mode only but it should also work the same way on with the -g option to select the right Volume Group on Ubuntu 20
- Install Ubuntu on the whole disk with LVM+LUKS enable
- Boot on it to check everything is working
- Reboot on the live usb of ubuntu LTS 18/20
- Execute this script to shrink the LVM on LUKS volume of ubuntu to get space for Windows 10
- install Windows 10 on the free space
- reboot on Windows and check everything is fine, DO NOT ENABLE BITLOCKER AT THIS POINT
- reboot to modify back EFI boot in BIOS to ubuntu(Grub)
- Boot on Ubuntu and do a >sudo update-grub
- Reboot on windows using Grub and enable bitlocker.
- You should now have a fully fonctionnal encrypted dualboot windows 10(Bitlocker) + Ubuntu 18/20(LUKS)
luksShrink -p /dev/nvme0n1p3 -s 200G
is going to shrink /dev/nvme0n1p3 to 200G using ubuntu-vg as default volume group
luksShrink -p /dev/nvme0n1p3 -s 300G -g vgcustom
is going to shrink /dev/nvme0n1p3 to 300G using vgcustom as volume group