Hi All, 

I am unable to figure out the issue here, when I try to create a filesystem (ext4) on a virtual disk using qemu-nbd. This happens intermittently. 

Following is the sequence of commands:- 

$> qemu-img create -f qcow2 test.qcow2 30G


$> qemu-nbd --connect=/dev/nbd0 test.qcow2


$> mkfs.ext4 /dev/nbd0

 mkfs.ext4: Device size reported to be zero.  Invalid partition specified, or
Thu Jun 13 14:44:24 2019 partition table wasn't reread after running fdisk, due to
Thu Jun 13 14:44:24 2019 a modified partition being busy and in use.  You may need to reboot
Thu Jun 13 14:44:24 2019 to re-read your partition table.


Following is the version details:

root@localhost:~# qemu-img --version

qemu-img version 2.8.1(Debian 1:2.8+dfsg-6+deb9u7)

Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers


root@localhost:~# qemu-nbd --version

qemu-nbd version 0.0.1

Written by Anthony Liguori.


Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


root@localhost:~# uname -a

Linux localhost 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux


Regards
Tanmoy Sinha