1

Inside vmware ESXI I have a CentOS virtual machine, and I resized the virtual disk from around 30 GB to 120 GB using vmware "edit" vm menu.

Then I booted using a gparted bootable ISO and resized the partition from 30GB to maximum (120 GB)

But now when I boot I still see the main partition (/root) as around 25 GB. From what I can tell (below code) the disk is seen as ~120GB but not the partitions ?

What commands to run in order to safely expand the partition ? I think that is /root that needs to be expanded.

[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 26G 1.6G 25G 6% / devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.9M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 1014M 145M 870M 15% /boot tmpfs 783M 0 783M 0% /run/user/0 [root@localhost ~]# fdisk -l Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 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: 0x000d5212 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 251658239 124779520 8e Linux LVM Disk /dev/mapper/centos-root: 27.9 GB, 27913093120 bytes, 54517760 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: 3221 MB, 3221225472 bytes, 6291456 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 

EDIT:

[root@localhost ~]# lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 xfs 2499226d-4c93-4ef1-b4ab-1055f8bab7cd /boot └─sda2 LVM2_member 49Sk0d-ClAm-FGza-9HrJ-hYGP-V1Zn-UlrgaO ├─centos-root xfs f78ccb25-5dcc-49fc-81b8-5c33e6b5e9ef / └─centos-swap swap 100d2a33-ab8d-4dd8-8e6c-19d51ad53a40 [SWAP] sr0 [root@localhost ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- <119.00g 90.00g 

EDIT 2:

[root@localhost ~]# vgdisplay --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size <119.00 GiB PE Size 4.00 MiB Total PE 30463 Alloc PE / Size 7423 / <29.00 GiB Free PE / Size 23040 / 90.00 GiB VG UUID dpAjcO-xazq-6sJZ-PA23-N0a0-Zcz3-iRVloi [root@localhost ~]# lvdisplay --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID ZuJyt6-YDaV-1kw7-Zjzl-4gPX-vkzH-dfmV7y LV Write Access read/write LV Creation host, time localhost, 2019-04-01 19:44:02 -0400 LV Status available # open 2 LV Size 3.00 GiB Current LE 768 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 --- Logical volume --- LV Path /dev/centos/root LV Name root VG Name centos LV UUID KkcOnV-OQvj-lpmc-5Eiz-2hfd-6mcV-30zWvW LV Write Access read/write LV Creation host, time localhost, 2019-04-01 19:44:03 -0400 LV Status available # open 1 LV Size <26.00 GiB Current LE 6655 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 
4
  • 1
    You have a logical volumes which you need to extend. Add the output of lsblk -f as well as pvs and vgdisplay and lvdisplay to your question. Commented Apr 16, 2019 at 23:31
  • I added lsblk -f and pvs Commented Apr 16, 2019 at 23:35
  • Also add vgdisplay and lvdisplay. Do you want to extend to all of the free space that you added? Commented Apr 16, 2019 at 23:36
  • Added vgdisplay and lvdisplay. Yes, I want to expand to that full space (~120 GB) Commented Apr 16, 2019 at 23:38

1 Answer 1

1

Edit:

It looks like you've already created the partition and physical volume and added the space to the volume group so I've removed the parts regarding adding a new partition to the disk and creating a new physical volume.

To expand your root logical volume:

lvextend -l +100%FREE /dev/centos/root 

To sync the new space:

xfs_growfs /dev/centos/root 

Run df -h to see the new size with the extra space and lvdisplay | sed -n '/root/,$p to see the increased size of the root logical volume itself.

3
  • Thanks. The commands need to be run from a different ISO ? Or I can run them from the partition's OS ? Commented Apr 17, 2019 at 9:52
  • @adrianTNT Run them from inside of the OS itself. Commented Apr 17, 2019 at 12:06
  • Great. It worked nicely. Commented Apr 17, 2019 at 13:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.