Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On linux, temporary files are stored on a ramdisk:

tmpfs                  15G  4.0K   15G   1% /dev/shm

However, if there are several large files in /tmp/ I would assume that the files overflow onto disk? In such a case, if the machine has slower and faster disks, it would be preferable the faster disks to be used.

How does this work exactly and how can we configure on Linux where the overflow goes to?

share|improve this question
add comment

1 Answer 1

tmpfs is the name of the RAM based filesystem, but it doesn't have to be mounted on /tmp or even used for traditional "temporary files". The example you've pasted is mounted on /dev/shm, which has nothing to do with /tmp, and so /tmp is probably just real disk.

Linux has no built in mechanism for /tmp "oveflow", so you'd have to set something up manually to achieve this. There is some distinction between /tmp and /var/tmp (IIRC /var/tmp tends to be used for bigger files), so mounting a tmpfs on /tmp and leaving /var/tmp on real disk may be good enough.

If you actually want it to overflow you'll have to setup a union filesystem like unionfs or aufs. These filesystems take multiple underlying directories and expose them as a single mountpoint. You can configure the priority of the underlying directories so that the tmpfs is used first, then the fastest disk, etc.

share|improve this answer
    
Any copy-paste examples how to achieve these? i) mount tmpfs on /tmp ii) setup a union filesystem like unionfs or aufs so that the tmpfs is used first, then the fastest disk, etc. –  Martin Aug 14 '12 at 8:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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