fstab nodev option
Hey guys (& girls),
I'm having a really hard time trying to figure out what the "nodev" option in fstab actually does. I've read everywhere that this option doesn't interpret block special devices on the filesystem.
I have to admit that I have no idea what that means.
Could somebody please give me an example what could happen if I don't set this option?
You should use this on filesystems that are writeable by ordinary users so they can't create device files and gain access to devices in a way that the normal device files, typically in /dev, would not permit. They could use the self-created device files to "wiretap" other usage of the devices by other users or disrupt the use of the devices. For instance, they could destroy filesystems or set boobytraps in them.
Device files are pseudo-files that form an interface with the hardware drivers in the kernel. Block devices represent disks and partitions; character devices represent things like ports, terminals and sound cards. Whenever a program accesses one of these files, it wakes up the kernel, which carries out the actual data transfer requested. That means that programs don't need to know anything at all about hardware.
By convention, device files reside in the /dev directory. Modern kernels create a dynamic /dev directory at boot so that you only have device files for the hardware you're actually using. But in theory a device file could be located anywhere on the system. Hence the need for the safety precautions described by Greyhairweenie.
Great summary, Hazel. So good I thought it was cut-and-pasted, but I can't find it anywhere else so I apologize for the thought.
I'd never noticed that the doc for "nodev" says "block special devices" only. It seems to prevent interpretation as block or character. Try creating another serial port file in a nodev filesystem with "mknod ttySZ c 4 64" or whatever the major/minor for /dev/ttyS0 are on your system, and see what you get.
Shame on you! I just thought the OP seemed a bit uncertain about what device files actually are so I decided to explain it.
Originally Posted by greyhairweenie
Hate to ressurect an old thread but can anyone suggest an alternative to controlling certain file systems with "nodev"
I dont have the option to repartition my drive in my VPS service(don't ask) so i need some alternative way to stop device files existing in certain directories and their subfolders. Any ideas ?