Sunday, March 13, 2011

Rsync and Backup Success

A blog post started long ago, back in Oct. 2010:

If you are a reader of my blog, you might have suffered along with me through a non-existent backup. Tomorrow, I'm setting off for UDS in Orlando, Florida, and I wanted to be sure to have an up-to-date backup. So I started up my 1.5 T backup, newly formatted, and looked up a reliable article about using rsync. No more relying on GUI front-ends to it! I wanted to use it direct from the command-line, so I could see the errors right away. is simple and understandable, even for me. "The basic syntax for rsync is simple enough -- just run rsync [options] source destination to copy the file or files provided as the source argument to the destination."

Written in the now:

Unfortunately, I didn't finish this blog post after returning from Florida, but today a major disaster became a minor disaster by means of 1. a small screwdriver, 2. an inexpensive disk drive enclosure ($14.99 at Fry's), and 3. this simple command:
rsync -av /media/home/valorie/Music /home/valorie/Music
Disaster was my laptop power supply dying on me, without a recent backup. I know, shame on me! Instead, I used the screwdriver to take out the hard drive and attempted to put it into the HD enclosure I already have. However, it didn't fit. So I wrapped up the HD securely, and made a trip to Fry's. I showed the salesman the drive, to ensure I got the right kind of enclosure (SATA).

Once home, I put the drive into the enclosure, hooked it up to my netbook (thanks, ZaReason!) and began transferring my music from my old laptop to my new one, while continuing to work on the Amarok Handbook, which is *almost done*! I took the opportunity of a freshly installed Amarok to make some screenshots with which to finish the book!

An update: One trouble I've had, besides some error messages that Sre-su helped me to figure out (thank you again, Sre-su!), is that the drive kept un-mounting. I don't know why -- bad USB connection, bad enclosure, bad HD -- but the solution is to just run the command again. Rsync checks the files it has already done, and then just charges ahead. I added -r (recursive) to be sure all music files were copied, and --progress so I can see at a glance what is going on. Also, --dry-run is cool -- it shows you what will happen, quick as a flash. Also, sre-su pointed out that I needed sudo before the command, which is now:
sudo rsync -avr --progress /media/home/valorie/Music /home/Music

I didn't catch my error in the above command until today, when I wondered why my music was STILL not in my Amarok collection! What must have happened is that while my original command was correct, the USB drive is touchy, and I needed to run it a few times. Not knowing this, I changed it, and put my Music not in /home/valorie/Music where it belongs, but in /home/Music/. Bleah.

Proper command, after all, is:
rsync -avr --progress /media/home/valorie/Music /home/valorie/Music