What is the qemu-nbd maximum limit?

Mecanik

Well-Known Member
Mar 2, 2017
173
6
58
34
I'm trying to find out if I can add more than 16 nbd devices, because I would need at least 20, is this possible ?

I tried more than 16 but it did not work, only 16 devices show ...

The way I added now is:

Code:
modprobe nbd max_part=16

echo "nbd" >> /etc/modules

cat > /etc/modprobe.d/nbd.conf <<\EOT

options nbd max_part=16

EOT

Please advise...
 
the nbd kernel module parameter max_part is for # of partitions within a nbd device, i.e. /dev/nbd0p1.
The param you want to change is nbds_max (default is 16).
example:
Bash:
root@host# modprobe nbd nbds_max=20
root@host# ls -l /dev/nbd*
brw-rw---- 1 root disk 43,   0 Oct 23 08:19 /dev/nbd0
brw-rw---- 1 root disk 43,  32 Oct 23 08:19 /dev/nbd1
brw-rw---- 1 root disk 43, 320 Oct 23 08:19 /dev/nbd10
brw-rw---- 1 root disk 43, 352 Oct 23 08:19 /dev/nbd11
brw-rw---- 1 root disk 43, 384 Oct 23 08:19 /dev/nbd12
brw-rw---- 1 root disk 43, 416 Oct 23 08:19 /dev/nbd13
brw-rw---- 1 root disk 43, 448 Oct 23 08:19 /dev/nbd14
brw-rw---- 1 root disk 43, 480 Oct 23 08:19 /dev/nbd15
brw-rw---- 1 root disk 43, 512 Oct 23 08:19 /dev/nbd16
brw-rw---- 1 root disk 43, 544 Oct 23 08:19 /dev/nbd17
brw-rw---- 1 root disk 43, 576 Oct 23 08:19 /dev/nbd18
brw-rw---- 1 root disk 43, 608 Oct 23 08:19 /dev/nbd19
brw-rw---- 1 root disk 43,  64 Oct 23 08:19 /dev/nbd2
brw-rw---- 1 root disk 43,  96 Oct 23 08:19 /dev/nbd3
brw-rw---- 1 root disk 43, 128 Oct 23 08:19 /dev/nbd4
brw-rw---- 1 root disk 43, 160 Oct 23 08:19 /dev/nbd5
brw-rw---- 1 root disk 43, 192 Oct 23 08:19 /dev/nbd6
brw-rw---- 1 root disk 43, 224 Oct 23 08:19 /dev/nbd7
brw-rw---- 1 root disk 43, 256 Oct 23 08:19 /dev/nbd8
brw-rw---- 1 root disk 43, 288 Oct 23 08:19 /dev/nbd9

I'm not sure what the practical max is... I tested in a VM and 32000 crashed it (out_of_memory killer).
Could load with nbds_max=1000 without problem, rmmod nbd takes longer though (~15s)