Posts tagged rsync

Reasonable Backup Routines – Service and Desktop Integrity

The device pictured is a 128MiB PNY Attaché US...

Image via Wikipedia

You should have backups of all your files all the time. For a desktop machine always have a backup of your entire /home partition. Use a cronjob and rsync. Mount a usb drive to the /media directory. Use a cronjob as follows:

1 1 0 0 0 rsync -r /home/user /media/backup/user

The above rsync will recursively transfer all folders and files from the user directory to /media/backup/user directory.

You should have at least 1 backup. You can also implement a raid 1 array in case of a hardware failure, which is highly unlikely but does indeed happen. My configuration involves a usb backup drive, mounted as above, and another machine that I rsync the backup to via the network.

Reblog this post [with Zemanta]

Spin Down USB Hdd – Ehh I don’t Think Its Working

Oh, given my previously elabored backup configuations I have one further thing I would like to do. Since backup 1, and 2 are only used once per day I would like to spin down the hard drivers to increase longevity. I figured dismounting the drive would be effective, but I have encountered several things. First, usb drives are auto mounted, therefore there is no entry in fstab, and no folder in /media. If you dismount backup1:

sudo umount /media/backup1

Now just before issuing the backup rsync I would like to mount the hdd and spinup the hard drives:

sudo mount /dev/sdg1 /media/backup1

But the platters still feel like they are spinning. There is a hum to the disk, and it remains warm as if the partition was still mounted. Maybe I’m confused as to what a spindown is? I would like the hdd to be pseudo disconnected, even the the cable is connected, and then pseudo connected when data transmission is required just before the backup routine.

Automatic Actions – Run or Walk Those Cron Jobs

You’d be surprised what you can accomplish when you aren’t even close to your computer. Using Rsync you can completely backup your /home directory. I back it all up, except one directory, which I handle differently.

rsync --exclude="~/.VirtualBox" /home /media/backup

I mount a usb hard drive to /media/backup. Make sure you set proper permissions:

sudo chown user:user /media/backup

Now you can rsync your home directory without the need for a sudo.

Rsync only updates files that have timestamps that are newer than the previously transferred. This makes it fast; real fast!. I backup my machine using an rsync command once a day. Open crontab:

sudo crontab -e

Add a line:

0 0 * * * rsync --exclude="~/.VirtualBox" /home /media/backup

The above will run the command every day at 12 AM. Your /home directory with be synchronized with /media/backup/home.

Then comes your virtual machines. Use Vboxtool!!!! Check out this post for more info about the tool.

Set /media/backup as the backup directory in /etc/vboxtool/vboxtool.conf. Then add the following line as a cron job.

0 1 * * * vboxtool backup WebServer

Replace WebServer with the name of your virtual machine. This cron job will run every day at 1 am.