0

I am rebuilding my Ubuntu home server, but I want to preserve my two disks currently in Linux software RAID 1.

My current config is:

One 240GB HDD configured as OS Disk (Ubuntu 12.04 LTS) Two 3TB WD Reds configured as Linux RAID 1 - contains home files, pictures, videos, backups, etc

For a number of reasons, I need to re-build the system on a new OS Disk with Ubuntu 14.04.1 LTS, which will be a 240GB SSD. With the new system, is there a way to mount the two RAID drives without (a) losing data and (b) needing to rebuild the RAID array?

Thanks!

2 Answers 2

2

Based on David Foerster's answer, I moved forward. I was able to successfully migrate the RAID volume. One detail that complicated the move was that I had the RAID array as part of the LVM Group. So once I had the new system re-built, the RAID array was recognized, but I was unable to mount any of the LVMs.

I ended up having to use vgexport/vgimport to export and import the volume group. It is a good thing I was installing to a new OS Disk, meaning I still had my old OS disk, which allowed me to revert back and properly export LVMs. The procedure I followed is here on tldp.org(except this is missing the deactivation and reactivation of logical volumes).

My original configuration was:

  1. 2x3TB Disks in Linux RAID1 with a single Ext4 partition for file storage data (no OS).
  2. 3TB RAID array added as the sole device within volume: /dev/NASRaid1/NAS_LVM
  3. /dev/NASRaid1/NAS_LVM mounted to filesystem as /nfs

Steps taken to export and import the volume were:

  1. Unmount filesystem(s): unmount /nfs (I also had an export mirror for a Samba share that I had to un-mount as well)
  2. Deactivate logical volume(s): lvchange -an /dev/NASRaid1/NAS_LVM
  3. Deactivate volume group: vgchange -an NASRaid1
  4. Export the volume group: vgexport NASRaid1
  5. Add RAID Array to new system and boot up. Running pvscan lists the exported volume group(s).
  6. Import the volume group: vgimport NASRaid1
  7. Activate the volume group: vgchange -ay NASRaid1
  8. Activate the volume(s): lvchange -ay /dev/NASRaid1/NAS_LVM
  9. Mount the filesystem(s): mkdir -p /nfs; mount /dev/NASRaid1/NAS_LVM /nfs

Worked like a charm.

1

mdadm stores all the necessary info to reassemble a RAID in the volume header. As soon as you configure it correctly in your new system it should pick up the existing volumes.

You must log in to answer this question.

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