Centos – VPS: How to update the available hard disk space after upgrade

centoshard driveovhvpsxfs

I made an upgrade of a VPS hosted on OVH, specifically from VPS CLOUD 1 to VPS CLOUD 2 that have 25gb more of previous solution (50gb total).

On this VPS is installed CentOS 7.2.1511

There is the result of df -HT

[root@srv ~]# df -HT
File system    Tipo      Dim. Usati Dispon. Uso% Montato su
/dev/vda1      xfs        27G   12G     16G  42% /
devtmpfs       devtmpfs  2,1G     0    2,1G   0% /dev
tmpfs          tmpfs     2,1G     0    2,1G   0% /dev/shm
tmpfs          tmpfs     2,1G   18M    2,1G   1% /run
tmpfs          tmpfs     2,1G     0    2,1G   0% /sys/fs/cgroup
tmpfs          tmpfs     405M     0    405M   0% /run/user/0

There is the result of fdisk -l | grep Disk

[root@srv ~]# fdisk -l | grep Disk
Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 sectors
Disk label type: dos

Other disk infos:

[root@srv ~]# fdisk -l /dev/vda

Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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
Identificativo disco: 0x000af71d

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    52428799    26213376   83  Linux

I've tried this:

[root@srv ~]# xfs_growfs /dev/vda1 -D 53.7G
meta-data=/dev/vda1              isize=256    agcount=13, agsize=524224 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=6553344, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data size 53 too small, old size is 6553344

And this:

[root@srv ~]# xfs_growfs -d /dev/vda1 
meta-data=/dev/vda1              isize=256    agcount=13, agsize=524224 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=6553344, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data size unchanged, skipping

Obviously without success.

[UPDATE]
The output with pr command on parted:

Modello: Device a blocchi Virtio (virtblk)
Disco /dev/vda: 53,7GB
Dimensione del settore (logica/fisica): 512B/512B
Tabella delle partizioni: msdos
Flag del disco: 

Numero  Inizio  Fine    Dimensione  Tipo     File system  Flag
 1      1049kB  26,8GB  26,8GB      primary  xfs          avvio
 2      26,8GB  53,7GB  26,8GB      primary  xfs

How can I expand the available disk space without destroy data? Reboot server isn't a problem.

Best Answer

xfs_growfs -d /dev/vda1

Capital -D grows to specified size in filesystem blocks, and it doesn't understand 'G'. As such it assumed you wanted 53 filesystem blocks, which failed.

Lower case -d grows to maximum size.

If you want specific size, you should calculate it in the blocks, e.g. from fdisk output the maximum size is 26213376. Then -D 26213376 will also grow it to the maximum from 6553344 blocks that you have now.

Related Topic