I have a server that consists of a boot drive, then two data drives combined to a RAID1 linux array. My boot drive recently became corrupted and I need to re-install the operating system. The RAID1 data array is fine, and I would like to just import it once the operating system is installed. (The data array is just a big LVM setup in a volume group)

What steps should I go through to import the volume group, and LVM within the array? Google has been surprisingly unhelpful for this.

Thanks in advance


Maybe you can try to follow the recipe for moving volumes in the LVM Howto? Of course you'll skip a few steps there.

| improve this answer | |
  • I'm accepting this answer. I removed the RAIDed disks during install just to make sure they were not messed with, then put them back in after the OS install was finished, and the the RAID array was automatically visible. The volume export/import was a critical step in the progress that I would have missed, but it worked perfectly – John P Aug 1 '11 at 14:06

What distribution is this?

You will need to enable lvm and dm at boot - as said, lots of dists will do this automatically, but Opensuse does not for example. How you ensure these are enabled at boot are distro dependent.

You say that the raid1 is fine, so you'll need to assemble it:

mdadm --assemble --scan --auto=yes /dev/md0 

Once you have the array up and running, recreate your mdadm.conf:

/sbin/mdadm --examine --scan >> /etc/mdadm/mdadm.conf

Then restart lvm - this is a bit distro dependent too - but

/etc/init.d/lvm2 restart

is the debian way

This should scan your volume groups and find the logical volumes.

Note that vgscan should be enough to find them and find the lvs, and then

lvdisplay -C

Gives you a compact list of volumes.

| improve this answer | |

Practically all modern Linux installers will detect presence of your data drives RAID and an LVM group on them. You'll need just to choose mount points for logical volumes and remember not to format them, which, at least for Fedora, is the default.

If you decide to disconnect your data drives during installation and reconnect on OS boot, your RAID and LVM should be auto-detected too. You'll need to look up devices created in /dev/ and edit your fstab accordingly.

| improve this answer | |
  • It is not a mountable partition - it is a LVM which I have in a volume group. I don't think that can be addressed in the loader – John P Aug 1 '11 at 6:12
  • If by loader you mean bootloader, it needs access only to your /boot partition. Root file system on LVM is supported for a long time. If by loader you mean installer, then yes, all modern installers will work just fine. And LVM volume is just another block device. If it contains a file system it can be mounted. /dev/sda1 or /dev/vgname/lvname, what's the difference? :) – Paweł Brodacki Aug 1 '11 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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