I need to backup all my data from a server (in 10 minutes), preferably keeping the symlinks.
2 Answers
-
1I also like to add
--delete
otherwise the backup just grows with things you don't need anymore. Make sure to use that option with care! Commented Jan 31, 2014 at 15:17 -
I will dig into those (and other) options with more time, probably there are lots of option that could helped. Commented Jan 31, 2014 at 15:27
I personally use this script to get a systemwide backup from my server.
Notice the sudo in front of rsync to make sure groups, users and permissions are set properly.
Of cause downloading a complete server might take some time. You may want to change the folder by changing serv:/
with serv:/home/myuser/important/
#!/bin/bash
#setup
folder=$(date +%Y-%m-%d)
mkdir $folder
cd $folder
#download
sudo rsync -aPuzh --exclude='/proc' --exclude='/dev' --exclude='/tmp' --exclude='/sys' --exclude='*/.cache' serv:/ ./
#compress
sudo tar -czf "$folder.tar.gz" *
sudo mv "$folder.tar.gz" ../
cd ..
#delete original
sudo rm -rf "$folder"
rsync
tag you know about rsync. You could also make a image of the disk withdd
.