Mdadm/ZFS RAID question

Rashkae ubuntu at tigershaunt.com
Wed Nov 11 22:39:19 UTC 2015


On 15-11-11 03:46 AM, Petter Adsen wrote:
> I have a 3TB disk with a lot of data that I would like to put in a RAID
> for a little extra security. What I'm wondering is: is it possible to
> buy a new disk, set up that disk as a degraded RAID, populate it with
> data and then add the old disk to the mirror and have it synced from
> the new disk?
>
> Can either ZFS or mdadm do this, or will I need another disk to hold
> the data and set up the whole mirror at once? I know btrfs can do this,
> but I don't quite trust it with that particular set of data.
>
> Petter
>

Just spitting this out from the top of my head without verifying, so 
will prbably have a mistake, but mdadm command would look something like 
this:

Assuming new drive is initialized, with a single unformated partitition. 
(substitute x and y with the correct device names.)

mdadm --create /dev/md0 -l 1 -n 2 /dev/sdx1 missing  (Create a degraded 
Raid 1 mirror)

create a filesystem on /dev/md0

Mount /dev/md0 and copy data to it.

Verify the smart status of the new drive, I would probably also 
recommend making another backup of the data at this point.

Erase the old drive, it might be best to zero it, but that would take a 
long time on 3TB, create a new, unformated partition.

mdadm -add /dev/md0 /dev/sdy1


2 days later when the array has finished synchronizing, (a slight 
exageration, but only just.)

mdadm --grow /dev/md0 --bitmap=internal

A word of caution,  If you're rebooting at any time in the process, 
especially while adding / removing drives, it's a good idea to take a 
moment and verify the hard drive sn's (ls -l /dev/disk/by-id/ ) to make 
certain the BIOS or kernel haven't chagned the device names between 
boots.  I learned that habit the hard way.)







More information about the ubuntu-users mailing list