Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clone drive

Status
Not open for further replies.

tlcscousin

Technical User
Mar 25, 2001
1,731
CA
We have a debian install (running Plesk) with raid 1 drives one drive failed and i want to clone the backup drive to another drive to at least get the partition setup and then install the cloned drive and sync. I tried Ghost 2003 but it says it completed OK but when i boot to that drive to test i get a continous grub entry on the screen. I cant take the server down long enough to try doing it on the server so have a seperate PC setup and hooked up the drive tyhat i want to clone and booted off a USB bootable thumb drive.
I unfortunately know just enough about linux to get myself in trouble.
Is there a utility that can actually clone the drive for novices?
With ghost i actually cloned the 500GB drive to a terabyte drive then back to a new 500GB as i find ghost not that great for actually showing which drive is which, and did not want to overwrite the only drive we have that is identical to the one running on the server (disk 2 of the raid set).
 
What you are after is drive imaging. Unfortunately Ghost doesn't work very well with Linux volumes, or at least so I have read and your experience confirms.

Typical methods include:
1 - using Rsync to copy all of the files from one system to another.
2 - using netcat to pipe an image read, typically using dd to drive on another system (I personally have used this method).
3 - a copy program similar to ghost such as clonezilla. These typically run as a live CD installation. Often times it is best to unmount the volume being copied and do a sector-by-sector copy, but Linux does not have the limitation of not being able to access files because they are "in use".

I have a suggestion that is a little bit un-orthodox but given your situation I think it might be of value to you. I have an archive of emails from a Linux User's group that I received in response to this question: how best to mirror a system.

Unfortunately it is not practical for me to post the archive to the forum, but if you would like to contact me off list, I would be happy to forward the emails to you. My domain is noway2 dot net and you can reach me by matt at that domain.

 
It is software raid. I downloaded G4L to try it, i have the option of having a contracted Linux guru come in and repartition the drive which is what we actually needed on the new drive.
Unfortunately i was not involved with the initial setup and for some unknown reason they made 4 partitions.
I did a test server a year ago and partitioned it with OS swap and data and setup raid but am not comfortable working on a critical webserver that cannot be down for more than an hour without causing customer issues.
I assumed that the best way was take the mirror drive and clone it and then place it back in the server and then sync the raid.
 
Out of curiosity, what would happen if you "formatted" the drive, or set the file system type as RAID and then placed it in the system. Would it automatically rebuild the array and copy from the existing drive?
 
From the dd wiki....

image a partition to another machine:
On source machine:
dd if=/dev/hda bs=16065b | netcat < targethost-IP > 1234
On target machine:
netcat -l -p 1234 | dd of=/dev/hdc bs=16065b

Should lead you in the right direction. Hope this helps.
 
Unfortunately for some reason when we pull the second mirror'd drive and put in the third (we want to keep a complete backup no more than a month old)it never will automatically sync we have to sync manually.
I will mention DD to our friendly contrat guru and see if he will look into it i have also asked him if he can see any reason why the raid doesnt automatically rebuild.
 
Have him check the file system type of the drive. Unless I am mistaken, the drive will need to be of type FD (raid) in order for it to rebuild. You can use Gparted to both check and set this. You may also need to tell it how much of the partition (or whole disk) to use as a the raid.

A post that may be quite helpful is this:
It contains step by step instructions for building the full raid, starting from a non raid disk through creating a degraded RAID with one drive and then getting a second drive to sync and mirror.
 
Is the array made with mdadm? Try this as root
Code:
cat /proc/mdstat
to get some info on it.

You can look here to help you decode it or paste it here for some help.


 
I prefer ddrescue instead of dd, to clone drives, etc....

Ddrescue - Data recovery tool

it can definitely be found on the SystemRescueCD and the Parted Magic LiveCD, if it is not already installed on the distro...



Ben
"If it works don't fix it! If it doesn't use a sledgehammer..."
How to ask a question, when posting them to a professional forum.
Only ask questions with yes/no answers if you want "yes" or "no"
 
We are looking at all the great suggestions unfortunately have to put it on hold until next week. Long weekend in BC this week, so we put the second drive back in the machine and will be trying it again next week.
 
We used G4L and it created the partition scheme and in the process of getting the mirror rebuilt.
I have not figured out yet why we have to manually start the rebuild instead of it doing it automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top