Appearance
RAM Disk
Setup
Mount the directory with the tmpfs file system.
bash
sudo mount -t tmpfs -o size=8G,defaults,mode=0775,uid=$(id -u),gid=$(id -g) ramdisk /path/to/dir/
sudo mount -t tmpfs -o size=8G,defaults,mode=0775,uid=$(id -u),gid=$(id -g) ramdisk /path/to/dir/
1
See that folder is successfully mounted.
bash
mount | tail -n 1
mount | tail -n 1
1
To unmount the RAM disk use.
bash
sudo umount /path/to/dir
sudo umount /path/to/dir
1
Incremental backups
Create rsnapshot.conf config for hourly backups
config_version 1.2
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
# Backup intervals
retain hourly 36
# Logging
verbose 2
loglevel 3
logfile /path/to/rsnapshot.log
# Lock file
lockfile /path/to/rsnapshot.pid
# Directory where snapshots will be stored
snapshot_root /path/to/backups/
backup /path/to/dir/ localhost/
config_version 1.2
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
# Backup intervals
retain hourly 36
# Logging
verbose 2
loglevel 3
logfile /path/to/rsnapshot.log
# Lock file
lockfile /path/to/rsnapshot.pid
# Directory where snapshots will be stored
snapshot_root /path/to/backups/
backup /path/to/dir/ localhost/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Create systemd service config called rsnapshot-ram-disk.service
ini
[Unit]
Description=RAM disk backup
[Service]
Type=oneshot
Nice=19
IOSchedulingClass=idle
ExecStart=/usr/bin/rsnapshot -c /path/to/rsnapshot.conf hourly
[Unit]
Description=RAM disk backup
[Service]
Type=oneshot
Nice=19
IOSchedulingClass=idle
ExecStart=/usr/bin/rsnapshot -c /path/to/rsnapshot.conf hourly
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Create systemd timer config called rsnapshot-ram-disk.timer
ini
[Unit]
Description=RAM disk hourly backup
[Timer]
# Every hour 10 minutes before even
OnCalendar=*-*-* *:00:50
Persistent=true
Unit=rsnapshot-ram-disk.service
[Install]
WantedBy=timers.target
[Unit]
Description=RAM disk hourly backup
[Timer]
# Every hour 10 minutes before even
OnCalendar=*-*-* *:00:50
Persistent=true
Unit=rsnapshot-ram-disk.service
[Install]
WantedBy=timers.target
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Enable and start the timer
bash
systemctl enable --now rsnapshot-ram-disk.timer
systemctl enable --now rsnapshot-ram-disk.timer
1