How To Backup / RSYNC All Your Data To BlueHost
Please note that backing up personal files to their servers is against their terms of service (UNLIMITED Hosting Space not disk space), so if they catch you they will probably delete all your files and suspend your account!
First of all you have to enable the SSH access in the control panel which Bluehost provided.
First I enabled SSH access. Then I enabled public-key authentication (How To) on my wei-jiang.com account. When that was done I used a script found on the internet. and I placed it on to my server:
# This script does personal backups to a rsync backup server.# directory to backup BDIR=/volume1/photo/# excludes file - this contains a wildcard pattern per line of files to exclude EXCLUDES=/volume1/NetBackup/backup.exclude# the name of the backup machine BSERVER=YOUR_USERNAME@YOUR_IPTODAY=`date '+%Y-%m-%d'`# remote directory where we would like to backup our data to RBDIR=/BACKUP##########################################################################OPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES --delete --backup --backup-dir=/$BACKUPDIR -avz"# now the actual transfer rsync $OPTS $BDIR $BSERVER:$RBDIR/currentssh $BSERVER 'touch /BACKUP/current ; cp -al /BACKUP/current/* /BACKUP/`date '+%Y-%m-%d'` ; exit';
As you can see this is a small script that creates for every day a new subdir on your /BACKUP directory. Also at any time you can find the latest backup in the following directory : /BACKUP/current
And If you may wonder about the last step :
ssh $BSERVER 'touch /BACKUP/current ; cp -al /BACKUP/current/* /BACKUP/`date '+%Y-%m-%d'` ; exit';
Here is some more info about it :
- I create a remote ssh connection to wijndaele.com (ssh YOUR_USERNAME@YOUR_IP)
- I touch /BACKUP/current , that way I know when the last sync took place
- cp -al /BACKUP/current/* /BACKUP/`date ‘+%Y-%m-%d’`: I create a hard link from all the files in /BACKUP/current/* to the Dir of that day (eg /BACKUP/2008-08-04)
- When all that is done, I simply close the remote connection!
Reference:
- rsync web pages
- Source from wijndaele

