acdsn:tmpfs
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
acdsn:tmpfs [2012/08/21 19:37] – created sbolay | acdsn:tmpfs [2013/07/24 12:51] (current) – [/etc/init.d/tmpfs] jzaehrin | ||
---|---|---|---|
Line 3: | Line 3: | ||
inspired from http:// | inspired from http:// | ||
- | / | + | ===== / |
<code bash> | <code bash> | ||
# Where to mount the DIRS | # Where to mount the DIRS | ||
Line 31: | Line 31: | ||
# Leave empty to unset | # Leave empty to unset | ||
# | # | ||
+ | </ | ||
+ | |||
+ | ===== / | ||
+ | <code bash> | ||
+ | #! /bin/sh | ||
+ | ### BEGIN INIT INFO | ||
+ | # Provides: | ||
+ | # Required-Start: | ||
+ | # Required-Stop: | ||
+ | # Default-Start: | ||
+ | # Default-Stop: | ||
+ | # Short-Description: | ||
+ | # Description: | ||
+ | # primary goal is to allow laptop users to let the hard-disk | ||
+ | # drive spin up most of the time, it can also be used by people | ||
+ | # having their system on a USB disk or a CF card. | ||
+ | # Author: Mathias Laurin | ||
+ | # License: GNU General Public License version 2 or higher | ||
+ | # Version: 1.0.4 | ||
+ | # update-rc.d tmpfs defaults 10 | ||
+ | # update-rc.d tmpfs enable 2 | ||
+ | ### END INIT INFO | ||
+ | |||
+ | PATH=/ | ||
+ | NAME=" | ||
+ | |||
+ | . / | ||
+ | . / | ||
+ | |||
+ | # Source tmpfs before $NAME so that SHM_SIZE gets overwritten | ||
+ | [ -e / | ||
+ | [ -e / | ||
+ | |||
+ | # no directory to mount, exit graciously | ||
+ | [ -z " | ||
+ | [ -n " | ||
+ | [ -z " | ||
+ | |||
+ | # no /dev/shm, error and exit | ||
+ | [ ! -d "/ | ||
+ | |||
+ | do_start() { | ||
+ | # Prepare mount point | ||
+ | [ ! -d " | ||
+ | |||
+ | # Mount options | ||
+ | | ||
+ | [ -n " | ||
+ | |||
+ | [ -n " | ||
+ | |||
+ | mount -t tmpfs -o " | ||
+ | |||
+ | for MY_DIR in $DIRS; do | ||
+ | MY_TMPFS=" | ||
+ | [ ! -d " | ||
+ | |||
+ | mount --bind $OPTS_TMPFS_QUIET " | ||
+ | |||
+ | # special cases handled here, using " | ||
+ | case $MY_DIR in | ||
+ | / | ||
+ | mount -o, | ||
+ | chmod 1777 $MY_DIR | ||
+ | ;; | ||
+ | / | ||
+ | touch / | ||
+ | touch / | ||
+ | chgrp utmp / | ||
+ | chmod 0644 / | ||
+ | chmod 0644 / | ||
+ | chmod 0600 / | ||
+ | mkdir / | ||
+ | chown news:news / | ||
+ | chmod g+s / | ||
+ | [ -f / | ||
+ | mkdir / | ||
+ | chown mpd:audio / | ||
+ | [-f / | ||
+ | mkdir / | ||
+ | chown Debian-ipw3945d: | ||
+ | ;; | ||
+ | / | ||
+ | mount -o, | ||
+ | chmod 1777 /var/run | ||
+ | [ ! -d / | ||
+ | touch / | ||
+ | chgrp utmp / | ||
+ | chmod 0644 / | ||
+ | ;; | ||
+ | esac | ||
+ | done | ||
+ | } | ||
+ | |||
+ | case " | ||
+ | start|"" | ||
+ | | ||
+ | ;; | ||
+ | restart|reload|force-reload) | ||
+ | echo " | ||
+ | exit 3 | ||
+ | ;; | ||
+ | stop) | ||
+ | # No-op | ||
+ | ;; | ||
+ | *) | ||
+ | echo " | ||
+ | exit 3 | ||
+ | ;; | ||
+ | esac | ||
+ | |||
+ | : | ||
+ | </ | ||
+ | |||
+ | and update all with: | ||
+ | |||
+ | # chmod a+x / | ||
+ | # update-rc.d tmpfs defaults | ||
+ | |||
+ | |||
+ | |||
+ | ===== mount ===== | ||
+ | The original fs is like: | ||
+ | <code bash> | ||
+ | / | ||
+ | tmpfs on / | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | udev on /dev type tmpfs (rw, | ||
+ | tmpfs on /dev/shm type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | and finally you obtain | ||
+ | |||
+ | <code bash> | ||
+ | / | ||
+ | tmpfs on / | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | udev on /dev type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | / | ||
+ | / | ||
+ | tmpfs on /dev/shm type tmpfs (rw, | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
</ | </ |
acdsn/tmpfs.1345577829.txt.gz · Last modified: 2012/08/21 19:37 by sbolay