Linux: Brief System Backup

Time to time it is necessary to briefly update the running system. Especially, when experimenting with some new features…

System Backup

Packing except a few directories which are not necessary for the backup:

cd / && tar cpzf backup.tgz --exclude=backup.tgz --exclude=proc --exclude=dev --exclude=lost+found --exclude=mnt --exclude=run --exclude=sys --exclude=var /

Unpacking:

tar xzf backup.tgz -C /

Transfer the Backup Easily

There exist many ways, how to trasfer the backup tar file to another server/computer. The following example reminds of the GNU Netcat tool. First, at a remote server/computer (having REMOTEIPADDRESS), launch netcat in listening mode:

nc -l -p 6000 >/backup.tgz

That command starts listening at TCP port 6000 and sends everything what it receives to file /backup.tgz. Second, at the local computer (which is being backing up), run:

cd / && tar cpzpf --same-owner --exclude=error.log --exclude=proc --exclude=dev --exclude=lost+found --exclude=mnt --exclude=sys / 2>/error.log | nc -w 3 REMOTEIPADDRESS 6000
Advertisements
This entry was posted in Linux, Server and tagged , , , . Bookmark the permalink.