Resizing Encrypted Linux volumes on LVM# 21 Nov 2019 by Sean
Recently I set up a fully encrypted Linux install alongside Windows using LVM to
/home partitions, as well as
swap. This all went fine
and dandy until I realized I had been a little greedy and given root nowhere
near enough space (I was trying to horde it all for the
/home volume). So, I
had to figure out how to shift that space around. This, for my own memory, is
This assumes a setup like the one I described in my setup post.
So, if like me, you only gave 8GB to the
/ logical volume, you’ll probably
quickly realize that that’s nowhere near enough (I found out when I tried
installing WINE and ran out of space… which was also the same time neovim
started going haywire with the async linter).
This is thankfully easy to fix.
- Power down and boot from your install USB (you still have that right? Otherwise make one in the Ubuntu install media creator)
- Don’t start the installer, just “try” Ubuntu
- Open a terminal, and unlock your LUKS partition:
# where /dev/sdaMAIN is the same partition you set up LUKS on before, # and encryptedubuntu is the name you gave to that partition when you encrypted it $ sudo cryptsetup luksOpen /dev/sdaMAIN encryptedubuntu
Now, if you run
lvdisplay you should see the
physical volume, volume group, and logical volumes you’ve created previously.
I’m going to assume that we’re subtracting space from the
/home logical volume
to cede to the
/ LV. If you’re actually resizing the
go do some DDG searching–lotsa answers (I mean… same for this process really,
First, shrink the home LV:
$ sudo lvreduce --resizefs --size -50G /dev/VGencryptedubuntu/LVencryptedubuntuHOME
Then, expand the root LV:
$ sudo lvextend -l +100%FREE /dev/VGencryptedubuntu/LVencryptedubuntuROOT
If you don’t want to give it all the available space,
man will be your friend
(now that’s a sentence amirite?).
Finally, you need to expand the filesystem on the now-expanded root LV:
$ sudo resize2fs /dev/VGencryptedubuntu/LVencryptedubuntuROOT
This will likely complain at you about running
fsck -f on the filesystem first
to find and fix any issues (usually about making sure that the blocks are
contiguous). So do that.
And now, reboot. You done doed it.