What exactly does the files in /dev do? I'm having a difficult time understanding the relation between the files here, device drivers and the device.
Taking an example, what does /dev/hda do? does the hard disk driver read/write into it?
So when you act on the device file the driver has code that identifies what is happening and acts on the hardware to do what you asked.
You have character and block device files. Character devices write/read char by char (keyboards, mouses, modems, etc...) and block devices write/read in chunks of data. You also have some pseudo devices like
No, it is created by the hard disk driver so that higher-level drivers (device mapper, filesystem, etc.) can read/write/seek/tell/open/close/ioctl it.
(Actually, they operate on the device numbers directly, but it's a close-enough abstraction.)