From LQWiki
mknod is the command used to create device files, which can act strangely compared to normal files. Device files are kept in /dev, and unlike normal files, these are files the kernel knows about, and reads/writes to.
examples are:
- /dev/hda1 - the first partition on a storage device (usually a hard drive) in the master position, on the first IDE slot. Reading from here is reading directly from the drive, writing here writes directly to it.
- /dev/null - this is a very popular device, its really write only, anything sent here is immediately forgotten
- /dev/zero - this ones read only, and it just outputs a bunch of zeros if you try to read it
Examples
mknod /dev/random c 1 8
here is what the all that means
mknod device-name device-type major-number minor-number
- device-name - full name of device, in this example /dev/random
- device-type - device files can represent 2 types of device, a storage device (block) or a device use for other purpose (character) .. block devices are things like cd-roms, hard drives, etc . Character devices are things like /dev/zeo, /dev/null, or any other device not used to store info ... as you probably have guessed, for mknod "b" means block, and "c" means character
- major-number - a number usually referring to what ground the device is in
- minor-number - the number of the device within the group
major and minor numbers may seem random, but in reality, they aren't .... they are chosen by the writers of the Linux kernel. For a list of these devices, major and minor numbers, and type, look in the kernel documentation, adduming /usr/src/linux refers to the linux source codes: see the file /usr/src/linux/Documentation/devices.txt ..
here is a example of what it might look like (note: this is not a really snippet from the file, but the file has its info arranged in the same way as this)
45 block some hard disks
0 /dev/nicedisk nice hard disk
1 /dev/noisydisk noisy hard disk
in the example, 45 is the major number, block is the type, and 0 is the minor number, and /dev/nicedisk is the name .. so
mknod /dev/nicedisk b 45 0

This page is available under a