user1758470
user1758470

Reputation: 75

KVM Virtual Machine: Wrong Disk Size

Ever since I did yum update and tried to create a new (for example) 10GB Disk KVM VPS, the reported disk space inside VM is locked to the initial template size (usually 1GB for linux template).

Normally it should be 10GB (fdisk says so, but df command says otherwise).

[root@localhost ~]# resize2fs /dev/vda1
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vda1 to 262160 (4k) blocks.
The filesystem on /dev/vda1 is now 262160 blocks long.

[root@localhost ~]# df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/vda1           1008   760       198  80% /
none                 246     0       246   0% /dev/shm

[root@localhost ~]# fdisk -l

Disk /dev/vda: 10.7 GB, 10737418240 bytes
4 heads, 32 sectors/track, 163840 cylinders
Units = cylinders of 128 * 512 = 65536 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b6106

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1              17       16401     1048640   83  Linux

All above command is taken inside the VM.

Below is disk part of xml configuration on the host node:

disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/kvm/v1046-2ogd-j1p2jraixpg1g03y.raw'/>
      <target dev='vda' bus='virtio' />

</disk>

Sparse RAW is used. Not a problem with older VM.

du -hs on host node:

650M    v1046-2ogd-j1p2jraixpg1g03y.raw

ls -lah on host node:

-rw-r--r--   1 qemu qemu  10G Dec 21 21:03 v1046-2ogd-j1p2jraixpg1g03y.raw

Any help is really appreciated. Thanks for reading.

Upvotes: 0

Views: 1215

Answers (1)

user1758470
user1758470

Reputation: 75

resize2fs /dev/vda1 online inside a VM is not supported. Had to load gparted to extend the partition manually.

Upvotes: 1

Related Questions