0

I need to backup all my data from a server (in 10 minutes), preferably keeping the symlinks.

rubo77
  • 27,777
  • 43
  • 130
  • 199
RSFalcon7
  • 4,367
  • 6
  • 30
  • 56
  • 1
    I suppose that since you used `rsync` tag you know about rsync. You could also make a image of the disk with `dd`. – Braiam Jan 31 '14 at 15:04
  • Have you tried rsync? Or cp? Why 10 minutes? – terdon Jan 31 '14 at 15:04
  • @terdon because the sysadmin will reboot and format the machine in 10 minutes – RSFalcon7 Jan 31 '14 at 15:07
  • you sure you need **full** backup instead of just the basic? – Braiam Jan 31 '14 at 15:08
  • @Braiam Ya, I know about, but I'm not familiar with syntax – RSFalcon7 Jan 31 '14 at 15:08
  • Depending on how much data you have and where you are copying to, this could take much longer. – terdon Jan 31 '14 at 15:08
  • @Braiam Just my home directory – RSFalcon7 Jan 31 '14 at 15:08
  • 1
    related: http://unix.stackexchange.com/questions/553/easy-incremental-backups-to-an-external-hard-drive/ – slm Jan 31 '14 at 16:01
  • also related (probably even a duplicate): http://stackoverflow.com/q/9090817/1392758 – RSFalcon7 Jan 31 '14 at 16:05
  • @RSFalcon7 - it's just considered related when it's on another SE site, dup if it's within the same SE site. – slm Jan 31 '14 at 16:13
  • @RSFalcon7 - I'm assuming you searched SE beforehand, I wasn't finding a comparable Q&A to yours, did you find any? This might be the one so you might want to to embellish it a bit more. – slm Jan 31 '14 at 16:14
  • I did. That answer (and also the one I posted bellow) wasn't working for some reason (probably some confusion in the ssh config of the backup-host that I was using), and I had a very tiny time window. When I tried the reverse direction it worked. – RSFalcon7 Jan 31 '14 at 16:20

2 Answers2

2

Done in the server with:

rsync -avx --progress ~ user@backup-host:~/backup

More info here.

RSFalcon7
  • 4,367
  • 6
  • 30
  • 56
  • 1
    I 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! – DavidGamba Jan 31 '14 at 15:17
  • I will dig into those (and other) options with more time, probably there are lots of option that could helped. – RSFalcon7 Jan 31 '14 at 15:27
0

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"
2000YG
  • 1