# Syncing two mdadm raid partitions

## Sarenka

Hi,

I`m using mdadm software raid on my machine (RAID10 to be exact).

Now I`d like to change partition layout (current was created quite a few years back and recently became insufficient). Only problem is that I have to do this "on the fly".

I`ve added two extra drives and created on them exact copy of partitions layout which is based on RAID1 madam.

Now I`m looking for a way two sync those two sets (ex. currently I have /home on /dev/md6 which is RAID10 and a prepared /dev/md16 on two new disks which is RAID1) and next to remount two temporary RAID1 arrays (and, after changing layout, move everything back to RAID10).

In another words:

Currently i have for disks - /dev/sd[a-d] which are still working in a config made on old 40GB drives based on RAID10 arrays (but,. after years they are in fact 500GB drives).

I have two drives - /dev/sd[ef] with mirror of partition layout from /dev/sd[a-d].

What I want to do is to copy "on-the-fly" from /dev/sd[a-d] to /dev/sd[e-f], change size of partitions on /dev/sd[a-d] and move data back to on them.

And I`d like to minimize downtime, because partitions which I want to move are /var and /home and the box is acting as a small virtual hosting.

----------

## NeddySeagoon

Sarenka,

You will have to make the source partitions read only for the duration of the copies.

Thats will be ok provided only root is logged in.

Making /var read only is probaby not possible as the system writes logs and lock files there.

You could reboot to put /var in /dev/shm ... so its in RAM, then mount the real /var that you want to save somewhere else for the copy.

----------

## Anarcho

You might even consider using unionfs for mounting a transparent tmpfs over the /var mountpoint.

Then you can copy the input from the original /var (which should be ro mounted then) while the system can still use the /var partition because it is overlayed with a unionfs/tempfs.

----------

