Re: Lets (eventually) find a good solution for /tmp
2012/6/12 Barak A. Pearlmutter wrote:
> The real issue here is that having /tmp be just another directory in a
> writable partition filesystem, like / or /home or whatever, means that
> /tmp gets all the associated properties. One such property (A) is
> that files can be large and can bleed off to disk smoothly without
> thrashing the system, both of which are problems with tmpfs. On the
> other hand, another property (B) is that a great deal of effort is
> going into ensuring that files get written to disk in a timely
> fashion, that data and metadata survives crashes, and that structures
> on disk are consistent, up-to-date, and if necessary, quick to check.
> We want /tmp to have (A), but it need not have (B).
Ext3 has (A) and does not have (B). :) You don't think that writing some
bytes of ext3 journal is "a great deal of effort" for /tmp, do you? ;)
> So this is a technical question. Can we implement a filesystem which
> provides properties A, but which (C) has zero data surviving after a
> crash or umount, and takes advantage of property C to make things
Whatever filesystem you invent, you'll need to recreate it as empty on
every boot. This is not going to be much faster than replaying ext3
journal. And since you're replaying journal for your root partition
anyway, keeping /tmp on your root partition is the fastest thing you
can get, I guess. :)
> But even though it may be an easy problem, to my knowledge, no one has
> implemented a solution.
Probably that's because nobody really needed such a filesystem yet. :)
> One thought would be to make a fuse filesystem [...]
> Another thought would be to hack tmpfs [...]
BTW, what do you need all this for? I mean, it's an interesting idea about
inventing a special limited version of tmpfs. I was thinking about that
myself (e.g. aufs-mount with writable branches on tmpfs and disk), it's
quite possible to implement. There're even fuse-filesystems partially
implementing this feature. But how are you going to use it? How can
you check that this new InventedFS is better than plain ext3? What do
you want to use it for?
I mean, there're plenty of different filesystems already, if you describe
some use-case, or some problem to solve, then maybe, I could find a
filesystem that will help you? For example if you need it to be fast, you
can forget about fuse, I can suggest you to look at aufs3 patches. Hacking
tmpfs won't be easy, unless you're good at understanding kernel/vfs code.