You are not logged in.

#1 2008-11-03 14:46:40

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

temporary filesystems?

I have a question for you all linux filesystems experts...

The setting: I have an eee laptop, and I want to have /var mounted in the memory, so that the ssd doesn't get written to too often. The best solution I've come up so far is to mount /var as tmpfs, and every now and then (for instance after booting and before shutdown, and before some other dangerous moments) rsync its contents to some other location, so that I don't loose the changes made to it.

I remember that on openbsd one could use mfs (their version of tmpfs) which has one advantage: during its mounting one can specify a directory whose contents will be present on the newly mounted filesystem. An example fstab line:
swap /var mfs rw,-P=/perm/var,-s=32768,noexec,nosuid 0 0
Thus, rsyncing the whole /perm/var to /var right after mounting /var as tmpfs is not necessary. [EDIT: of course, rsyncing before unmounting *is* still necessary.]

The question: is this possible with some analogue of tmpfs on linux? As far as I could find out, tmpfs does not support this feature.

Thanks.

Last edited by bender02 (2008-11-03 14:48:03)

Offline

#2 2008-11-03 16:17:05

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: temporary filesystems?

I don't know about that, never heard of it. 

But, what _is_ possible - and much simpler -:  Linux flushes dirty block to disk at specified intervals.  So you could make it a disk filesystem, just one that gets flushed infrequently.
Only caveat: I'm not sure if you can specify this on a per-device or per-filesystem basis.  Google will know. See http://tynne.de/r31 and maybe http://www.gelato.unsw.edu.au/lxr/sourc … p-mode.txt


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#3 2008-11-04 08:10:10

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: temporary filesystems?

Thanks for the links. I think the flushing is a global thing. I think I'll still go with my rsyncing - that's something I have a direct control over smile

Offline

#4 2008-11-04 15:24:10

Arkane
Member
From: Switzerland
Registered: 2008-02-18
Posts: 263

Re: temporary filesystems?

Yeah, I think there are only global settings for dirty page flush. I tried tweaking them on my Eee but quickly ended with a very unresponsive system.

For now, I simply mount some directories like /tmp, /var/log or /var/cache/pacman/pkg to ram because I don't really care about keeping their contents.


What does not kill you will hurt a lot.

Offline

#5 2008-11-04 17:22:41

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: temporary filesystems?

Arkane wrote:

For now, I simply mount some directories like /tmp, /var/log or /var/cache/pacman/pkg to ram because I don't really care about keeping their contents.

Yes, that works pretty well as well. I just wanted to keep the logs (especially pacman.log), and then I thought that why not mount the whole /var as tmpfs. My original intention was to actually run with / as mostly read-only, but I need to check whether some not-so-well-designed programs don't try to write somewhere else than /tmp, /var and /home (e.g. /etc) during the usual run.

By the way, now I have it set up as I described in the first post, and the initial rsyncing to the empty /var is pretty quick (less than a second). Satisfactory for me.

Offline

Board footer

Powered by FluxBB