0

One of the 2 x 500GB drives on server is crashed can read but not write the data, which both are on Hardware RAID 0. So I connected an external 1TB new drive to backup the data and replace those 2 x 500GB.

I just wanna be sure that "dd" can do the job as backup and not clonning.

using below command.

dd if=/dev/sda of=/dev/sdd

Or it is better to use the normal cp commands. I want the fastest and safest way for data backup.

WiTon Nope
  • 46
  • 5
  • To me the safest option is (since there is no redundancy anyway): If it still presents a usable volume from the BIOS. I would boot off a boot stick or CD and copy the data off that way with rsync. Then just replace your drive and recreate the stripe. – Eddie Dunn Dec 02 '15 at 18:40
  • @EddieDunn thank you for you prompt reply. Actually my server is CentOS. I booted it as PXE boot on recovery VLAN loading Debian tools GUI. So you're advising me ot go with rsync rather dd for safety but it is fast to copy 1TB of data? Can you please give me an example command for such process.:) – WiTon Nope Dec 02 '15 at 18:47
  • If you had raid1 or raid5 I would suggest something like Nikita and it might save you some time. You could also dd the volume (but you might run into space issues) which is why I suggested rsync. If you have a 1.5 or 2 TB external then use that and go dd. – Eddie Dunn Dec 02 '15 at 18:50
  • @EddieDunn I have RAID0 not 1or5 I'll try to get 2TB. So to clarify things out dd is faster then rsync however it needs much more space. Rsync is slower and safe and limited to quota given to it, am I correct? As far as I understood from Nikita is to do ddrescue then dd to copy the data replace the old drives and dd the backup data back to the new one. – WiTon Nope Dec 02 '15 at 18:58
  • I realize you have RAID0. I was saying my suggestion would be different if you had redundancy. dd is faster than rsync if you file-system is almost full/ heavily fragmented. If your drive is basically empty rsync will most certainly be faster. dd must have a sector on the target device for every sector on the source device regardless of whether it contains data. rsync jsut copies the data. The advantage of dd is that you can restore with it and you should just be able to boot and go. – Eddie Dunn Dec 02 '15 at 19:01

1 Answers1

0

If you have polluted or heavily fragmented file system, dd will be faster. Generally I will use it.

There is one drawback: on an event of read error your array will break. For software raid it is quite easily solvable, but you need more spare space that one 1Tb drive. And to read faulty drives I prefer ddrescue, it will do the work much faster than dd with conv=noerror,notrunc,sync.

So to minimize risks of data loss in your case, I would dump faulty drive into file by ddrescue, then assemble raid from file and other drive (this is possible with loop device) and then copy/dd from that assembled raid. Or, if you have third 500gb, you could dd faulty drive to third drive, then assemble raid from it and your working drive from former pair.

One more note: for critical data (which I would ever want to rescue) I will never use raid0. It has only use as fast scratchpad, which could be easily thrown away without several losses.

Nikita Kipriyanov
  • 10,947
  • 2
  • 24
  • 45
  • Thank you for the answer, to clarify things out please. You advice me to use 2TB rather then 1TB for dd copy. As mention I have 2x500GB drives RAID0 managed. DDrescue will help me dump faulty without losing data and also will remove the RAID from drives configuration to be easier to copy as if it's a normal 500GB drive copied to 1TB right? ANd the new one as you noted better not to use RAID0. P.S. I didn't fragment the drives and also I forgot to mention they'r LVM configured – WiTon Nope Dec 02 '15 at 19:01
  • No, do not remove raid. You will lose the data. You have to dump drive as it is, with raid metadata, then losetup image and then assemble raid from that loop device and the other drive. Linux mdadm happily accept this configuration, it would be slower but will work. Then you can copy data from assembled raid. If we talk about 2Tb drive and 500 gb image lying there, you will probably need to use cp. – Nikita Kipriyanov Dec 02 '15 at 19:13