LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Recover Raid+LVM on non system drives after system failure (http://www.linuxquestions.org/questions/linux-general-1/recover-raid-lvm-on-non-system-drives-after-system-failure-857366/)

spindley 01-19-2011 03:19 PM

Recover Raid+LVM on non system drives after system failure
 
I have (had) Debian Testing running on a 250GB IDE hard drive, partitioned normally.

I also have 4x 1TB drives in a raid 5 using mdadm, and 2x 500GB drives in a raid 1 also with mdadm. I put the two arrays in lvm using:

# pvcreate /dev/md0 /dev/md1
# vgcreate storage /dev/md0 /dev/md1

I then used "lvcreate" to make storage/backup 300GB, and the rest went to storage/media (approx. 2TB usable). I put an xfs filesystem on both and mounted them.

All was working fine until the system drive shorted out and died on me this morning. As far as I can tell, all my other drives and everything else is fine. I do a daily rsnapshot of the filesystem, which of course is residing on storage/backup (stupid, I know). So I have full backups of everything, but I'll have to put a new hard drive in and reinstall Debian before I can restore everything.

I've reinstalled before and simply reassembled mdadm arrays and remounted them before with no problems, but this is the first time I've used lvm, so I'm not sure what I have to do to restore everything. Is it as simple as reinstalling the system then doing a:

# mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
# mdadm --assemble /dev/md1 /dev/sdf1 /dev/sdg1
# vgchange -a y

I've googled and didn't have a whole lot of luck figuring out if that last command is the right one, but is that what I would need to do to restore/recreate the lvm? Any advice would be appreciated.

Mike

xeleema 01-19-2011 03:24 PM

Greetingz!

I've been in your shoes before; during my experience (RHEL5), the OS will notice the RAID arrays on boot, then it will do a "vgscan" (I think).
I swear I was never more impressed when an LVM-managed 4x1TB RAID10 array came online of it's own accord!

However, it's been *ages* since I've done anything with Debian, but I'd assume it would have evolved enough startup scripts to detect and setup the RAID arrays (at the very least).
You might want to check the "vgscan" manpage though.

Good Luck!

spindley 01-19-2011 03:46 PM

Quote:

Originally Posted by xeleema (Post 4230659)
Greetingz!

I've been in your shoes before; during my experience (RHEL5), the OS will notice the RAID arrays on boot, then it will do a "vgscan" (I think).
I swear I was never more impressed when an LVM-managed 4x1TB RAID10 array came online of it's own accord!

However, it's been *ages* since I've done anything with Debian, but I'd assume it would have evolved enough startup scripts to detect and setup the RAID arrays (at the very least).
You might want to check the "vgscan" manpage though.

Good Luck!

Thanks for the quick reply. I guess I'll have to just grab a new hdd and reinstall and see what happens. Assuming that vgscan isn't part of the boot process (and I honestly don't know if it is or not), I should just be able to run that command once the arrays are rebuilt and md0 and md1 exist again?

Thanks again.
Mike

xeleema 01-19-2011 04:02 PM

Quote:

Originally Posted by spindley (Post 4230691)
Assuming that vgscan isn't part of the boot process (and I honestly don't know if it is or not), I should just be able to run that command once the arrays are rebuilt and md0 and md1 exist again?

Technically yes. However there is one thing you should keep in mind; How will the OS install affect the RAID array?
If I were you, I would label the drives and the data connections (SATA cables or IDE ribbons), then disconnect them before you do the OS install.

spindley 01-19-2011 04:18 PM

Quote:

Originally Posted by xeleema (Post 4230711)
Technically yes. However there is one thing you should keep in mind; How will the OS install affect the RAID array?
If I were you, I would label the drives and the data connections (SATA cables or IDE ribbons), then disconnect them before you do the OS install.

The Debian install is quick and basic, and the partitioner is easy to understand. But yes, disconnecting the raid/lvm drives during install is a good practice. My only concern is that the lvm would be detected and restored once the arrays were reassambled, and of course that the data is still there.

Mike


All times are GMT -5. The time now is 08:14 AM.