LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 01-19-2011, 04:19 PM   #1
spindley
Member
 
Registered: Mar 2003
Location: Calgary, AB Canada
Distribution: Slackware 14.0
Posts: 32

Rep: Reputation: 15
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
 
Old 01-19-2011, 04:24 PM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
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!
 
Old 01-19-2011, 04:46 PM   #3
spindley
Member
 
Registered: Mar 2003
Location: Calgary, AB Canada
Distribution: Slackware 14.0
Posts: 32

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by xeleema View Post
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
 
Old 01-19-2011, 05:02 PM   #4
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
Quote:
Originally Posted by spindley View Post
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.
 
Old 01-19-2011, 05:18 PM   #5
spindley
Member
 
Registered: Mar 2003
Location: Calgary, AB Canada
Distribution: Slackware 14.0
Posts: 32

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by xeleema View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File system corrupted, how to move LVM drives to another machine to recover files? Arodef Linux - Hardware 1 08-07-2009 07:19 PM
Software Raid with LVM and Live System Partitions centos82 Linux - Software 4 11-13-2008 11:59 AM
HD Failure in LVM - What can I recover? vaaccess Linux - General 1 01-05-2007 02:22 PM
LVM + RAID-1 on FC5 running system randolpholiveira Linux - Server 0 10-12-2006 09:17 AM
Recover file in RAID 5 system using autopsy hardian_97 Linux - Software 0 07-18-2006 02:24 AM


All times are GMT -5. The time now is 11:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration