I am running a server with Debian 8, and after running modprobe nbd
, the program runs just fine. However, the device is not created since /dev/nbd0
does not exist. What should I do to get modprobe to run properly?
![](../../users/profiles/291733.webp)
- 113
- 1
- 5
-
I have a feeling that you're comparing an old version to the system you're on. The fact that your application can access the networked drive is already proof enough that it is working. – Julie Pelletier Jul 02 '16 at 17:39
1 Answers
I have a partial answer that effectively works around your problem but does not conclusively explain why the problem happened in the first place.
Resolution
Run these commands:
sudo rmmod nbd
sudo mount -t devtmpfs none /dev
sudo modprobe nbd
ls /dev/nbd*
The final command should look like this:
root@node51 [~]# ls /dev/nbd*
/dev/nbd0 /dev/nbd1 /dev/nbd10 /dev/nbd11 /dev/nbd12 /dev/nbd13 /dev/nbd14 /dev/nbd15 /dev/nbd2 /dev/nbd3 /dev/nbd4 /dev/nbd5 /dev/nbd6 /dev/nbd7 /dev/nbd8 /dev/nbd9
Explanation
We determined in chat that /dev
was not being updated because it was mounted as tmpfs
instead of as devtmpfs
.
You can check the second column of the following command to see if /dev
is mounted as tmpfs
or devtmpfs
:
df -T /dev
Without devtmpfs
, only the device and character files defined during the initial boot would be populated in /dev
. devtmpfs
allows devices to be added and removed after boot.
It's not possible to unmount /dev
with umount /dev
because the special files in there are in use, but it is possible to load a fresh devtmpfs
over the existing /dev
mount.
sudo mount -t devtmpfs none /dev
mounts a devtmpfs
over the existing mount at /dev
.
Now, when you do sudo modprobe nbd
, the device files /dev/nbd0
through /dev/nbd15
get populated in /dev
.
Cause
I did not determine why /dev
was mounted as tmpfs
instead of devtmpfs
or why udev wasn't running. devtmpfs
should have been the default.
This answer on Server Fault might have some leads.
-
Hmm. I tried doing this, and then doing `sudo rmmod nbd`. It actually removed the nbd from somewhere (I don't know where). Given that i'm running the whole system on google cloud platform, any tips on where the nbd might be? – SalmonKiller Jul 02 '16 at 22:24
-
@SalmonKiller: Do you have the stock kernel that ships with Debian 8? Does `nbd: registered device at major` show up in `/var/log/syslog`? – Deltik Jul 02 '16 at 22:53
-
-
-
-
@SalmonKiller: Assuming you're logging normally, the nbd kernel module is not reaching [this line in the source code](https://github.com/torvalds/linux/blob/04cfac4e40b2b5dbaf8c0fc625878388a98bb9c6/drivers/block/nbd.c#L862). You should get network block devices because every failure case above that line would return an error code. Do you have folders at `/sys/block/nbd*`? – Deltik Jul 03 '16 at 03:14
-
-
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/41966/discussion-between-deltik-and-salmonkiller). – Deltik Jul 03 '16 at 05:23
-
i had the same problem in Ubuntu 20.04, but for me it was sufficient to just run `sudo rmmod nbd; sudo modprobe nbd;` thanks – hanshenrik Jan 13 '21 at 23:10