Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have loads of RAM and I use very little. I also do record some screencasts with gtk-recordmydesktop, which by default saves to /tmp while recording. I assumed that it would mean storing to RAM as much as possible, but then I actually checked and found that /tmp isn't mounted with tmpfs. Why is that?

share|improve this question
add comment

3 Answers

up vote 10 down vote accepted

I think you answered your own question. A lot of programs use /tmp for storing temporary files, and they can be huge.

For example Brasero defaults to that directory to store a CD/DVD's image file, which can be 4.7 GB of size. It's not worth risking a serious slowdown (or a system lockup) in an out of memory situation if your RAM and swap get full.

For advanced users it's no problem to change some applications' defaults and mount /tmp as tmpfs. For general use it's just not worth the risk I guess.

share|improve this answer
1  
And, I think you might get a little angry and curse the developers if you recorded a few great screencasts and then, after a power outage or system hitch, lost them all. ;) –  arrange Sep 25 '11 at 20:12
    
And the stuff in /tmp might even reside in the RAM and never touch the disk if you use ext4. –  Fraekkert Sep 25 '11 at 21:00
    
@Fraekkert: What do you mean? Why ext4? Why never? Can you elaborate please? –  arrange Sep 25 '11 at 21:20
1  
It's not unique to ext4, but it's because of Delayed allocation. Essentially it means that files are not necessarily written to disk just because a program tells the os to do so. Instead it is kept in the ram for quick access. If the file is deleted relatively quickly thereafter, it would never reach the disk. Have a look at wikipedia if you need more info. –  Fraekkert Sep 26 '11 at 7:10
    
@Fraekkert: I think the commit time is 5 secs for ext4, and the allocation is delayed until next commit, so it doesn't help much in this case, does it? –  arrange Sep 26 '11 at 11:52
show 2 more comments

What about zram compression ?

The available space is more than 256 Mbytes, it depends on files' type.

modprobe zram num_devices=1 
# max ram usage = 256 Mbytes
echo 262144 > /sys/block/zram0/disksize
mke2fs -q -m 0 -b 4096 -O sparse_super -L zram /dev/zram0
mount -o relatime,noexec,nosuid /dev/zram0 /tmp
share|improve this answer
    
That's actually a pretty interesting idea...will try this out :) –  Piskvor Jun 6 '12 at 8:21
add comment

There was an idea to use tmpfs while it has enough space, and write to disk when you run out of space: http://www.bigdbahead.com/?p=137 However, it never really took off. I've managed to get it working, but the FUSE overhead defeats any benefit of using tmpfs: http://shnatsel.blogspot.com/2011/11/miniwheatfs-aka-reliable-ramdisks.html

share|improve this answer
    
What about zram compression ? example modprobe zram num_devices=1 # max ram usage = 256 Mbytes echo 262144 > /sys/block/zram0/disksize mke2fs -q -m 0 -b 4096 -O sparse_super -L zram /dev/zram0 mount -o relatime,noexec,nosuid /dev/zram0 /tmp –  Massimo May 13 '12 at 10:55
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.