Tag Archives: disk

LVM – Add space

Add extra disk in a VG and expand existing LV

# df -Th /
Filesystem           Type   Size  Used Avail Use% Mounted on
/dev/mapper/vglocal00-root00
                     ext4    26G   23G  1.5G  95% /

# cfdisk /dev/sdc 
Disk has been changed.

# pvcreate /dev/sdc1 
  Physical volume "/dev/sdc1" successfully created

# pvs
  PV         VG        Fmt  Attr PSize  PFree  
  /dev/sda2  vglocal00 lvm2 a--u 29.75g 224.00m
  /dev/sdb1  vglocal01 lvm2 a--u  9.97g  64.00m
  /dev/sdc1            lvm2 ---- 10.00g  10.00g

# vgextend vglocal00 /dev/sdc1
  Volume group "vglocal00" successfully extended

# pvdisplay  /dev/sdc1 | grep Free
  Free PE               319

# lvextend --extents +319 -n /dev/vglocal00/root00 
  Size of logical volume vglocal00/root00 changed from 25.53 GiB (817 extents) to 35.50 GiB (1136 extents).
  Logical volume root00 successfully resized.

# resize2fs /dev/vglocal00/root00
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vglocal00/root00 is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/vglocal00/root00 to 9306112 (4k) blocks.
The filesystem on /dev/vglocal00/root00 is now 9306112 blocks long.

# df -Th /
Filesystem           Type   Size  Used Avail Use% Mounted on
/dev/mapper/vglocal00-root00
                     ext4    35G   23G   11G  68% /

 

For a most updated article, check this one: http://blog.tian.it/lvm-how-to/