Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to convert a non-raid linux system to RAID1, using two new disks. I would like to do this with minimal downtime.

Rather than adding the disks and shutting down to single user mode to copy data over is there any way to do this conversion while the system is running, with just a few short outages to install the new disks/remove the old ones?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

This is something I need to be doing in the very near future. It should go something like this:

  1. Shutdown and install new drives

  2. Partition and create RAID array

  3. Rsync data across

  4. Rsync again

  5. drop to single user

  6. rsync again

  7. Set up boot loader

  8. Reboot into new drives

  9. Once you're happy, remove old drive

This does involve two or three reboots and you will have some downtime while you do the second rsync, but hopefully it won't take too long. You should have an idea of how long the rsync during the downtime by timing how long the second rsync took. The second rsync should catch up with files modified during the first rsync. Try to leave as little time as possible between the second rsync and dropping to single user. This reduces the amount of data the third rsync needs to do.

share|improve this answer
add comment

If you are using LVM you can use the "pvmove" command.

I haven't tested this, so the first thing you almost certainly want to do is to set up a test system that is like your system is set up now, and then go through your planned procedure to verify that it works as you'd like and flesh out the details.

It would look something like this:

  1. Create the RAID array as normal.
  2. Use "pvcreate" to turn it into a physical volume.
  3. Use pvmove to move the LVM to the RAID array. (Fully read the pvmove man page to understand its limitations)
  4. Remove the non-RAID pv from the LV.
  5. Move /boot over to the new drives (probably via another RAID-1 array)
  6. Update the boot loader config and put the boot loader on both drives.
  7. Make sure the initrd has the appropriate RAID modules.
  8. Reboot and test.

Note: there is an issue with pvmove that may cause it to deadlock when doing pvmove on the root partition.

Give that a shot to see if it works.

Sean

share|improve this answer
add comment

If you don't care about losing changes to files modified during the copy period and you are using LVM with the current disks, then you can create a snapshot of the current disk and make the copy while the system is online. Any change made to the system since the moment the snapshot is created will not be transfered to the new disks.

If you don't use LVM, or if you can't lose any changes made to the current system, then a nice way to minimize the downtime is to use rsync do the copy: run it first while the system is running, and then after the copy is done log into single user mode and run rsync again. This time it will only copy files that were changed since the first rsync you ran, so it should be much quicker.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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