Search Suggest

Bài đăng

Extending / increasing LVM partition size quickly and while staying online

This guide will show you how to increase the partition or LVM logical volume space.

This quick method only uses 2 commands in CLI, one to extend the Logical Volume (LV) and the other to extend the file system partition itself.

In my experience... I have been able to execute STEP 3 and STEP 4 without having to unmount my file system or partition. Even my server application which is using the /dev/ssd/ssd_data file system stayed online during this process.

STEP 1 - EXAMINE YOUR VOLUME GROUP (VG) SIZE


vgdisplay

  --- Volume group ---
  VG Name               ssd
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               159.68 GiB
  PE Size               4.00 MiB
  Total PE              40878
  Alloc PE / Size       20480 / 80.00 GiB
  Free  PE / Size       20398 / 79.68 GiB
  VG UUID               5hhU7Y-fllL-OCn1-UMaa-3IO2-FEX1-8a6daw


STEP 2 - EXAMINE YOUR LOGICAL VOLUME GROUP (LV) SIZE


lvdisplay

  --- Logical volume ---
  LV Path                /dev/ssd/ssd_data
  LV Name                ssd_data
  VG Name                ssd
  LV UUID                v9EA2K-lH9F-eKyq-OtUm-f6Lo-KHVH-qglyQc
  LV Write Access        read/write
  LV Creation host, time a31, 2013-11-21 13:32:47 -0600
  LV Status              available
  # open                 1
  LV Size                80.00 GiB
  Current LE             20480
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1


STEP 3 - INCREASING / EXTENDING LOGICAL VOLUME


lvextend -L +20G /dev/ssd/ssd_data


The above lvextend command will add 20GB to the ssd_data, so the new size should be 100GB.


STEP 4 - RESIZING / INCREASING FILE SYSTEM SIZE


resize2fs /dev/ssd/ssd_data


The above resize command will resize (to maximize the size of the file system to its max capacity which is now +20GB to 100GB).



Đăng nhận xét