LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-23-2013, 01:09 PM   #1
bit_head
LQ Newbie
 
Registered: Dec 2008
Posts: 4

Rep: Reputation: 0
Rebuild RAID1 with LVM


Running on Debian Lenny... in the RAID1 array, sda failed. sdb partitions are:

Code:
# fdisk -l /dev/sdb

Disk /dev/sdb: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          31      248976   fd  Linux raid autodetect
/dev/sdb2              32       91201   732323025   8e  Linux LVM
I replaced sda and created partitions as:

Code:
# fdisk -l /dev/sda

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          31      248976   fd  Linux raid autodetect
/dev/sda2              32       91201   732323025   fd  Linux raid autodetect
Notice the partition types for /dev/sdb2 (8e Linux LVM) and /dev/sda2 (Linux raid autodetect). I wan't sure about the discrepancy and thought perhaps that they would match after remirroring, but they don't. At present the mirrors are clean and the system is running, but now I want to replace /dev/sdb with a new drive which was purchased with the replaceent drive, the current /dev/sda.

My concern is what will happen with the LVM when taking /dev/sdb offline? Here is the pv and vg information:

Code:
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               VG_Name
  PV Size               698.40 GB / not usable 3.12 MB
  Allocatable           yes (but full)
  PE Size (KByte)       4096
  Total PE              178789
  Free PE               0
  Allocated PE          178789
  PV UUID               PV_UUID

~# vgdisplay
  --- Volume group ---
  VG Name               VG_Name
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               698.39 GB
  PE Size               4.00 MB
  Total PE              178789
  Alloc PE / Size       178789 / 698.39 GB
  Free  PE / Size       0 / 0
  VG UUID               VG_UUID
Do I need to do something to get the partition types to match before I break the current mirror in preparation for replacing /dev/sdb? Should I have created /dev/sda2 as a Linux LVM partition, and if I had, would the mirroring still work? I'm in a bit over my head with this one and unfortunately the person who set this all up is not available. What is the best way to proceed from here? Thanks!
 
Old 12-28-2013, 12:42 PM   #2
bit_head
LQ Newbie
 
Registered: Dec 2008
Posts: 4

Original Poster
Rep: Reputation: 0
OK... over 200 reads and 0 replies. And I think I understand why...

Anyone who knows LVM and RAID configs that has read this has become painfully aware that I don't. Or at least I didn't when I posted it. Having spent the last 2+ days building and configuring several RAID1 with LVM VMs, I'm no expert but I have a much better understanding of what it took to put the machine I've inherited together. In my travels I visited a lot of web sites, read several HowTos and watched some videos. In the end, the most valuable document I came across for this is here: http://www.howtoforge.com/how-to-set...debian-squeeze

A few things where lights became brighter..

1) /dev/md0 is the boot partition and is not using LVM
2) /dev/md1 is using LVM and contains /root and the swap partition

I realize 1) and 2) are obvious from the various vl|pv|vgdisplay commands' output, but nothing is really obvious to one trying to learn about setting up LVM and RAID1 together, having not done anything with either of them on Linux before this week. ;-)

3) installing grub on /dev/sda (mapped to hd0) and /dev/sdb (mapped to hd1) may not be sufficient, especially if /dev/sda fails. One must manually setup grub on /dev/sdb - a handy HowTo for this can be found here: http://blog.valqk.com/archives/2009/06.html

What I still don't get, and what prompted me to dig deeper in the first place, is why /dev/sdb2 is shown as type "Linux LVM" instead of "Linux raid autodetect". It is possible that the original /dev/sda2 was configured as the same type - I'll never now as "he's dead, Jim". And now that I know what I know, I also know that it never mattered, at least not with regard to my current need to replace /dev/sdb without shooting myself in the foot while doing so. I've also found that I can change the partition type back and forth between these two, reboot, and the system still works - the only evidence I see of anything changing is when I run 'fdisk -l /dev/sdb'.

So the last 2 days are gone, I've learned a bunch of stuff that it turns out I didn't need to know, yet I still feel good about it. Thanks for listening, and for those that read my original post and moved on without chastising, thanks for moving on.

~bithead

Last edited by bit_head; 12-28-2013 at 12:44 PM. Reason: bad url
 
  


Reply

Tags
lvm, lvm2, mirror, raid1



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lvm ontop of raid10 or combine two raid1 via lvm? okar Linux - Server 3 09-11-2009 02:37 PM
RAID1 array rebuild fails at 99.9% recovery apomatix Linux - Hardware 3 06-06-2008 06:30 AM
Recover/Rebuild SW Raid1? FoxNotch Linux - General 1 07-11-2004 10:04 AM
How to rebuild raid1 on RedHat 9.0 galaxyms Linux - Software 0 10-23-2003 09:38 AM
Soft RAID1 (mirror) rebuild GAVollink Linux - Hardware 4 04-25-2003 08:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:03 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
Open Source Consulting | Domain Registration