When you have a NON-LVM xfs filesystem that you need to expand without rebooting on VMWare… Follow this guide… Bumped into this one day… So…

  • First of all expand your disk image to your desired size. In my example I went from 250GB –> 300GB
  • SSH into your VM. As you can see now the disk still remains at the 250GB
# Current partition size
[root@portainer02prod ~]# fdisk -l
 
Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 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: 0x000d1b93
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    31467519    14684160   8e  Linux LVM
 
Disk /dev/sdb: 268.4 GB, 268435456000 bytes, 524288000 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
  • Run following command to rescan your partition. (Here it is /dev/sdb that needs a resize)
[root@portainer02prod ~]# echo 1 > /sys/block/sdb/device/rescan
  • Confirm that this worked
[root@portainer02prod ~]# fdisk -l
 
Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 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: 0x000d1b93
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    31467519    14684160   8e  Linux LVM
 
Disk /dev/sdb: 322.1 GB, 322122547200 bytes, 629145600 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
  • Whoop Whoop (You should say now…). Now we can grow the XFS filesystem to the desired size and have some space on the disk again 🙂
[root@portainer02prod ~]# xfs_growfs /dev/sdb
meta-data=/dev/sdb               isize=512    agcount=4, agsize=16384000 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=65536000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=32000, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 65536000 to 78643200 --> Resized