-3

I am trying to understand what is going on with my VMWare instance. I have had 50GB partition that I extended to 150GB and resized the partition. However, the partition still shows that it only has 50GB size. Here is a screenshot from GParted:

GParted

Here is the output of parted -l

Model: VMware Virtual disk (scsi)
Disk /dev/sda: 161GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  512MB  511MB  primary   ext2         boot
 2      513MB   161GB  161GB  extended
 5      513MB   161GB  161GB  logical                lvm


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/mx1--vg-swap_1: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system     Flags
 1      0.00B  1074MB  1074MB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/mx1--vg-root: 52.1GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
 1      0.00B  52.1GB  52.1GB  ext4

and here is the output of fdisk -l

Disk /dev/sda: 150 GiB, 161061273600 bytes, 314572800 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
Disklabel type: dos
Disk identifier: 0xe541908b

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1  *       2048    999423    997376   487M 83 Linux
/dev/sda2       1001470 314572799 313571330 149.5G  5 Extended
/dev/sda5       1001472 314572799 313571328 149.5G 8e Linux LVM


Disk /dev/mapper/mx1--vg-root: 48.5 GiB, 52097449984 bytes, 101752832 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/mx1--vg-swap_1: 1 GiB, 1073741824 bytes, 2097152 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

Output of df -h:

Filesystem                Size  Used Avail Use% Mounted on
udev                      7.9G     0  7.9G   0% /dev
tmpfs                     1.6G  9.0M  1.6G   1% /run
/dev/mapper/mx1--vg-root   48G   46G  452K 100% /
tmpfs                     7.9G     0  7.9G   0% /dev/shm
tmpfs                     5.0M     0  5.0M   0% /run/lock
tmpfs                     7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/sda1                 472M   57M  391M  13% /boot
tmpfs                     1.6G     0  1.6G   0% /run/user/1000

/dev/sda has a size of 160GB; however, the device mapper /dev/mapper/mx1--vg-root has only size of 50GB. The mapper maps the VDisk into the OS as far as I understand. When I do anything, I keep getting an error that there is no physical space in disk.

EDIT: I think I did not clarify my question properly. My issue is not in ESXI host but a Linux guest running in the hypervisor.

Gasim
  • 977
  • 4
  • 14
  • 23
  • 1
    Why are you doing any of this yourself, the ESXi host UI lets you grown VMFS partitions with a few GUI clicks - there's literally no point trying to do this yourself, ESXi isn't a linux operating system, don't treat it like one. – Chopper3 Mar 18 '19 at 14:36
  • @Chopper3 the problem that I had was that, when I resized the disk from the host, the disk size was resized but the guest host was still the same size. Everything in the forums told me to do this via GParted. This issue also existed in Windows guests. I always go to management console to increase the FS size to the newly provisioned size. – Gasim Mar 18 '19 at 15:16

1 Answers1

-2

After reading in blogs etc, I figured out the issue. The device mapper is a logical volume and the filesystem in that volume was small. So, I had to first increase the logical volume, then resize the filesystem. So, I ended up doing the following:

  1. lvresize -l +100%FREE /dev/mapper/mx1--vg-root -> This increased the volume until the FREE space (no need to calculate it manually). Now, fdisk showed that the volume is resized (/dev/mapper/mx1--vg-root). However, the filesystem was still at 50GB (df -h)
  2. resize2fs /dev/mapper/mx1--vg-root. This command resized the FS to the allocated size. Now the size shows 150GB as necessary.

Before doing these, create a backup of your disk just to be safe.

Gasim
  • 977
  • 4
  • 14
  • 23