linux logical volume : extend disk free space...




diskPartition.png


One can extend the current partition to use unused space.
example: a scenario of ubuntu /dev/sda with partition /dev/sda5  having 3.92Gig UNUSED.
~$ sudo vgdisplay
[sudo] password for tperiasa:
  --- Volume group ---
  VG Name               ub-14-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
......
  VG Size               9.81 GiB
  PE Size               4.00 MiB
  Total PE              2512
  Alloc PE / Size       1506 / 5.88 GiB
  Free  PE / Size       1006 / 3.93 GiB
  VG UUID               Qm1M5I-0TcK-Uoep-nxir-8Ldd-dufJ-UsQ65l
$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/ub-14-vg/root
  LV Name                root
  VG Name                ub-14-vg
......
  # open                 1
  LV Size                3.89 GiB
  Current LE             995
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0


  --- Logical volume ---
  LV Path                /dev/ub-14-vg/swap_1
  LV Name                swap_1
  VG Name                ub-14-vg
.........
  # open                 2
  LV Size                2.00 GiB
  Current LE             511
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
sudo lvextend -L+3.92G /dev/ub-14-vg/root
Follow the above by resizing.. (NO NEED to reboot).
sudo resize2fs -p /dev/ub-14-vg/root
/dev/ub-14-vg/root is the LVPath(logical volume path), when you do a vgdisplay command it shows up:
========= In LVM, there are several layers, each builds on top of the other:
PV[s] (Physical Volumes) -> VG[s] (Volume Groups) -> LV[s] (Logical Volumes) -> Filesystems.

Popular Posts