1

after incrase the disk space of my centos vm (in esxi hypervisor)

when i execute fdsik

[root@sopiqecommerce ~]# fdisk -l

Disk /dev/sda: 504.7 GB, 504658657280 bytes, 985661440 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bd0c1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   985661439   491781120   8e  Linux LVM

Disk /dev/mapper/centos-root: 241.7 GB, 241721933824 bytes, 472113152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4160 MB, 4160749568 bytes, 8126464 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-home: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

when i execute df -h :

[root@sopiqecommerce ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  226G  106G  120G  48% /
devtmpfs                 2.9G     0  2.9G   0% /dev
tmpfs                    2.9G     0  2.9G   0% /dev/shm
tmpfs                    2.9G  8.8M  2.9G   1% /run
tmpfs                    2.9G     0  2.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  186M  829M  19% /boot
/dev/mapper/centos-home   20G   33M   20G   1% /home
tmpfs                    581M     0  581M   0% /run/user/0

i add 200 gb to disk using gparted

any missing configuration to use the unallocated 200gb ?

[update]

when i execute lvdisplay :

[root@sopiqecommerce ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                S40JP2-OofD-BRls-TeFj-uP6g-aBuh-mjKHyP
  LV Write Access        read/write
  LV Creation host, time sopiqecommerce, 2019-02-19 14:55:47 +0100
  LV Status              available
  # open                 2
  LV Size                <3.88 GiB
  Current LE             992
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                rHtm3b-0dqp-PXvF-OAaS-rLzR-TeW5-7E21cd
  LV Write Access        read/write
  LV Creation host, time sopiqecommerce, 2019-02-19 14:55:47 +0100
  LV Status              available
  # open                 1
  LV Size                225.12 GiB
  Current LE             57631
  Segments               4
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                g33dwM-E1cZ-G6BM-2OP1-ilap-yS7k-ABU5Po
  LV Write Access        read/write
  LV Creation host, time sopiqecommerce, 2019-02-23 13:22:22 +0100
  LV Status              available
  # open                 1
  LV Size                20.00 GiB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

should i execute lvextend -l+100%FREE /dev/mapper/centos-root , to incrase the /root partition ?

1 Answers1

1

Odds are you are using LVM disks, so you need to expand the logical volume as well.

You need to run :

lvdisplay

Find the Logical Volume to which you want to add space, and run the following command :

lvextend -l+100%FREE /dev/full/path/here

Once that's done, you also need to run :

resize2fs /dev/full/path/here

df -h should now show the proper size

Dexirian
  • 430
  • 2
  • 11