With shared machines, running out of disk space can be a huge
nuisance. Some PLSE machines (warfa
in particular) use LVM
(the “Logical Volume Manager”) to make moving / resizing disk
partitions much easier.
Below are some notes on using lvm:
To add a disk as physical storage
-
Repartition the new disk as LVM (run everything as root)
$ fdisk -l # list available disk $ fdisk /dev/sdX # repartition into one big Linux LVM partition (check code)
-
Use
pvcreate
to add the new partition to the available pool$ pvcreate /dev/sda1 # use partition, not disk
-
Add the volume to our volume group
$ vgextend vg /dev/sda1 # warfa only has one volume group, named "vg"
-
Add capacity to existing logical volumes
$ lvextend -L +100G vg/home # e.g., add 100G to home logical volume
-
See how big the logical volumes are
$ sudo lvs
-
Resize the resident filesystem to the right size
$ resize2fs /dev/vg/home # e.g., resize home to its new size
-
To move physical extents to different drive (happens online)
$ man pvmove # AND BE VERY CAREFUL (but it's safe, don't worry)
-
If you want to learn about the options that logical volumes can have
$ man lvconvert # RAID, mirror, snapshots, copy-on-write, etc.