Skip to content

Instantly share code, notes, and snippets.

@vtypal
Created February 11, 2010 08:46
Show Gist options
  • Save vtypal/301341 to your computer and use it in GitHub Desktop.
Save vtypal/301341 to your computer and use it in GitHub Desktop.

Creating Device Special Files with mknod

/usr/sbin/mknod <file_name> b|c <major#> <minor#>
  • Name the file something easily associated with the device
  • Use b for block device special file or c for character device special file. If the device is a block type device such as a tape or disk drive which needs both cooked and raw special files, the type is b. All other devices are character type devices, such as terminal and pseudo devices, and are type c.
  • Set the major and minor number for the device as reported from `lsdev`. The major device number is an integer number which tells the kernel which device driver entry point to use. The minor device number tells the kernel which subunit the node corresponds to on the device.

For example let’s create a node /dev/xvd as a block device:

mknod /dev/xvda  b  220  0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment