Linux Administrator - Backing up a drive partition

Linux Administrator

Privacy Policy

RSS Feed


Acoustic Guitar Tips
Anna Kendrick
Beekeeping Tips
BLISS
Catherine Zeta Jones
My View On Things
Cheap Auto Insurance
Cheap Places to Live
Delta Shaper
Easy Wood Projects
Free Sheet Music
Funny Clean Jokes
Healthy Carbs
Heidi Klum
Improve Your Credit
Ivory Tower Group
Keke Palmer
Linda Ronstadt
Linux Administrator
Money Spigot
Nicole Kidman
Planet Cabinet
Quality Dating Advice
Rustic Cabinets
Sacramento Hiking
Sandra Bullock
Spintax Tool
The Actress
Who Are The Beatles


Backing up a drive partition

Backing up a drive partition

I came across a problem a few weeks ago, and I thought I'd share it with you. I had a customer who wanted to have his vps site moved from one server to another, but he wanted to keep everything the same. As a matter of fact, he wanted nothing touched, not even the IP address. I was going to do a simple copy the files in the vps to a newly created one on a different server. Then, I thought, wouldn't it be nice if I could just copy the entire partition of his vps over the network instead of the thousands of files?

I researched the problem a bit, and most people suggested using dd.

So, I gave it a shot myself. I create a new lvm partition on the new server and ran this command on the old server:

dd if=/dev/mylvm/mess.disk | ssh newserver.com 'dd of=/dev/mylvm/mess.disk' bs=1k

Sure enough, it copied the entire disk over, but it took forever. It was only an 80gb partition, but I was able to go have lunch and come back and watch it for another hour or so.

Because I'm always looking for a better way, I decided to experiment with compressing the stream as it was being sent to the new server. I changed my command to this:

dd if=/dev/mylvm/mess.disk | gzip -c | ssh newserver.com 'gunzip -c | dd of=/dev/mylvm/mess.disk' bs=1k

To copy an 8gig partition, it took 13 minutes without using gzip. With gzip, I managed the copy 18 minutes. So, the addition of gzip actually made the process slower. So, my recommendation is, use the first line and go get a bite to eat or take a walk.


Return To Main Page