View previous topic :: View next topic |
Author |
Message |
rafael Apprentice
Joined: 22 Jul 2002 Posts: 267
|
Posted: Wed Jul 27, 2005 6:00 pm Post subject: Mirroring a hard drive |
|
|
Hi!
My hard drive seems to be broken, but I have managed to get it partly working again. The thing is that I'm quite sure that it will not survive for a long time, as it does give out strange sounds from time to time.
Since I'd like to keep what I got on the hard drive, and got it as mentioned partly working again, I bought a new hard drive to copy everything over. The reason for why I'm making this thread is that I'd like to mirror the whole hard drive to the new one. That means to copy everything, as it is, including the partition table and everything.
I've searched the forums a bit to see if someone else already asked the same question, and I've seen that people advice others to use dd to do the job. This is all fairly good, but does it do what I'd like to do? (Mirror the whole hard drive).
I also wonder if anyone could maybe give me a little direction as of what arguments (if any) I should use with dd (if dd is what I'm looking for)?
Thanks for reading through,
- rafael |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Wed Jul 27, 2005 6:45 pm Post subject: |
|
|
rafael,
The dd command does direct disk operations. There is no safey net if you get it wrong. The command you want is
Quote: | dd if=/inpt/file of=/output/file/ |
The contents of /dev are files so
Code: | dd if=/dev/hda of=/dev/hdc | copies the content of hda to hdc. If the drives are different sizes, horrible things happen.
Read and understand
A better tool may be dd_recover or you can try the noerror option to dd. Normally, dd exits at the first read error, which is not what you want. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
rafael Apprentice
Joined: 22 Jul 2002 Posts: 267
|
Posted: Wed Jul 27, 2005 7:00 pm Post subject: |
|
|
Thank you very much for your input. There's just one thing that makes me wonder. Why don't I want it to exit on the first read error? Do they occur frequently when dd is handling longer operations, or does it have something to do with the hard drives, that they usually get read errors when operating?
- rafael |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Wed Jul 27, 2005 7:08 pm Post subject: |
|
|
rafael,
You say you have a problem with your drive
If dd fails at the first error all the good data after the first error will not be copied, so you will not achieve the effect you want.
Try dd first and see it it works. If its its ok and copies all your data, then you were lucky.
If dd fails, run it with noerror. That way it will read whatever can be read. Your files may have holes in, unless all the errors are in unallocated space. (dd copies unallocated space too).
If you are forced to use noerror, the filesystem on the copy is damaged. You will need to fsck it with the -f (for force option).
When it completes you will have lots of theings in /lost+found.
Post back if that happens. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
rafael Apprentice
Joined: 22 Jul 2002 Posts: 267
|
Posted: Wed Jul 27, 2005 7:24 pm Post subject: |
|
|
Aha. I guess I managed to somehow figure it out myself after I asked in the thread, but thanks for pointing it out for me. I don't think my filesystem is damaged, as the failure of the disk seems to be completely technical (not software related), but I guess that doesn't stop me from getting other kinds of errors.
I'll do what you said, first with noerror, then if errors occur with noerror and in any case report back so that others can see my results.
- rafael |
|
Back to top |
|
|
rafael Apprentice
Joined: 22 Jul 2002 Posts: 267
|
Posted: Thu Jul 28, 2005 7:59 am Post subject: |
|
|
Reporting back.
After my last reply last night, I ran the following command: Code: | dd if=/dev/input_device of=/dev/output_device |
Since my hard drive is broken (or at least at the werge of it) it was expected that I'd get error messages throughout the process. However, I found the output today early and it didn't seem to contain any error messages at all. The only output that was processed by dd was something, that I think, verified the amount of what was processed. So now I should have a complete mirror of my hard drive.
If I encounter any more problems that has to do with this topic, I'll report back, either asking for help or posting my solution to the problem. If not, this is my last reply to the thread.
Thanks to NeddySeagoon for being so kind and helping me out.
- rafael |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54096 Location: 56N 3W
|
Posted: Thu Jul 28, 2005 4:26 pm Post subject: |
|
|
rafael,
The numbers that dd reported were the number of sectors read and written.
They should both be the amd and both be the size of your drive.
If not, the number is the number of the first sector causing a read error, _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|