forked from tri1976/bashscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmpfs-sync.readme
67 lines (51 loc) · 3.58 KB
/
tmpfs-sync.readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
README for tmpfs-sync
AUTHOR
Tri Le <trile7 at gmail dot com>
SOURCE
tarball can be downloaded from http://code.google.com/p/bashscripts/downloads/list
scripts can be viewed at http://code.google.com/p/bashscripts/source/browse/trunk/tmpfs-sync
aur package http://aur.archlinux.org/packages.php?ID=58684
DEPENDENCIES
coreutils, rsync
INSTALL
This installation procedure is for Arch's system.
- download aur PKGBUILD from http://aur.archlinux.org/packages/tm/tmpfs-sync/PKGBUILD
- in folder where PKGBUILD is stored, run "makepkg -i"
- tmpfs-sync files will be installed in the following locations: /usr/share/tmpfs-sync, /etc/rc.d, and /etc/conf.d
FEATURE
- Speed up data access and reduce read/write to SSD by move directories to tmpfs and sync them to physical disk on demand or when daemon stop
- Use with any directory.
DESCRIPTION
Usage: tmpfs-sync --config config_file readme|start|sync|stop
start command copies directories to tmpfs, renames them by adding "-backup" to the end of the name, and then creates symbolic links of the directories to tmpfs. For example, put /var/log in tmpfs (/tmp)
- copy /var/log to /tmp/log
- rename /var/log to /var/log-backup
- symbolic link /var/log to /tmp/log
sync command uses rsync to copy changes in tmpfs to physical disk. For the above example, it copies changes in /tmp/log to /var/log-backup
stop command syncs tmpfs to physical disk, and then remove tmpfs, symbolic link, and "-backup" from the end of the name. For the above example
- sync changes in /tmp/log to /var/log-backup
- remove /tmp/log and /var/log
- rename /var/log-backup to /var/log
tmpfs-sync should be run as daemon (see tmpfs-sync.rc or tmpfs-sync.service) so that it can start and stop properly with the system. For example, tmpfs-sync runs on system bootup and sync and stop before system power down. If you'd like to sync changes more often, you can run the sync command manually or add it to cron job (i.e. "tmpfs-sync sync").
Configuration file must be specified by using --config parameter. You can find an example of the config file at /usr/share/tmpfs-sync.cfg or within the package. By default, rc/service file uses config file located at /etc/conf.d/tmpfs-sync, you must edit them if your config is in another location. Config file contains 2 variables: tmpfs and sync_folders
- tmpfs is the location where tmpfs is mounted. Default is /tmp. You can find where tmpfs is mounted by running "mount | grep type.tmpfs"
- sync_folders is an array of folders (fullpath) to be moved to tmpfs and sync to physical disk on demand. I'd recommend the following folders: /home/user/.cache, /home/user/.mozilla (firefox profile), /home/user/.config/chromium (chromium profile), /home/user/.config/google-chrome (google chrome profile), and /var/log
CHANGELOG
v0.3
- minor code improvements
- sync file as well as directory
v0.4.1
- add service file for systemd
v0.4.2
- repackage to include tmpfs-sync.sync file (for cron job syncing)
COPYING
Copyright (C) 2012 Tri Le <trile7 at gmail dot com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.