On an Ubuntu 14.04 system I had to enlarge the /tmp folder, and instead of resizing partitions I unmounted the partition mounted to /tmp and created a new file mounted to /tmp, following the instructions here.

I changed the permissions to this new /tmp folder to 1777, but I get some permissions issue - when I compile some c++/cuda code from Python (using Codepy, creating a shared object), I get the following error when (within the compilation code) the shared object is loaded (compilation is done into subfolder of /tmp):

failed to map segment from shared object: Operation not permitted

I have a similar machine (it was a clone) where this does not happen, so I guess it has something to do with the /tmp folder.

Any idea?

  • 1
    Maybe it has something to do with the noexec if you copied that from the guide, that is an unusual setting for /tmp. – DepressedDaniel Feb 10 '17 at 1:19

That guide is not the best to follow.

Instead, mount your /tmp as tmpfs and reap the benefits of much faster compiling, and faster /tmp usage for other things.

tmpfs is an in-memory filesystem which is very well suited for /tmp usage.

It also reduces hard drive writes which can be a bit useful for the paranoid folks who don't want to write to their SSDs often.

To accomplsih this, unmount /tmp and undo everything you did that guide.

mount -t tmpfs temp /tmp -o size=4G,nosuid,nodev

Note that size=4G can and should be changed depending on how much memory your system has. I use 1/4th of my total system memory. You can check with the command free for memory total and usages.

Note that the 3rd argument, temp in the command above can actually be anything you want. Make it something more descriptive if you want, but it must be a single argument so if you use spaces, encase it in quotes.

| improve this answer | |
  • Thanks - does that mean the available RAM will be smaller? This is a workstation with 4 GPU's and quite a heavy workload so every GB counts (64GB at the moment) – Itamar Katz Feb 10 '17 at 6:58
  • It means that the size of the contents of /tmp will be subtracted from current free memory. If memory is required for other uses, the contents of /tmp will instead utilize the virtual memory (swap). From my experience, when workloads are heavily I/O bound, this significantly increases throughput. Beware that an unexpected shutdown will cause a complete loss of /tmp contents. If you're using a UPS, it isn't a problem. – Hydranix Feb 10 '17 at 7:21
  • 1
    I'll add that the kernel will dynamically free the memory used by a tmpfs mountpoint. So the size= option only defines a maximum limit, not an allocation. – Hydranix Feb 10 '17 at 7:23
  • One last thing - can/should I add this mount to /etc/fstab? – Itamar Katz Feb 10 '17 at 7:46
  • Yes, that's the typical thing to do. (15 character comment limit) – Hydranix Feb 10 '17 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.