Thursday, January 13, 2022

VMWARE extend LVM partition in linux using GPARTED

 A lot of instructions can be found on the internet with the most official this one [Complete Guide] How to Increase space on Linux vmware. This guide is creating a new partition and connecting it to the LVM. The following steps are extending the existing partition and the LVM.

 

Before I bumped into this article I did my one things which where not complying with the above guide so I could not use it. So I will describe you my steps and you can use them as more easy way to extend LVM

  1.  Added extra space from VMWARE. 
    1. Virtual machine settings -> Hard Disk -> Expand
  2. Logged in my Fedora and with gparted I extended my disk
  3. Then open terminal and type  lvdisplay to find the logical volume you want to extend. You will see something like that :

  --- Logical volume ---
  LV Path                /dev/fedora/root
  LV Name                root
  VG Name                fedora
  LV UUID                5pueVE-DkS9-9KdL-u39f-qlYq-4Yo2-3brBlu
  LV Write Access        read/write
  LV Creation host, time 192.168.120.133, 2017-01-27 15:59:57 +0200
  LV Status              available
  # open                 1
  LV Size                <43.27 GiB
  Current LE             11076
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/fedora/home
  LV Name                home
  VG Name                fedora
  LV UUID                mi5PEa-MLZB-0TM5-tD3S-9w5w-eKSq-j09GW3
  LV Write Access        read/write
  LV Creation host, time 192.168.120.133, 2017-01-27 15:59:59 +0200
  LV Status              available
  # open                 1
  LV Size                <33.67 GiB
  Current LE             8619
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

4. Then type the following command: lvresize -L +5G /dev/fedora/home
5. Then type the following command: df -h to find the filesystem name.

Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 5.9G     0  5.9G   0% /dev
tmpfs                    5.9G     0  5.9G   0% /dev/shm
tmpfs                    2.4G  2.1M  2.4G   1% /run
tmpfs                    4.0M     0  4.0M   0% /sys/fs/cgroup
/dev/mapper/fedora-root   43G   39G  2.1G  96% /
tmpfs                    5.9G   44K  5.9G   1% /tmp
/dev/sda1                976M  225M  684M  25% /boot
/dev/mapper/fedora-home   34G   26G  5.7G  83% /home
overlay                   43G   39G  2.1G  96% /var/lib/docker/overlay2/85bc5ded5006148967e7b5618e8844cc2c2b614af1bc3ca47a764e8ae7b44935/merged
tmpfs                    1.2G  168K  1.2G   1% /run/user/1000

 6. Finally type the following command: resize2fs -p /dev/mapper/fedora-home