Cloning a Drive over the Network using udpcast.

So ever since I started writing this blog (two days ago), I realized I have a bunch of things that I could share that may help some people, however, I need to get the hang of this blogging thing so I can convey  my ideas more clearly, for starters, I just installed a grammar and spelling checker in my browser and double checking my post to the best of my grasp of the English language so if you are here to pick up some of the things I share just know that I will improve my writing and that there are more things to come, so to the actually tutorial now.

Some time ago i had to clone a RAID volume i think it was a RAID 5, usually i would clone drive by drive and the just rebuild the RAID, this is usually how i do it for a "broken RAID" but in this case the RAID was fine no degradation or missing drives the system was even able to boot (CentOS) so that's when udpcast came to mind i could just clone the system on the "fly", this happened a while ago so i don't have the system to post pictures in this tutorial, however i do have and LVM volume in my laptop and i could just use that instead same principle.


Here we go, first if you don't already have udpcast installed in your machine you can get it here: http://www.udpcast.linux.lu/downloads.html pick one according to you system type. If you never install a DEB file is actually quite simple, open a terminal and go to your Downloads folder or whatever folder you save the file to, so in my case would be some like this:




Next type sudo dpkg -i udpcast_20120424_amd64.deb.




Other way to install udpcast would be to just type sudo apt-get install udpcast -y
but if you want the latest version i would just go the udpcast website and get it there.

Now that is all set as far setting up udpcast we can star the process, udpcast will basically consist of udp-sender (source computer) and upd-receiver (destination).

Next we need to find out the which drive we are cloning if this was a regular computer chances are the drive would be /dev/sda, if you only have one drive in your computer of course, my case is a bit different I have and LVM volume, to really make sure we are cloning the right source I'll do this sudo fdisk -l this would give me this output:

So if you look at the bottom of the picture you will  see the LVM partitions the one i want is: Disk /dev/mapper/ubuntu--vg-root: 801.5 GiB, 860549545984 bytes, 1680760832 sectors. So once we know this we would  type sudo udp-sender -f /dev/mapper/ubuntu--vg-root you should see some like this:



Now to the machine where we are going to store this to, for this example we are gonna store the clone as an IMG file. I will login to the destination computer using "ssh" so i type: ssh asus@10.1.10.94 (note: i had to be root to be able to cd into the folder i want, if you don't know how to do that, just type su at the terminal and type your root password).


once there i cd into my folder location in my case is /media/root/LVM Volume


then from the receiving end (machine with IP 10.1.10.94) type sudo-receiver -f LVM.img


Press any key to start the process.


Now seat back get a coffee or somethings because is going to be awhile for this to finish, it will the depend in the size of your partition mine is 801 GB so it will be awhile. You could monitor how your IMG is growing by doing this in a different terminal at the destination machine do "watch -n 5  ls -lsh" so every 5 seconds it will list the contents of your folder therefore showing how much is growing.



So there you have it guys, now you officially are cloning a drive over the network not too bad right?, You will clone the whole LVM volume without having to rebuild anything which is a big plus for me.



Like always I hope I shorten the hunt for knowledge in google and this tutorial/rant has helped you.  Happy Holidays!!!


Sam Ramirez
Data Recovery Engineer
4ndr0bu@gmail.com

Comments

Popular Posts