Posts tagged backup

Partiton Full? Move your Stuff Somewhere Else

If you run out of space on a particular partition, but you have excess space on another partition you can relocate your data. Lets say you have 100 Megabytes left on /dev/hda1 but your have 10 gigs left on /dev/hda2. Lets say you have a folder on /dev/hda1 /home/user/backup that is over 2 gigs. Lets transfer these files to /dev/hda2 and then create a symbolic link at the original location so the folder can be accessed from the exact same location. For the example /dev/hda1 is mounted at /home/user/backup and /dev/hda2 is mounted on /home/user/backup2.

1) Create a new folder and move the contents.

cp -r /home/user/backup/* /home/user/backup2

Then check that the files have been successfully copied to the new directory. Then delete the original backup directory.

rm -r /home/user/backup

Then create a symbolic link to the backup directory.

ln -s /home/user/backup2 /home/user/backup

Now when you navigate to /home/user/backup you wont be able to tell the difference except that you have now alot of space on the /dev/hda1 partition.

Your partitions may be mounted to different locations, just apply the above example to your particular configuration.

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.

Server and Backup Layout

Both the master and slave servers reside on a host machine. Clearly the servers are virtual machines. Its strategic to use virtual machines because the host machine remains useful for a variety of other tasks. The virtual server compartmentalize the functions to a discretely backupable file. In my particular arrangement the master server is synchronized with the slave server. The slave server has the same applications installed as the master. A fully functional apache web server with php and mysql support. The mysql database is synchronized as a replicate in real time, and rsync is used to sync the apache web root. In the rsync function I skip the wordpress and wiki config files, in which I reference the mysql server on the slave machine. Doing so allows server2 to be a drop in replacement for the master just by switching the port forwarding settings in the router. I would have to reconfigure my.cnf as the master in such a transplanation. The mail server has spamassassin and clamav installed on master and slave and /var/mail are synchronized to keep a relatively real time backup.

Then once a day the slave server is backed up. Vboxtool handled this seamlessly. Vboxtool stops the virtual machine, transfers it, and automatically restarts it. The initial backup is done to backup1. Then rsync is used to backup the home folder on my host system. I also use the computer for my own personal things, which are effectively backed up to backup1. Then, subsequently, the host initiates an rsync of backup1 to backup2, then to backup3. I have a rsync duplicate of backup1 on backup2 and backup3.

The host also is a MythTV server, and backup3 is the client that is subsequently connected to the TV. I have my various hosts relatively diversified and multitasked.

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.

Tux Icons – An Enlarged Desktop Experience

I just downloaded a great icon theme. Tux is rocked out 61 times over.

Desktop

You can download the icon theme here:

http://gnome-look.org/content/show.php/61+Cute+Tux+Icons?content=117192

Right click on the icons to stretch them. Notice backup and backup2. I will explain next time how these external usb drivers are keeping a daily backup of the entire system.