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

  1. 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)
  2. Use pvcreate to add the new partition to the available pool

       $ pvcreate /dev/sda1 # use partition, not disk
  3. Add the volume to our volume group

       $ vgextend vg /dev/sda1 # warfa only has one volume group, named "vg"
  4. Add capacity to existing logical volumes

       $ lvextend -L +100G vg/home # e.g., add 100G to home logical volume
  5. See how big the logical volumes are

       $ sudo lvs
  6. Resize the resident filesystem to the right size

       $ resize2fs /dev/vg/home # e.g., resize home to its new size
  7. To move physical extents to different drive (happens online)

       $ man pvmove # AND BE VERY CAREFUL (but it's safe, don't worry)
  8. If you want to learn about the options that logical volumes can have

       $ man lvconvert # RAID, mirror, snapshots, copy-on-write, etc.