Ubuntu – LVM setup advice

hard drivelvmpartitioning

As I understand it, using LVM is the preferred method when setting up Ubuntu. After reading a little about LVM on https://wiki.ubuntu.com/Lvm I decided to reinstall Ubuntu with LVM in mind.

My desktop computer is using a 500GB SSD, 4TB, and a 2TB hard drives setup. I want to have Ubuntu utilize the 500GB and 4TB hard drives. I will eventually dual boot into Windows, so the 2TB hard drive is reserved for Windows.

As I understand it there are three concepts that LVM manages. Physical Volumes which are the actual hard drives I can physically install. Logical Volumes which are symbolic hard drives I may create by partitioning a physical hard drive into several sections. Finally, the Volume Groups which is a grouping of physical volumes and logical volumes.

This is why I think I can tell my Ubuntu OS that the computer has one volume group, managed by LVM, and that group will be made up of the 500GB SSD and 4TB HHD. I am hoping that when I look at my computer's properties it will display the sum of these drive's storage.

So, I first installed Ubuntu by erasing the disk and using LVM on the 500GB SSD. Then I used gparted to format the 4TB hard drive in LVM2 PV and I opened a terminal and used the following commands:

sudo lvm vgextend ubuntu-vg /dev/sdb1 

This seemed to work. When I use the vgdisplay command it shows that the volume group is the sum of the two hard drives I combined. However, the properties of / reflects only the 500GB. Is this one of the perks to using LVM? Did I do this right?

Best Answer

You only extended the size of the Volume Group but didn't extend the size of your logical volume and the size of the file system.

E.g. to increase logical volume you need

lvresize --size +4T /dev/ubuntu-vg/substitute_your_rootfs_volume_name

4TB might be a bit too much depending on your LVM PV size (then reduce it a bit). That's why it is a bit easier to use GUIs...

To resize your file system, you first need to check what filesystem you are using. E.g. for ext4 you can use

sudo resize2fs /dev/ubuntu-vg/substitute_your_rootfs_volume_name

or for btrfs

sudo btrfs filesystem resize max /

(You can grow ext4 and btrfs online, you don't need to unmount them)

P.S. if you want to work from GUI, you can try KDE Partition Manager 3.0 (Available on Ubuntu 17.04), it supports much more LVM operations compared to GParted, e.g. you will be able to extend/reduce volume groups, resize logical volumes, etc.

Also it won't necesseraly be the case that SSD will stop working before HDD. Modern SSDs work fairly well. As long as you have backups, I wouldn't be scared combining them into single VG. Of course then the location of LVM LVs would determine which ones are fast (on SSD) and which ones are slow.

Related Question