6

When using a separate disk partition for /tmp, ie /dev/sda4, what filesystem is most suitable ?

ext4 seems inappropriate: I don't need journal, I don't need that lost+found directory there either.

Preferably I would reformat the partition anew at ever boot, so filesystem/check recovery does not make sense.

In a situation where I don't want to use tmpfs for /tmp, what filesystem would be best for /tmp ?

3
  • Why don't you want tmpfs there? – styrofoam fly Jul 10 '17 at 21:28
  • @styrofoam fly - memory limitations – Martin Vegter Jul 10 '17 at 22:02
  • @MartinVegter What memory limitations? You specify the size when you create the filesystem (and the swap area, to make sure it'll fit). Same as any other filesystem. – Gilles 'SO- stop being evil' Jul 11 '17 at 23:55
2

I would personally go for tmpfs, as it stores files in memory, overall much faster.

I found this: https://askubuntu.com/questions/1637/good-filesystem-for-tmp

tmpfs: is a filesystem which stores its files in RAM. This doesn't mean that the filesystem will eat all your RAM. Instead it takes only that amount it really needs. Usually only some MB are needed. If you'll use it, add a line like: none /tmp tmpfs size=64M,mode=1777 0 0 to your /etc/fstab. You can change the size to a value you like. If you think at some point that it is too less, you can use mount to increase the size: mount -t tmpfs tmpfs /tmp -o size=128M,mode=1777,remount. The size will be increased in place without deleting existing files.

ext2/3: You said in your question that you don't need any fancy features. However I would advice for using a journal. Because if you use ext2 and you have a quite large /tmp it would take some time for checking it. ext3 boots any many cases faster. Therefore I would suggest the use of journalling.

ext4, reiserfs etc.: Some software uses /tmp for storing large amounts of small files. So in some cases there are no more free blocks and the filesystem is full. ext4 and also reiserfs store files in a different way. So it could be a good choice to use those for your /tmp.

If your computer runs for a long time, it is a good idea to delete unused files in /tmp. tmpreaper is one solution which does that for you.

However my first choice would be using tmpfs.

EDIT: Since you do not want a Lost+Found directory nor tmpfs, btrfs and reiserfs/reiser4 do not have a Lost+Found, afaik, maybe you would want to use one of those? I would recommend btrfs over reiserfs/reiser4.

Comparison of file systems: http://www.phoronix.com/scan.php?page=article&item=linux-40-hdd&num=1

4
  • 1
    I thought, I made it clear in my question that I don't want to use tmpfs. – Martin Vegter Jul 10 '17 at 20:53
  • +bbaassssiiee I know, but here, not many options ;-) I could have added XFS as well ... but, iirc, XFS is tuned for larger files, not ideal for /tmp ... I have tmpfs in RAM and no swap ... I have enough RAM and a script in place that monitors RAM usage. – thecarpy Jul 10 '17 at 22:08
  • 1
    @MartinVegter In your question, you said you didn't want tmpfs, but you didn't give any argument for that and you described a scenario in which tmpfs is the right answer. So your question is contradictory, one of the assumptions has to go, and the obvious way to resolve the inconsistency is to ignore the requirement against tmpfs which doesn't fit the rest. Thus tmpfs is the right answer here. – Gilles 'SO- stop being evil' Jul 11 '17 at 23:57
  • @Gilles, exactly my thoughts ... like I want omelette sans casser des oeufs ... ;-) – thecarpy Jul 11 '17 at 23:58
2

If you need data persistent even after reboot, tmpfs is excluded.

There are several filesystems such as ext4, f2fs, btrfs.

To recommend a suitable file system, I need to know the exact purpose of /tmp.

If you don't need consistency supported by a filesystem, you can use ext4 with journal option off, F2FS (when a program that use /tmp generate frequent fsync), btrfs (if you need snapshot fucntions)

Don't use ext2 only because you don't need journaling, because ext4 provides various functions such as multiblock allocator, preallocation, extents etc to enhance performance.

0

I'd prefer to use something that persists over a reboot, so not tmpfs (especially since you said you didn't want to use it). For the same reason, I wouldn't reformat on each reboot. Here are two reasons to start with:

  • Some of the stuff in /tmp may actually be wanted immediately after an unscheduled reboot. This might include files from which you can recover lost work.
  • Some browsers cache downloaded files there (e.g. PDFs you read online). Having them there saves time if you return to them.

I appreciate that cruft builds up there. I don't find that a problem; on FreeBSD (which I use) there is a standard cron job that clears out files after a few days, and you can tune that. I'm sure there is a Linux equivalent.

I'd probably go for ext4 - why not? (on FreeBSD, I use the standard ufs).

0

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.