2

I have 4TB disk (A) with data in it. Now I've bought a new 4TB disk (B), and I want to start a RAID1 so that B becomes the mirror of A, without loosing data on A. I'm under linux with mdadm tool.

The only guides I've found by googling are referring to a typical situation where both A and B must be initialized and formatted.

Is there a way to do this?

1

This is easy.

  • Make a degraded RAID 1 array with the new/empty drive (Drive B). Set devices to 2.
  • Format new MD array and copy files from Drive A to new MD array.
  • Verify data then delete/empty/format Drive A.
  • Add the now empty Drive A to the MD array and let it sync.
  • Done.
1

If you still have 50% free space on your old disk then you can:

  • create two partitions on your new disk
  • copy the data from your old disk to the second partition on your new disk
  • make the new disk bootable
  • verify that the data that you copied over is OK on the new disk
  • repartion the old disk like the new one
  • make a md1 raid over the first partions on both disk
  • copy the data to the md1 raid
  • make the md1 partition bootable
  • recheck that the data on the md1 raid is OK

BE WARE: you make one mistake and you loose ALL your data

  • possibly - I have not checked - you can then delete the second partition afterwards
  • and grow the md1/first partition to fill up all the space
  • extend the filesystem on it

AGAIN: you do one misstep and your data are dead

  • This is a nice suggestion. One can also take into account compressing data if less than 50% is free. – Jack Dec 16 '17 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.