(C) Martin Väth (martin at mvath.de). The license of this package is the GNU Public License GPL-2.
This project is no longer maintained. Use instead the successor project(s)
squashmount is more generic, support also overlay(fs) from linux-3.18 and newer and squashfuse and works without problems with any init system. Moreover, squashmount has a highly improved control interface.
The above openrc-wrapper script might receive further development, while the corresponding script from squash_dir is frozen and no longer maintained.
This is essentially an initscript for openrc and/or systemd which allows to keep a directory compressed by squashfs but simultaneously allows to write on it using some of (depending on the configuration and what is available):
- overlayfs, seehttp://git.kernel.org/?p=linux/kernel/git/mszeredi/vfs.git
- aufs, see http://aufs.sourceforge.net
- unionfs-fuse, see http://podgorny.cz/moin/UnionFsFuse (unionfs-fuse-0.25 or newer is required)
- unionfs, see http://www.fsl.cs.sunysb.edu/project-unionfs.html
- funionfs, see http://bugs.gentoo.org/show_bug.cgi?id=151673
The idea is that on shutdown the data is recompressed (and the temporary modified data removed). This approach is originally due to synss' script from http://forums.gentoo.org/viewtopic-t-465367-highlight-.html
In that forum thread you can also ask for help about this project.
If the Gentoo portage tree /usr/portage is compressed this way
(without $DISTDIR which you should store somewhere else when using
this script),
the required disk space is only about 50 MB (instead of about 180 MB,
the actual space requirement depending essentially on the filesystem),
and usually the access is even faster.
In addition, this project contains an openrc-wrapper script which can be used
to use simple initscripts of openrc even if openrc is not running:
In particular, these scripts can then be used with systemd (and also this
script is sometimes handy from the command line for administrative purposes).
If the initscripts are simple enough, openrc need not even be installed for
the `openrc-wrapper``to work: For this reason, this project will also work
with only systemd, although natively it is meant for openrc.
The script requires of course that squashfs support is activated in the
kernel (and supports the COMPRESSION method), that the mksquashfs tool
is available, and also that some of the above mentioned unionfs-type tools
is available and supported by the kernel.
Moreover, a POSIX shell and find are needed with the following extensions
(which are not yet POSIX):
- The
findcommand must know the-pathoption - A
mktempprogram must be available in$PATHif you make use of the temporary file name feature (described later) flockis needed unless you disable file locking (seeLOCKFILEbelow).
Some standard tools like /bin/false are also assumed (if /bin/false
is missing, it is also ok, but it must not do something else than return
nonzero status).
Of course, for the case that you use the FILE_TBZ feature, also the
corresponding TARCMD and its requirement (like tar and bzip2) must exist.
If you want that the hard status line is set, also the title script from
https://github.com/vaeth/runtitle (version 2.3 or newer) is required in your
$PATH.
It is strongly recommended to put
alias squash_dir='noglob squash_dir'
into your ~/.zshrc, /etc/zsh/zshrc, or /etc/zshrc, so that things like
squash_dir start *
will work in your zsh as intended without the need to quote *.
(I assume that you do not use a poor shell instead of zsh.)
In this example, it is assumed that you have already installed/copied the
/etc/init.d/squash_dir script and that you want to keep the three directories
/usr/portage, /var/db, and /usr/share/texmf-dist compressed
(as a remark: other good candidates for compression are the kernel sources
and on some systems also /usr/share/games).
Create three symbolic links:
ln -s squash_dir /etc/init.d/squash_portageln -s squash_dir /etc/init.d/squash_dbln -s squash_dir /etc/init.d/squash_tex
You have to create the corresponding three config-files of the same name
in /etc/conf.d/.
Here are typical examples of the content of these files:
/etc/conf.d/squash_portage:
DIRECTORY=/usr/portage
DIR_CHANGE=$DIRECTORY.changes
DIR_SQUASH=$DIRECTORY.readonly
COMPRESSION=
THRESHOLD=40000
/etc/conf.d/squash_tex:
DIRECTORY=/usr/share/texmf-dist
DIR_CHANGE=$DIRECTORY.changes
DIR_SQUASH=$DIRECTORY.readonly
IGNORETOUCH=ls-R
IGNORETOUCH=$IGNORETOUCH"|tex"
IGNORETOUCH=$IGNORETOUCH"|tex/generic"
IGNORETOUCH=$IGNORETOUCH"|tex/generic/config"
IGNORETOUCH=$IGNORETOUCH"|tex/generic/config/language.dat"
IGNORETOUCH=$IGNORETOUCH"|tex/generic/config/language.dat.lua"
IGNORETOUCH=$IGNORETOUCH"|tex/generic/config/language.def"
/etc/conf.d/squash_db:
DIRECTORY=/var/db
FILE_SQFS_OLD=$DIRECTORY.sqfs.bak
DIR_CHANGE=$DIRECTORY.changes
DIR_SQUASH=$DIRECTORY.readonly
COMPRESSION=lzo
THRESHOLD=1000
Optionally, you can also modify global defaults in /etc/conf.d/squash_dir;
see the comments in the same conf.d/squash_dir file for details
The meaning of this configuration data is the following:
The first line determines the directory you want to keep compressed and
be writable; the corresponding compressed data will be expected/created
in the file $DIRECTORY.sqfs (e.g. in /usr/share/portage.sqfs).
Moreover, later, there will be auxiliary directories $DIRECTORY.changes
and $DIRECTORIES.readonly available. The latter is the content of
the compressed data without any modifications (this directory is readonly),
and the former contains the modified files (and some metadata, depending
on which of
overlayfs | aufs | unionfs-fuse | unionfs | funionfs
you are using).
The THRESHOLD value means that your changes will not be compressed on every
shutdown but only if $DIRECTORY.changes gets large enough.
Moreover, the IGNORETOUCH-value in squash_tex means that changes only in
the date of the file /usr/share/texmf-dist/ls-R or
/usr/share/texmf-dist/generic/config/language.{dat{,.lua},def}
should not cause a recompression on shutdown
(these files are usually often recreated with the same content,
and so if nothing else happens, it is reasonable to ignore this change).
The FILE_SQFS_OLD value in /etc/conf.d/squash_db means that a
backup should always be kept of the previous compressed data for /var/db;
this is for security reasons, since that directory is rather vital to
your system (the other two directories could be re-synced resp. re-emerged
in case something bad happens, but if /var/db is lost, you have practically
completely messed up your system).
The settings of COMPRESSION mean the following:
squash_tex: Use the usually best compressing algorithm (currently:xz)squash_portage: Use the defaultmksquashalgorithm (currently:gzip)squash_db: Use thelzoalgorithm (usually the fastest)
Of course, you should make sure that the squashfs in your kernel supports the corresponding algorithms.
Now to actually make these settings active, start the initscripts. You can do this manually in the classical way using (in case of openrc)
/etc/init.d/squash_portage start/etc/init.d/squash_tex start/etc/init.d/squash_db start
or using (in case of systemd)
systemctl start [email protected]systemctl start [email protected]systemctl start [email protected]
or in a more convenient way using the /usr/sbin/squash_dir
command line interface to start them all with only one command:
squash_dir startorsquash_dir start portage tex db(this assumes of course that/usr/sbin/squash_dirwill be found in your$PATH).
Be very careful that you made no mistake before, when you make this step! The starting of the initscripts will create the corresponding squashed files and clean the directories (i.e. if you want to undo this change for some reason using unsquashfs on the created files, you might have lost some information permanently like e.g. hard-links within the cleaned directories).
If the above step appears too dangerous to you, you can of course also create the file manually
mksquashfs /usr/portage /usr/portage.sqfsmksquashfs /usr/share/texmf-dist /usr/share/texmf-dist.sqfsmksquashfs /var/db /var/db.sqfs
and if this was successful, for testing only move the corresponding
directories
/usr/portage, /usr/share/texmf-dist, /var/db
somewhere else; actually, the latter is not mandatory: The directories will
just get "over-mounted", i.e. you will not see the previous content anymore.
If the squashed file exists (i.e. if you created them manually using
'mksquashfs), you can start the initscript safely, i.e. in this case $DIRECTORY` will not get cleaned automatically.
In order to start the initscripts also on the next boot, add them to your default runlevel (if you use openrc):
rc-config add squash_portage defaultrc-config add squash_tex defaultrc-config add squash_db default
If you use systemd, to start all configured scripts at once on system start:
systemctl enable squash_dir
When you shutdown the computer (more precisely: When the above initscripts
are stopped) any modifications to the directories are recompressed
(unless the THRESHOLD is not reached or the touching of
/usr/share/texmf-dist/ls-R was the only modification).
In some situations you might want to recompress the directories even
before you shutdown the system (or perhaps even if the THRESHOLD is not
yet reached or no serious modifications were done).
In this case you can call e.g. (in openrc)
/etc/init.d/squash_portage restart/etc/init.d/squash_tex restart/etc/init.d/squash_db restart
or (in systemd)
systemctl restart [email protected]systemctl restart [email protected]systemctl restart [email protected]
or you can use the /usr/sbin/squash_dir command line interface with
corresponding parameters to execute (some or all) of these commands in a row
(calling the interface without parameters shows the options; the interface
offers with -s resp. -sf also the possibility to e.g. create magic files
to override the THRESHOLD option).
If you plan to squash the Gentoo portage tree /usr/portage, you should keep
$DISTDIR in a different directory in advance:
It makes no sense (i.e. it costs enormous time and needs lot of temporary
diskspace without much gain) to compress compressed tarballs. Hence:
Move /usr/portage/distdir to some other place (outside the /usr/portage
hierarchy) and modify $DISTDIR in /etc/portage/make.conf correspondingly,
before you start the initscripts for the first time.
It is in general rather safe to squash a directory, even a rather vital one:
Even if e.g. you boot from a kernel which has no support for some of
aufs | overlayfs | unionfs-fuse | unionfs | funionfs
to make the directory writable, the script will mount it at least as read-only
(using mount --bind if necessary).
Moreover, if everything goes wrong you can still use unsquashfs
to unpack the directory manually.
Probably the only danger in packing "strange" directories are special files
like hard links (this information will usually get lost) or special devices
which are perhaps not supported by the used tools.
If you compiled squashfs, aufs, overlayfs, or fuse as modules,
you should modprobe these modules first (or better put them into
/etc/conf.d/modules).
squash_dir will make no attempt to load the modules (unless this happens
automatically by the corresponding mount program): The script will just
attempt to mount the directories using the corresponding tool and
will check its return status for success.
If the mount fails, the next tool is attempted for mounting, until one
succeeds (the order and which tools are attempted can be influenced using
the ORDER variable described below).
If no tool succeeds, it is attempted to use mount --bind to get
the directory at least readonly on the expected place, so even in
this bad situation (which probably only happens if you boot from an
experimental kernel or a brand new kernel without corresponding support)
you can still access the directory read-only. Hence, also rather vital
directories can be compressed as long as it is not vital to write to them
(and as long as the relevant programs for mounting etc. are not contained
withing these directories, of course).
It is recommended to use a patched version of squashfs-tools which
redirects its progress bar to stderr (instead of stdout).
Cf. the description of the VERBOSE_MODE variable for details.
Besides the usual options like start/stop/restart, there are also
helper options for the /etc/init.d/squash_* scripts which are meant to be
used from other scripts (for example, they are used by the
/usr/sbin/squash_dir command line interface).
-
STOPExecutes the actions of
stopwithout actually stopping. Moreover, this can be called even if the script was not started. Use this only in case of fatal problems and with extreme care! -
STARTExecute the actions of
startwithout actually starting. For instance, it is not required that dependencies are started. Moreover, this can be called even if the script was started. Use this only in case of fatal problems and with extreme care! -
RESTARTExecute the actions
STOP&&STARTwithout actually restarting. For instance, dependencies are not restarted. Moreover, this can be called even if the script was stopped. Use this only in case of fatal problems and with extreme care! -
will_squashreturns true/false (and a corresponding message unless
-qis used) depending on whether thestopoperation would re-squash or kill$DIR_CHANGE(the latter means that$KILL_FILEexists). -
need_squashreturns true/false depending on whether new data was written. (If no
$MAGIC_FILEexists - see below - this is the same aswill_squash). -
have_magicreturns true/false depending on whether
$MAGIC_FILEexists. -
have_killreturns true/false depending on whether
$KILL_FILEexists. -
print_dir_changeoutputs the effective path to
DIR_CHANGEto stderr, taking the temporary name feature into account (see below). -
print_dir_squashoutputs the effective path to DIR_SQUASH to stderr, taking the temporary name feature into account (see below).
-
print_ignore_thresholdoutputs the effective value of
IGNORE_THRESHOLD, taking the temporary name feature into account (see below). IfTHRESHOLDis not used, the empty string is output. -
print_magic_fileoutputs the effective value of
MAGIC_FILE, taking the temporary name feature into account (see below). -
print_kill_fileoutputs the effective value of
KILL_FILE, taking the temporary name feature into account (see below).
(It may be faulty to use the print_* commands if the temporary name
feature is used in the corresponding paths and the script was not started).
Unfortunately, the return value of initscripts is ignored with openrc.
Therefore, the answer (1 for true, 0 for false) for the first three
functions is written to stderr instead of being passed as an exit status.
For the directory names of the print_dir_* options a / is appended to
make it easier for calling scripts to deal with trailing spaces.
The subsequent variables can be defined in /etc/conf.d/squash_*
Three values are mandatory:
DIRECTORY must be defined, and usually you will want to specify at least
DIR_CHANGE and probably also DIR_SQUASH; for the others, default values
are assumed as described below.
The corresponding directories will be created if they do not exist.
Some variables support the "temporary name feature". This means that a path
ending with XXXXXX (like e.g. /tmp/squash_foo.XXXXXXXX) is transformed into
a corresponding file/directoryname using mktemp (or mktemp -d,
respectively) when it is used.
Using paths in world-writable directories (e.g. /tmp or /dev/shm)
for some data is a security risk and therefore strongly discouraged.
An exception of this rule is of course for those paths for which you use
the temporary name feature which is handled safely - that's why this feature
was introduced.
-
DIRECTORYThe directory where the squashed filesystem should finally be mounted, i.e. the path of the "original" directory. If you want to use this script to compress your portage tree, it might be a good idea to set this variables with
DIRECTORY=`. /etc/portage/make.conf 2>/dev/null; printf '%s' "$PORTDIR"`or the slower but more portable
DIRECTORY="`portageq portdir`"The only restriction concerning
DIRECTORYis that none of the following files or directories should reside within this directory. Note that you will get problems if you squash a directory containing data needed to run this script (e.g. the kernel module for squashfs or - if you ever plan to upgrade your kernel - tools to build the kernel modules) because you can of course not access the squash'ed directory until this script was successfully started... -
TMPDIRThis variable is only used in the defaults of the following variables. If you leave it empty, it defaults to
/tmp. -
DIR_CHANGEThe directory where the modifications of
DIRECTORYwill go. This should be on a partition where you have sufficient space. This variable supports the temporary name feature described above. However, you should use a temporary directory or a ramdisk only if your changes toDIRECTORYwill always only be temporary, i.e. if you are really prepared to loose your changes after a cleanup of the temporary directory or after a reboot. Normally (i.e. if you do not use the temporary name feature andDIR_CHANGEis not cleaned) all your changes will survive a reboot even if you make use of theMAGIC_FILEfeature below.Note that some earlier versions of squash_dir failed to empty
DIR_CHANGEif it used the temporary file name feature, but now it should be save to use it.You can leave this variable empty: If you do this, squash_dir will assume that you do not want to be able to write to
DIRECTORY, i.e.DIRECTORYwill be mounted readonly. In this case you will probably also want to leave the following variable empty. -
RM_DIR_CHANGEIf this variable is true (not empty, not
0or-and does not start withf,F,n, orN), the script will removeDIR_CHANGEat stopping. If it containsporPalso empty parents are removed.RM_DIR_CHANGEdefaults toparentsif the temporary name feature is used forDIR_CHANGE. -
RUNPATHThis is only used in the defaults of
DIR_SQUASH. It defaults to/run,/var/run, or/, depending on what exists. -
DIR_SQUASHThis is a directory which is needed for technical reasons when
DIR_CHANGEis non-empty (i.e. if you really want to mountDIRECTORYwritable). This directory will contain a read-only version of the contents ofFILE_SQFS. In case things go wrong when makingDIRECTORYwritable (e.g. if aufs/overlayfs/unionfs-fuse/unionfs/funionfs all fail due to missing support by the kernel) you can still accessDIR_SQUASH; you can also use this directory to compare the content of currently changed files with their "original" stored in the most current version ofFILE_SQFS.With some earlier versions of squash_dir, the temporary name feature was not or not properly supported for this variable, but now it is safe to use it.
If you leave this variable empty and
DIR_CHANGEis nonempty,DIR_SQUASHdefaults to$RUNPATH/$SVCNAME.readonly.If
DIR_CHANGEis empty,DIR_SQUASHis not really needed and should usually be left empty. Nevertheless, if you setDIR_SQUASHanyway, theDIR_SQUASHdirectory will contain an identical copy ofDIRECTORY(this is useful if you use some scripts which rely onDIR_SQUASH, and you changeDIR_CHANGEtemporarily from nonempty to empty). -
RM_DIR_SQUASHIf this variable is true, the script will remove
DIR_SQUASHat stopping (ifDIR_SQUASHis set and the directory does not contain files). If it contains the letterp, also empty parents are removed.RM_DIR_SQUASHdefaults to true if the default (and nonempty) value is used forDIR_SQUASH. It defaults toparentsif the temporary name feature is used forDIR_SQUASH. -
NAME_FILEIf you use the temporary name feature for
DIR_CHANGEorDIR_SQUASH, this variable must contain the name of a file which is used to store these temporary names. If no errors occur, this file is created/removed on start/stop. IfNAME_FILEis empty, it defaults to$RUNPATH/$SVCNAME. -
TMP_SQFSThis is a filename (which supports the temporary name feature) which is used during shutdown for the squashfs-file which is created from
DIRECTORY. After successfull creation that file is moved toFILE_SQFS. On the partition of this file there must be enough space to store the newFILE_SQFS. If possible, you should use the same partition on which alsoFILE_SQFSis stored (then the move command does not have to copy the data once more). Alternatively, if you have sufficient ram, you can also use a ramdisk like/dev/shm/dir_squash_tmp_sqfs.XXXXXXXX(but you will not get much speed increase from doing so). IfTMP_SQFSis empty, it defaults to$TMPDIR/$SVCNAME.sqfs.XXXXXXXX. -
FILE_SQFSThis is the file which contains the actual squashfs data of
DIRECTORY(this file must exist when you start this script. See the output message of the script on how to create it.) If you leave this empty, it defaults to$DIRECTORY.sqfs. -
FILE_SQFS_OLDIf defined, this file will be an (automatically updated) copy of your previous
FILE_SQFSfile. -
MV_FILE_SQFSHere you can define the
mvcommand which is used to createFILE_SQFS_OLD. You might want to set this e.g. tomv --backup --,mv --version-control --, or similar things. The default ismv --. -
FILE_TBZIf defined, this file will contain a copy of
FILE_SQFS, but in.tar.bz2format (updated during stopping). This may be handy in case of problems when you do not have access to a kernel with an sqfs-module or tounsquashfs. -
TARCMDThis is the command (including options) used to create the
FILE_TBZarchive. It defaults totar -cjf, but you might want set it to/home/bin/tbzd -Rif you installed my compression scripts there (this will save slightly more space by stripping the parent directory names and usingbzip -9). Of course, you can also use your own script analogously or use another compression program. -
FILE_TBZ_OLDIf defined, this file will be an (automatically updated) copy of your previous
FILE_SQFS_TBZfile. -
MV_FILE_TBZHere you can define the
mvcommand which is used to createFILE_TBZ_OLD. SeeMV_FILE_SQFS. -
IGNORETOPThis is a list of paths relative to the top-level
$DIRECTORYwhose changes (which actually occur in$DIR_CHANGE) are ignored when squash_dir decides whether the directory needs to be re-squashed. So, for example if you defineIGNORETOP='\"A \\\"magic\\\" link\" \"subdir/device-*\"'then changes in the files/links/devices/whatever called
$DIR_CHANGE/A "magic" file$DIR_CHANGE/subdir/device-something may follow here
will get ignored. Do not use this for directories if you also want to ignore the content of the directories - use
IGNOREDIRfor the latter. The format of the list is space-separated but quoting is allowed. More precisely, the list is first eval'ed, and then each item is eval'ed within "..." context (and interpreted as a filenane pattern), therefore the included"needs to be triple-quoted and the space and*needs not be quoted if used within " ... ". -
IGNORETOPFILEThis is like
IGNORETOP, but it is explicitly checked that the match is a file (a link to a file does not count either); those of other type are ignored. -
IGNORETOPDIRThis is like
IGNORETOPFILE, but it is explicitly checked that the match is a directory. In this case, also the content of the directory is ignored. -
IGNOREThis is like
IGNORETOPwith the difference that the content is not a list of names but an expression which is passed to find in an eval "..." context. Here you can check also for other files which are not in the top-level directory. If you use -path, note that the pathname starts with$DIR_CHANGE, so e.g. to ignore the link.bad_linkin the top-level of$DIRECTORY, but only if this is really a link) you can defineIGNORE='-path "\$DIR_CHANGE"/.bad_link -type l'If your match is a directory and you call
-prune, then also the content of the directory is ignored. -
IGNOREFILEThis is similar to
IGNORE, but it is additionally (automatically) added code for find to check that the match is a file. -
IGNOREDIRThis is similar to
IGNORE, but it is additionally (automatically) added code for find to check that the match is a directory. Moreover, in this case also-pruneis called to ignore the content of this directory. -
IGNORETOUCHThis is a list of paths relative to the top-level
$DIRECTORYwhose changes (which actually occur in$DIR_CHANGE) are ignored, provided that thediffutility shows that the file was not modified compared to the corresponding original file in$DIR_SQUASH. The format of the list is that of acasestatement, i.e. you can use file globbing and|to separate alternatives and have to quote|or)if you use it as symbols. Note that no pruning of directories is done, i.e. with each directory also its whole content is checked againstIGNORETOUCH; directories are by definition always equal if they existed before. Typical example:IGNORETOUCH=ls-R IGNORETOUCH=$IGNORETOUCH"|tex" IGNORETOUCH=$IGNORETOUCH"|tex/generic" IGNORETOUCH=$IGNORETOUCH"|tex/generic/config" IGNORETOUCH=$IGNORETOUCH"|tex/generic/config/language.dat" IGNORETOUCH=$IGNORETOUCH"|tex/generic/config/language.dat.lua" IGNORETOUCH=$IGNORETOUCH"|tex/generic/config/language.def"Even if the file
$DIRECTORY/ls-Rwas recreated by one of your system tools, no re-squashing will be done if the new file is identical to the old one and if there were no other changes. Note that also parent directories must be explicitly listed to ignore the possible changes in them. -
KEEPIf
$KILL_FILEdoes not exist but$DIR_CHANGEis cleaned without re-squashing (this can only happen if no other files than those inIGNOREorIGNORETOUCHwere changed) then the files in this variable are kept anyway. Currently, only files/subdirs of$DIRECTORYare supported, no deeper nesting is allowed (i.e. you must not use/here). The format is that ofcase, i.e. you can use wildcards and separate several names with|. Quoting is of course supported. You must not use)in the name unless you quote it.Example:
KEEP=".*|'*)'"will keep all files/subdirs of the form$DIRECTORY/.* or$DIRECTORY/*)" -
KILL_NOTIf
$KILL_FILEexists (so that$DIR_CHANGEis cleaned without re-squashing) then the files in this variable are kept anyway. The syntax is the same as that ofKEEP. -
ORDERIf the variable
DIR_CHANGEis empty, this variable is ignored. Otherwise, its value should be a string consisting of all (or some) of the wordsoverlayfs aufs unionfs-fuse funionfs unionfs (*)
Then the corresponding tool is used to make
DIRECTORYwritable. The tools are attempted in the given order: If the first tool fails, a warning message is printed, and the next tool is attempted and so on. IfORDERis empty, it defaults to (*). -
MAGIC_FILENormally, if the directory
$DIR_CHANGEis nonempty on shutdown, the squash file and the tbz file are created (and the backups are made), and afterwards directory$DIR_CHANGEis deleted. However, if the file$MAGIC_FILEexists during shutdown, nothing of these things happens, i.e. the information in directory$DIR_CHANGEis simply kept for the next start of this script (or for your manual interaction). In particular, creating the file$MAGIC_FILEtemporarily, you can "delay" the update during shutdown until you delete$MAGIC_FILEagain. This is useful e.g. for/usr/src/linuxwhich you usually will not want to recompress after recompilation of the kernel. If you leave the variableMAGIC_FILEempty, it defaults to$DIR_CHANGE/.no-save. -
KILL_FILEThis is similar to
MAGIC_FILE, but with the difference that if this file exists during shutdown, directory$DIR_CHANGEis deleted nevertheless; only the files in $KILL_NOT are kept. So be very careful when creating this file: It means that your changes will be lost completely on shutdown or restart! If you leave the variableKILL_FILEempty, it defaults to$DIR_CHANGE/.No-save. -
THRESHOLDIf this variable is a positive number, and directory
$DIR_CHANGEis not larger thanTHRESHOLDkilobytes, then the effect is as ifMAGIC_FILEexists, i.e. the update during shutdown will not happen. You can override this with: -
IGNORE_THRESHOLDIf this file exists, then
THRESHOLDis ignored during shutdown. If this file resides in directory$DIR_CHANGE, then it is removed before the compression. Of you leaveIGNORE_THRESHOLDempty, it defaults to$DIR_CHANGE/.do-save. -
COMPRESSIONSpecify the compression method used by
mksquashfs. If empty, the defaultmksquashfsalgorithm (currently:gzip) is used. Other possible values aregzip,xz,lzo. If this variable is not specified, it defaults to that algorithm which is presumably best compressing (which is currentlyxz). -
MKSQUASHFSThese options are used for
mksquashfs(e.g.-check_data). The option-noappendis used automatically. Depending onVERBOSE_MODEandCOMPRESSIONalso the options-no-progressor-comp ...might be used automatically. -
VERBOSE_MODEIf this variable is
-
0then
-no-progressis appended tomksquashfsoptions and the output ofmksquashfsis redirected to/dev/null. -
1or `` (empty)then stdout of
mksquashfsis redirected to/dev/nullUsually, this is the same as0, only marginally slower. However, you might apply a patch formksquashfsto redirect the progress bar to stderr. This produces the nicest output with no redundant information. -
2thenmksquashfsis called without additional options or redirections.
-
-
MOUNT_AUFSThese are additional options used for the mount-command for aufs. The default is
-o noatime. You might want to add options like-o rdblk=0 -o rdhash=0which help you if you have setup aufs for userspace (RDU), seeman aufs(e.g. fromsys-fs/aufs*[-util]) for details. -
MOUNT_OVERLAYFSThese are additional options used for the mount-command for overlayfs. The default is
-o noatime. -
MOUNT_UNIONFS_FUSEThese are additional mount options used for unionfs-fuse. The default is:
-o cow -o allow_other -o use_ino -o nonempty -o noatime -o hide_meta_filesSo if you modify this variable, you should probably include these options. Omit them only if you know what you are doing.
-
UNIONFS_FUSE_HIDEThis variable is only used in the default value of
MOUNT_UNIONFS_FUSE. If you do not set it, the default is either-o hide_meta_filesor empty, depending on whether unionfs-fuse is new enough. If you use unionfs-fuse, you might want to set this variable explicitly in order to save time for determining whether unionfs-fuse is new enough (or if you do not agree with the default). -
MOUNT_UNIONFSThese are additional mount options used for unionfs. The default is empty.
-
MOUNT_FUNIONFSThese are additional mount options used for funionfs. The default is
-o allow_other -o nonempty. So if you modify this variable, you should probably include these options. Omit them only if you know what you are doing. -
UMOUNT_OPTSThese are options which are used for
umounting. This defaults to-ibecause/sbin/umount.aufscauses problems in some cases. -
LAZY_UMOUNTIf this variable is unset or true, a lazy umount is attempted after a failed umount. This means that the chances are good that this script will successfully stop even if the directory is still in use. However, it might happen that e.g. loop devices are not freed correctly.
-
LOCKFILESince
mount/umountcalls cannot properly be done in parallel (since apparently they do not properly lock/etc/mtab), we useflockfor these calls to create a lockfile (which is never erased) to allowrc_parallel=YES. You can set this variable to the following values:- to a path of the lockfile. The path must be absolute, i.e.
starting with
/. It is dangerous to use a user-writable directory here (like e.g./tmp). - to the magic value
auto(or if you do not set this variable): In this case the lockfile/etc/mtab.lockis used unless/etc/mtabis a symbolic link. In the latter case the lockfile feature is switched off. - In all other cases (e.g. if you set
LOCKFILE=orLOCKFILE=no) the lockfile feature is switched off.
- to a path of the lockfile. The path must be absolute, i.e.
starting with