/dev is the location of special or device files. It is a very interesting directory that highlights one important aspect of the Linux filesystem - everything is a file or a directory. Look through this directory and you should hopefully see sda1, sda2 etc.... which represent the various partitions on the first drive of the system. /dev/cdrom represents your CD-ROM drive. This may seem strange but it will make sense if you compare the characteristics of files to that of your hardware. Both can be read from and written to. Take /dev/dsp, for instance. This file represents your speaker device. Any data written to this file will be re-directed to your speaker. If you try 'cat /boot/vmlinuz > /dev/dsp' (on a properly configured system) you should hear some sound on the speaker. That's the sound of your kernel! A file sent to /dev/lp0 gets printed.
The majority of devices are either block or character devices; however other types of devices exist and can be created. In general, 'block devices' are devices that store or hold data, while 'character devices' can be thought of as devices that transmit or transfer data. For example, diskette drives, hard drives and CD-ROM drives are all block devices while serial ports, mice and parallel printer ports are all character devices. There is a naming scheme of sorts but in the vast majority of cases these are completely illogical.
There are four different schemes for persistent naming: by-label, by-uuid, by-id and by-path.
- by-id creates a unique name depending on the hardware serial number.
- by-label - almost every file system type can have a label. All your volumes that have one are listed in the /dev/disk/by-label directory.
- by-path creates a unique name depending on the shortest physical path to the device
- by-uuid is a mechanism to give each filesystem a unique identifier. These identifiers are generated by the mkfs utilities.
"1.5 /dev" by Various contributors, The Linux Documentation Project is in the Public Domain, CC0
"Persistent block device naming" by Various contributors, ArchLinux is in the Public Domain, CC0