What are exactly mknod
command parameters?
I want to create a jail in chroot. So I need to do:
mknod /var/chroot/bind/dev/null c 1 3
mknod /var/chroot/bind/dev/random c 1 8
What are c
, 1
, 3
and 8
?
devicesfiles
What are exactly mknod
command parameters?
I want to create a jail in chroot. So I need to do:
mknod /var/chroot/bind/dev/null c 1 3
mknod /var/chroot/bind/dev/random c 1 8
What are c
, 1
, 3
and 8
?
Best Answer
mknod
is creating a device file, usually to be located in the /dev branch, but not necessarily like your example shows.The first parameter is telling which kind of device to create, here
c
for character device. Other choices might beb
for block devices,p
for fifo (pipe).The second parameter is the major number, it identifies the driver for the kernel to use.
The third parameter is the minor number, it is passed to the driver for its internal usage.
On Linux, major/minor numbers are documented here: devices.txt
So 1 is used for the so called memory devices handled by a single driver.
3
is representing thenull
device which returns EOF when read and discard whatever is writen to it.8
is representing therandom
device which returns random numbers.To get more information, you might to have a look to the device manual pages, e.g.