
On Wed, May 31, 2017 at 2:51 PM, Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
Hello, I seem to remember that online resize of VirtIO disk is possible. Now I have an Oracle Linux VM with 2.6.39-400.215.3.el6uek.x86_64 kernel where I resize a disk (/dev/vdb) from 500Gb to 900Gb. Apparently the kernel acquired the change because in /var/log/messages I see:
May 31 14:16:16 dbatest3 kernel: virtio_blk virtio6: new size: 1887436800 512-byte logical blocks (966 GB/900 GiB)
but fdisk seems not to be able to recognize it:
[root@dbatest3 ~]# fdisk -l /dev/vdb
Disk /dev/vdb: 536.9 GB, 536870912000 bytes 16 heads, 63 sectors/track, 1040253 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
[root@dbatest3 ~]#
It seems that one of these two commands got the change available: [root@dbatest3 ~]# blockdev --flushbufs /dev/vdb [root@dbatest3 ~]# blockdev --rereadpt /dev/vdb Now [root@dbatest3 ~]# fdisk -l /dev/vdb Disk /dev/vdb: 966.4 GB, 966367641600 bytes 16 heads, 63 sectors/track, 1872457 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 [root@dbatest3 ~]# tail -3 /var/log/messages May 31 14:16:16 dbatest3 kernel: virtio_blk virtio6: new size: 1887436800 512-byte logical blocks (966 GB/900 GiB) May 31 15:13:49 dbatest3 kernel: vdb: detected capacity change from 536870912000 to 966367641600 May 31 15:13:49 dbatest3 kernel: vdb: unknown partition table [root@dbatest3 ~]# I found the hint/suggestion through this proxmox thread: http://pve-devel.pve.proxmox.narkive.com/LBZ1yFpv/online-resize-of-virtio-bl... Just in case other guys need the same... ;-)