21.07.2015 Views

Linux Journal | December 2012 | Issue 224 - ACM Digital Library

Linux Journal | December 2012 | Issue 224 - ACM Digital Library

Linux Journal | December 2012 | Issue 224 - ACM Digital Library

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

COLUMNSHACK AND /of the main differences betweenthe home and colocated imagessorted out while the server wasstill running at home. I even couldpotentially run that rsync multipletimes leading up to phase 2 justto make sure it was as up to dateas it could be. Here are the rsynccommands I used to perform thephase 1 hot sync:$ rsync -avz --progress --inplace disk0.qcow2➥remotehost:/var/lib/libvirt/images/www.example.net/disk0.qcow2could start with phase 2. I neededthe phase 2 rsync to run while theVM was powered off so I could makesure the disk wasn’t being written toduring the sync. Otherwise, I wouldrisk corruption on the filesystem.Because this required downtime,I picked a proper maintenancewindow for my server when it wouldbe less busy, finished a final phase 1hot sync a few hours before, thenhalted the VM cleanly before Iperformed the final syncs:$ rsync -avz --progress --inplace disk1.qcow2➥remotehost:/var/lib/libvirt/images/www.example.net/disk1.qcow2Between rsync’s syncing only thebits that changed and the fact thatI used -z to compress the databefore it was transferred, I wasable to sync these files way fasterthan you would think possible on a1Mb connection. Of course, thesecommands ended up saturatingmy bandwidth at home, so sinceI wasn’t under time pressure forthe hot sync to complete, I endedup setting a bandwidth limit of 10kilobytes per second for the largerdisk1.qcow2 image:$ rsync -avz --progress --inplace disk0.qcow2➥remotehost:/var/lib/libvirt/images/www.example.net/disk0.qcow2$ rsync -avz --progress --inplace disk1.qcow2➥remotehost:/var/lib/libvirt/images/www.example.net/disk1.qcow2Because of the previous work ofsyncing up the disk images, the finalcold sync took only an hour or twowith most of the time being spentwith rsync seeking between the localand remote image to confirm theywere in sync. Once the commandscompleted, I was able to power upthe server again on my colocatedhost, change its IPs back, and I wasback in business.■$ rsync -avz --progress --inplace --bwlimit=10 disk1.qcow2➥remotehost:/var/lib/libvirt/images/www.example.net/disk1.qcow2Once phase 1 was complete, IKyle Rankin is a Sr. Systems Administrator in the San FranciscoBay Area and the author of a number of books, including TheOfficial Ubuntu Server Book, Knoppix Hacks and Ubuntu Hacks.He is currently the president of the North Bay <strong>Linux</strong> Users’ Group.WWW.LINUXJOURNAL.COM / DECEMBER <strong>2012</strong> / 47

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!