Talk:Setting up a RAM drive on Raspberry Pi
I found a page on extending the "life" of the SDcard, here: http://www.makeuseof.com/tag/extend-life-raspberry-pis-sd-card/
The minimal suggestion is much alike the one made here, to move the tmp to RAM, but the size of RAM is much bigger. Instead of 1MB it suggests moving it to 100MB.
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
But also to move the log file to RAM... and even more...
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0 tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0 tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0 tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0 tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0700,gid=12,size=30m 0 0
Thats your opinion? Do you think its smart of to allocate over 262MB of memory of a small Rapsberry PI for this?
Or should we move into use of a USB memory stick instead. More complex, bus more robust.
/var/tmp : "Temporary files preserved between system reboots"
The Filesystem Hierarchy Standard (FHS) states the following:
/var/tmp : "Temporary files preserved between system reboots" (see: WikiPedia or FHS 2.3 /var/tmp) /tmp : "Programs must not assume that any files or directories in /tmp are preserved between invocations of the program" and "... it is recommended that files and directories located in /tmp be deleted whenever the system is booted" (see: FHS 2.3 /tmp)
So should this page not advise to enable tmpfs for /tmp instead of /var/tmp?
Prefered way to mount /tmp as a tmpfs (RAMdrive)
There are preferred mechanisms in Debian / Raspbian to mount /tmp as a tmpfs (RAMdrive):
- On Wheezy add add/change a line with
RAMTMP=yes
to/etc/default/tmpfs
(or/etc/default/rcS
if the former has no effect). (see RaspbianFAQ or the tmpfs man page) - On Jessie enable the systemd unit
tmp.mount
withsudo systemctl enable tmp.mount
. (see Google, i could not find a good reference to systemd tmp.mount)
Best wishes, Mick