Linux live backup attachment
mouse 456 · person cloud · link
Last update
2018-12-10
2018
12-10
«tar, netcat, ssh»

You can basically do a live backup of the current running Linux system with tar (see also the attachment):

1
2
3
4
5
6
7
8
9
10
11
sudo tar -czvpf bkup.tgz \\
  --exclude=/home/*      \\
  --exclude=/media/*     \\
  --exclude=/mnt/*/*     \\
  --exclude=/dev/*       \\
  --exclude=/proc/*      \\
  --exclude=/sys/*       \\
  --exclude=/tmp/*       \\
  --exclude=/run/*       \\
  --exclude=/var/log/*   \\
  /

and remember to backup /home by other means.


You can also make a backup through the network:

  • via netcat:
1
2
nc -l -p 6000 > /home/backup.tgz # on remote system
tar ... | nc -w 3 remote_ip 6000 # on local system
  • via ssh:
1
2
3
4
# backup local system on remote one:
tar ... | ssh remote_ip "cat - > /home/backup.tgz"
# backup remote system on local one:
ssh local_ip "tar -f - ..." > /home/backup.tgz

Source: linuxclues