Skip to main content

LVM - Add new disk and extend FS

Rescan for newly added disks without rebooting:

The command will iterate over all found host adapters and trigger a rescan.

>> for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdc  /dev/sdc1
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdc  /dev/sdc1
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdc  /dev/sdc1  /dev/sdd
- - -
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdc  /dev/sdc1  /dev/sdd  /dev/sdd1

The output shows when a new drive has been discovered.

LVM add "physical" disk and extend FS

  • Make sure there is a Partition Table and a Partition for LVM
fdisk /dev/<disk>
>> create new gpt table: g
>> create new partition: n
>> set type of partition to lvm: t 
>> show partition codes: L
>> insert type: <type from L (Linux LVM)>
>> write changes: w
  • Expand existing LVM VG
pvcreate /dev/<disk-partition>
vgextend <existing-vg> /dev/<disk-partition>
  • Expand existing LVM LV
# find the correct logical volume
lvdisplay | grep Path 

# expand found lv
lvresize -l +100%free <lv path>
  • Expand the ext4 filesystem on it
resize2fs <lv path>

Sources: