3

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?

Jack
  • 525
  • 1
  • 5
  • 13

2 Answers2

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
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.
Damon
  • 429
  • 2
  • 12
  • Correct. I found this complete guide, thanks: https://debian-administration.org/article/238/Migrating_To_RAID1_Mirror_on_Sarge – Jack Dec 19 '17 at 10:35