I'm trying to mount /tmp to RAM on Ubuntu server (14.04):

echo "tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0" | tee -a /etc/fstab

This line seems to be fine, it's added to /etc/fstab, and after the system reboot /tmp is mounted as expected.

But when I try to apply this changes on the fly (without system reboot):

mount -o remount /tmp

I get this error: not mounted or bad option

What is wrong?

1 Answer 1


From the mount manpage:

remount Attempt to remount an already-mounted filesystem. This is commonly used to change the mount flags for a filesystem, especially to make a readonly filesystem writeable. It does not change device or mount point.

Since /tmp is not already mounted when you try mount -o remount /tmp, it fails. To make it work while it is not already mounted, you need to do mount /tmp instead.

  • (although this is not necessarily a good idea, e.g. if you use any software that uses sockets in /tmp/.??* like /tmp/.X11-unix, the original sockets will now be unreachable)
    – sourcejedi
    Oct 30, 2016 at 10:40
  • That's right. In that case safer to take the nodev option off
    – GMaster
    Oct 30, 2016 at 11:27
  • what does nodev option do? from manpage it's unclear. honestly, nosuid and nodev options just copied from somewhere.. both are unclear
    – d-d
    Oct 30, 2016 at 11:54
  • 1
    nodev only affects device nodes, not sockets. I mean if you do this on a running system, some of the files you're hiding in the overmounted /tmp might have been important
    – sourcejedi
    Oct 30, 2016 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .