/var/run and /var/lock on tmpfs
Summary
/var/run and /var/lock should be mounted as tmpfs
Owner
- Name: Lennart Poettering
- Email: lennart at poettering dot net
- IRC: mezcalero
Current status
- Targeted release: Fedora 15
- Last updated: 2010-09-15
- Percentage of completion: 20%
Detailed Description
/var/run and /var/lock contain small runtime files which need not to be kept around over a reboot, and hence are pointless to write to disk as it currently is done. Currently there's bootup code that explicitly empties these directories on boot. If we move these two directories to tmpfs this wouldn't be necessary anymore, simplifiying boot-up, making things less fragile. One could also argue that it might make things faster since it gets rid of unnecessary write accesses to disk.
Benefit to Fedora
Simpler, more robust boot-up scheme. Possibly a little bit faster boot up. Since Ubuntu/Suse already do this this would bring Fedora more inline with the other distributions and minimize differences between the distros.
Scope
systemd already contains the necessary support which is however not enabled in rawhide yet. This needs to be enabled.
Various .spec files need to add %ghost to the files/dirs in /var/run and /var/lock they currently own. [ ADD LIST HERE ]
Some software might need patching, so that it is able to recreate its dirs/files in /var/run and /var/lock when they get lost on reboot. Since SUSE and Ubuntu already ship things with tmpfs on /var/run and /var/lock almost nothing should still require patching for this.
The SELinux policy might need updates so that these dirs/files may be created on daemon startup.
The "find" command in /etc/rc.d/rc.sysinit that cleans up /var/run and /var/lock can go away.
How To Test
Check /proc/mounts to verify that /var/run and /var/lock are now tmpfs.
Make sure that software that creates files/dirs beneath those two dirs still works fine. Mostly this means:
a) the rpms can be installed properly b) the rpms can be deinstalled properly, leaving no files in /var/run and /var/lock behind c) the software starts up properly.
User Experience
A tiny bit of less disk accesses.
Dependencies
systemd
Contingency Plan
None necessary, revert to previous release behaviour.
Documentation
I don't think this needs much additional documentation, beyond what systemd already contains about this.
Release Notes
/var/run and /var/lock are now mounted from tmpfs, and hence emptied on reboot. Applications must ensure to recreate their own files/dirs on startup, and cannot rely that doing this at package installtion will suffice