Find the answer to your Linux question:
Results 1 to 6 of 6
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    4

    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?

  2. #2
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    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.

  3. #3
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,184
    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.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  4. #4
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    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.

  5. #5
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,184
    Quote Originally Posted by greyhairweenie View Post
    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.
    .
    Shame on you! I just thought the OP seemed a bit uncertain about what device files actually are so I decided to explain it.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  6. #6
    Just Joined!
    Join Date
    Apr 2014
    Posts
    1
    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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •