All the posts I've found are about moving to new machines or migrating an entire OS from one HDD to another. I don't really know what the hell I'm doing, but I'm apparently the Linux expert.

We currently have a 1TB server with a RAID configuration. I'm not sure what type of RAID, yet. We will need to expand our HDD space in the next few months, and doubling the current size will buy us a few years at our current rate of data use.

The existing RAID is currently at /dev/md1 and we keep all of the files in question at /srv/Data.

What we would like to do is migrate this Data directory to a new 2TB RAID 1 setup and ideally keep the same mount point so that we don't have to change anything in our database. That is, we would like to move the existing data to this new set of HDDs but still call it /srv/Data so that we can start writing to it immediately without changing much on our software side.

Would this be as simple as mounting the new RAID device (presumably /dev/md2) as /srv/Data and copying the existing Data over?

  • Depending on the RAID type, this may even be possible with no service interruption. Check the mdadm manual once you know what type of RAID it is. Commented Jun 11, 2015 at 22:15

2 Answers 2


Mount /dev/md2 first as something like /srv/DataNew, run a 1st round of copy as root (actually I'd suggest rsync, IMHO it's better for this kind of job):

rsync -a --delete /srv/Data/ /srv/DataNew

Optionally you can re-run the cmd - the 2nd execution should be faster (rsync is capable of skipping files already copied and up2date) and will give you a rough duration to use in estimating how much time you need to bring down the apps using the partition for the actual partition switch - see below.

Then temporarily stop and disable your applications using the /srv/Data partitions (maybe even reboot to ensure no transients writes that can lead to loss of data, making sure the apps are not restarting at boot) and repeatedly re-run the same rsync cmd above as root to update the new partition with any changes that may have happened in the old partition since the previous rsync execution.

It may take a few re-runs until the rsync cmd shows no more updates - which means the 2 partitions are in sync. Each such re-run will be taking rougly the amount of time of the 2nd execution mentioned above, if you opted for it

Then unmount /srv/Data and /srv/DataNew and modify the /etc/fstab file to mount /dev/md1 under /srv/DataOld and /dev/md2 under /srv/Data.

Then mount /srv/Data (and /srv/DataOld if you want to run yet another sync check) or optionally reboot if you like instead and the system should come up with the new partition in place.

If you want you can run another rsync check, this time with a slightly modified cmd for the new mount points (it should show no updates if there were no transient accesses):

rsync -a --delete /srv/DataOld/ /srv/Data

Now you can re-enable and re-start your apps which should not notice any difference (except for the extra disk space).

Finally, if no longer need it you can unmount /srv/DataOld and remove its entry from /etc/fstab - you're done.

If you didn't use rsync before you may want to dry-run the rsync portions but with some temporary/test dirs and as source some smaller dir which doesn't typically change (to not have uncontrolled transients which can't be avoided unless you stop the apps) just to get used to its operation, you can use the new partition once mounted, since it's empty:

mkdir /srv/DataNew/rsync_test
rsync -a --delete /some_smaller_dir /srv/DataNew/rsync_test

simulate a transient deleting a file in /srv/Data/some_smaller_dir:

touch /srv/DataNew/rsync_test/deleted_file_equivalent
ls -la /srv/DataNew/rsync_test/deleted_file_equivalent

next rsync should find and delete that file in the new dir (and maybe other transients?):

rsync -a --delete /srv/Data/some_smaller_dir /srv/DataNew/rsync_test
ls -la /srv/DataNew/rsync_test/deleted_file_equivalent

next rsync should not find the deleted_file_equivalent anymore (repeat if other uncontrolled transients show up):

rsync -a --delete /srv/Data/some_smaller_dir /srv/DataNew/rsync_test

Finally remove the test dirs:

rm -rf /srv/DataNew/rsync_test
  • You're making the data transfer way more complicated than it needs to be. Run rsync over a weekend to make a first copy of the data. Then announce half an hour of maintenance, switch to single user mode, run rsync a second time to take care of the few files changed in the mean time, switch the mount points, switch back to multi-user, and head for the pub.
    – lcd047
    Commented Jun 11, 2015 at 3:49

In a word, yes. More specifically, you need to mount the new array somewhere else ( can't mount two things in the same place ), copy the files, unmount both, then set your system to mount the new raid in that location ( edit /etc/fstab ).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .