Wednesday, 27 March 2013

Using DD Command to image a Linux server (Part1)

Using DD Command to image a Linux server (Part1)

I was managing few servers hosted quite far from where I live.
I also have been tasked to create a test environment, which completly mimics the live system.

I thought long and hard on how to do it and what was the best way to approach this task. Bear in mind I had no prior knowledge on how a) the system was set b) how the system worked, which made my task a bit challanging.

I had to clone the servers based in US, bring the images over to UK, restore the images to VMware ESX and get the servers up and running.

The first thibgs I did was:
Check which servers had enough space to host temporarly large image files.
Once I established where I could store the images, I used dd command piped over ssh and that was it.

See the command below:
# dd if=/dev/hda | gzip --fast -c | ssh user@remotehost /bin/dd of=/tmp/mypc_hda.img.gz

Once I had created the image locally, all I had to do was to transfer each image over the Internet back to UK.

Once I had the images on site, I copied each image in turn to a VM server, restored it and that was it.
The restore process is a bit fiddly, I will write another post to cover the restore to VM.

I hope you guys enjoy it and make use of it.

by Renato Oliveira



No comments:

Post a Comment