Hey all,
Back again...
While image mounted / in use .....
[root@fedora vd]# cat <(ps -aux | head -1) <(ps -aux | grep nbd)
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 126 0.0 0.0 0 0 ? S< 14:17 0:00 [kworker/u9:0+nbd0-recv]
root 6541 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd0-recv]
root 6544 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd1-recv]
root 6545 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd2-recv]
root 6547 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd3-recv]
root 6550 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd4-recv]
root 6551 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd5-recv]
root 6552 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd6-recv]
root 6553 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd7-recv]
root 6554 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd8-recv]
root 6555 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd9-recv]
root 6556 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd10-recv]
root 6558 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd11-recv]
root 6560 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd12-recv]
root 6561 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd13-recv]
root 6562 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd14-recv]
root 6564 0.0 0.0 0 0 ? I< 17:28 0:00 [nbd15-recv]
root 6575 0.0 0.0 1982620 6700 ? Ssl 17:28 0:00 qemu-nbd -c /dev/nbd0 test.qcow2
root 6589 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-buf/nbd0p1]
root 6591 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-conv/nbd0p1]
root 6592 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-reclaim/nbd]
root 6593 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-blockgc/nbd]
root 6594 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-inodegc/nbd]
root 6595 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-log/nbd0p1]
root 6596 0.0 0.0 0 0 ? I< 17:28 0:00 [xfs-cil/nbd0p1]
root 6597 0.0 0.0 0 0 ? S 17:28 0:00 [xfsaild/nbd0p1]
root 6821 0.0 0.0 221800 2132 pts/0 S 17:33 0:00 grep --color=auto nbd
[root@fedora vd]# nmap -p 10809 localhost
Starting Nmap 7.92 (
https://nmap.org ) at 2022-05-01 18:05 BST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00010s latency).
Other addresses for localhost (not scanned): ::1
PORT STATE SERVICE
10809/tcp closed nbd
[root@fedora vd]# systemctl list-units --type=service | grep nbd
[root@fedora vd]# systemctl list-units --type=service | grep qemu
qemu-guest-agent.service loaded active running QEMU Guest Agent
[root@fedora vd]# netstat -pnltu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0
127.0.0.53:53 0.0.0.0:* LISTEN 693/systemd-resolve
tcp 0 0
0.0.0.0:5355 0.0.0.0:* LISTEN 693/systemd-resolve
tcp 0 0
127.0.0.1:631 0.0.0.0:* LISTEN 815/cupsd
tcp6 0 0 ::1:631 :::* LISTEN 815/cupsd
tcp6 0 0 :::5355 :::* LISTEN 693/systemd-resolve
udp 0 0
0.0.0.0:5353 0.0.0.0:* 719/avahi-daemon: r
udp 0 0
0.0.0.0:5355 0.0.0.0:* 693/systemd-resolve
udp 0 0
0.0.0.0:48300 0.0.0.0:* 719/avahi-daemon: r
udp 0 0
127.0.0.53:53 0.0.0.0:* 693/systemd-resolve
udp 0 0
127.0.0.1:323 0.0.0.0:* 764/chronyd
udp6 0 0 :::5353 :::* 719/avahi-daemon: r
udp6 0 0 :::5355 :::* 693/systemd-resolve
udp6 0 0 :::47159 :::* 719/avahi-daemon: r
udp6 0 0 ::1:323 :::* 764/chronyd
So qemu-nbd is running ( has not exited ) and nothing is running as a service: no server.
I'm not saying this is a problem or a bug - it looks to me like most of the time it works and is supposed to work as a server and in this case it doesn't and isn't supposed to.
Reading the man page I just expected to see it available (via an nbd client) on port 10809....as well as /dev/nbd0 via the usual filesystem interfaces.
( So I tried with -re 2 (read-only , 2 users ) out of curiosity and stuff broke ... )
Unless I've misinterpreted what is going on, it should ideally say, for clarity, in the man page under "-c", that in this case it does not act as a server but on a 1-to-1 basis with the host via whatever method it uses (local socket ?)
A server listening on an open port is a security consideration so it would be nice to know for certain there isn't supposed to be one if there isn't.
Bob.