Re: Idea: mount /tmp to tmpfs depending on free space and RAM
- To: email@example.com
- Subject: Re: Idea: mount /tmp to tmpfs depending on free space and RAM
- From: Bruce Sass <firstname.lastname@example.org>
- Date: Fri, 1 Jun 2012 19:34:17 -0600
- Message-id: <email@example.com>
- In-reply-to: <CAOVenEpy-zwzyKB7MYsGb=xCB6sBPAKD6uyDDVRF9GnrZ1=oAw@mail.gmail.com>
- References: <CAOVenEp6C0QF+K3OLw_jLYkza9qSGd8du4LBrAayp1SM9WaG7w@mail.gmail.com> <firstname.lastname@example.org> <CAOVenEpy-zwzyKB7MYsGb=xCB6sBPAKD6uyDDVRF9GnrZ1=oAw@mail.gmail.com>
On June 1, 2012 10:00:52 AM Serge wrote:
> I considered that. I was just trying to keep description shorter and
> easier to understand. A more complete description would look like:
> 0. fstab is already processed and /tmp was (or was not) mounted to a
> separate partition.
> 1. init-script cleans it (since it must clean it anyway)
> 2. and checks `df /tmp/` for free space and partition
> 3.a. if RAMTMP == yes or RAMTMP == no then goto 4
> 3.b. if RAMTMP != auto then print a warning
> 3.c. if /tmp is not writable then RAMTMP=yes; goto 4
> 3.d. if /tmp is not on a root partition then RAMTMP=no; goto 4
> 3.e. if has_less_than_TMP_SIZE_free_space then RAMTMP=yes; goto 4
> 3.f. else RAMTMP == no
> 4. if RAMTMP == no and has_less_than_TMP_OVERFLOW_LIMIT_free_space
> then RAMTMP=yes
> 5. if RAMTMP == yes then mount /tmp to tmpfs
> Maintainer will probably write a better code.
Much better... if TMPTIME != 0 it will be necessary to mount the FS based
/tmp, clean it, create a tmpfs, move anything left in /tmp to the tmpfs, then
mount --bind the tmpfs on /tmp.
Keeping track of whether /tmp was FS or tmpfs based when the system last
shutdown could be used to skip all that since RAMTMP=yes implies TMPTIME=0
regardless of the setting in /etc/default/rcS.