I tried to use qemu-nbd in the shell script, but it seems that qemu-nbd has some delay.

Host environment

  • Operating system:MANJARO Linux
  • OS/kernel version:Linux PC 6.0.16-1-MANJARO #1 SMP PREEMPT_DYNAMIC Sun Jan 1 20:43:46 UTC 2023 x86_64 GNU/Linux
  • Architecture:X86
  • QEMU flavor:qemu-nbd
  • QEMU version:7.2.0
  • QEMU command line:
    qemu-nbd -c /dev/nbd0 ~/VM/win7_i386.qcow2

Emulated/Virtualized environment

  • Operating system:
  • OS/kernel version:
  • Architecture:

Description of problem

Steps to reproduce

cat ~/test.sh
#!/bin/bash
qemu-nbd -c /dev/nbd0 $1
mount -t ntfs3 -o uid=1000,gid=1000 /dev/disk/by-label/OS /mnt/OS
sudo ~/test.sh ~/VM/win7_i386.qcow2
mount: /mnt/OS: special device /dev/disk/by-label/OS does not exist.
       dmesg(1) may have more information after failed mount system call.

Additional information

But when I added a one-second delay between qemu-nbd and mount commands, the problem was solved.

The qemu-img convert command also has a similar problem. It seems that these commands have a certain delay. Is this in line with expectations?

Edited by daiaji