-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot_backup.sh
More file actions
executable file
·42 lines (38 loc) · 1.16 KB
/
root_backup.sh
File metadata and controls
executable file
·42 lines (38 loc) · 1.16 KB
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
#!/bin/bash
# Author: ccasper@gmail.com
#
# Bakup the root filesystem with minimal temporary files
#
# We include / /home /boot since these are sometimes separate file systems.
OUTPUT=/backup.tgz
tar -cvpzf -C / $OUTPUT \
--one-file-system \
--exclude=$OUTPUT \
--exclude=/proc \
--exclude=/tmp \
--exclude=/srv \
--exclude=/mnt/*/ \
--exclude=/dev \
--exclude=/var/lib/plexmediaserver \
--exclude=/opt/plexmediaserver \
--exclude=/opt/getmail6 \
--exclude=/sys \
--exclude=/run \
--exclude=/media \
--exclude=/var/log \
--exclude=/var/cache/apt/archives \
--exclude=/usr/src/linux-headers* \
--exclude=/home/*/.gvfs \
--exclude=/home/*/Downloads \
--exclude=/home/*/.cache \
--exclude=/home/amcrest/*/* \
--exclude=/home/*/.local/share/Trash / /boot /home
## To Restore:
# tar -xvpzf backup.tar.gz -C /media/newroot --numeric-owner
# mkdir /media/newroot/proc /media/newroot/sys /media/newroot/mnt /media/newroot/media
# sudo -s for f in dev dev/pts proc ; do mount --bind /$f /media/newroot/$f ; done
# chroot /media/newroot
# dpkg-reconfigure grub-pc
## Rebuild /dev (which is done automatically on restart)
# udevadm control --reload-rules
# udevadm trigger