3.9 Devices and Device Nodes

A device is a term used mostly for hardware-related activities in a system, including disks, printers, graphics cards, and keyboards. When FreeBSD boots, the majority of what FreeBSD displays are devices being detected. You can look through the boot messages again by viewing /var/run/dmesg.boot.

For example, acd0 is the first IDE CDROM drive, while kbd0 represents the keyboard.

Most of these devices in a Unix operating system must be accessed through a special file called device nodes, which are located in the /dev directory.

3.9.1 Creating Device Nodes

When adding a new device to your system, or compiling in support for additional devices, a device driver often-times needs to be created.

3.9.1.1 MAKEDEV Script

On systems without DEVFS, device nodes are created using the MAKEDEV(8) script as shown below:

    # cd /dev
    # sh MAKEDEV ad1
       

This example would make the proper device nodes for the second IDE drive when installed.

3.9.1.2 devfs (Device File System)

The device file system, or devfs, provides access to kernel's device namespace in the global filesystem namespace. Instead of having to create and modify device nodes, devfs maintains this particular filesystem for you.

See the devfs(5) man page for more information.

devfs is used by default in FreeBSD 5.0.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.