I use LVM on my main desktop machine. This is awesome because it allows me to dynamically allocate space to partitions as I choose, however I always forget how to do a resize, so I’m going to write it down here. This isn’t going to be a full LVM tutorial (there’s plenty of material out there for that), although maybe that’s an idea for the future.
The following commands will resize an ext2, ext3, or ext4 filesystem running on LVM while it is mounted:
$ sudo lvresize -L +XXG <path to fs device>
$ sudo resize2fs <path to fs device>
In the above command you need to replace XX with the number of GB you want the filesystem to grow by and <path to fs device> by the device node (typically /dev/mapper/something).
An there you have it, done! Obviously there is a huge amount more you can do with the two tools above, take a look at their man pages for more info.
Hopefully this post will save me from having to work out how to do this every time!
Leave a Reply