4 ms·
Why on earth would anybody ever use tmpfs for /tmp? If I'm writing a program that deals with a big file, and I want to temporarily write something to the files
by notatoad 14y ago
Why on earth would anybody ever use tmpfs for /tmp? If I'm writing a program that deals with a big file, and I want to temporarily write something to the filesystem, it is because I dont want it in memory. Why would you ever write to /tmp for any reason other than to get something out of ram for a while?
- donavanm 14y agoBecause a third party binary expects posix FS semantics for some data that does not require strong durability?
- chimeracoder 14y agoI use /tmp all the time. I find myself needing to interact with things for which the filesystem/shell interface is appropriate, but for which I don't want to worry about having to clean out the directory before it gets too large. Having it sit in RAM is great, because I get the speed without subjecting my disk to unnecessary writes - for certain operations, this can be a huge bonus.
- lostnet 14y agoBecause tmpfs is RAM cached disk (swap) space just like any other filesystem? Is there some better place than swap to accommodate /tmp?
- B-Con 14y agoThis is very popular amongst people just working on desktop setups. They usually don't need /tmp to house anything too large. Arch Linux actually switched recently to mounting /tmp as tmpfs recently.
- rogerbinns 14y agoI have been using tmpfs for /tmp for many years (since 2005 IIRC). Note that I do have large amounts of swap space (typically 64GB). One simple benefit is that files there do not get caught in backups - they are temporary detritus so I don't want backup space wasted by them. The major benefit is that fsync is really slow on Linux. Typically it turns into a sync, and a lot of programs like to ensure you don't lose data by being fsync happy. For temporary stuff that is even more painful - you don't care about data loss - that is why it is in tmp in the first place. TLDR: I prefer filesystem operations on transient/temporary files and data to run at the speed of RAM, and not end up in backups or waiting for syncs.
- digikata 14y agotmpfs is useful for embedded systems where the primary filesystem is mounted read-only. Generally /tmp and /var may be tmpfs backed in that situation. Not sure why a desktop system would want this though.