[CentOS] recover lvm from pv

Fri Mar 8 16:17:11 UTC 2013
Harold Pritchett <harold at uga.edu>

On 3/8/2013 10:08 AM, SilverTip257 wrote:
> On Fri, Mar 8, 2013 at 9:37 AM, Robert Moskowitz <rgm at htt-consult.com>wrote:
>
>> On 03/08/2013 09:21 AM, Harold Pritchett wrote:
>>> On 3/8/2013 8:57 AM, Robert Moskowitz wrote:
>>>> On 03/08/2013 08:07 AM, SilverTip257 wrote:
>>>>> On Thu, Mar 7, 2013 at 10:54 PM, Harold Pritchett <harold at uga.edu>
>> wrote:
>>>>>> On 3/7/2013 10:10 PM, Stephen Harris wrote:
>>>>>>> On Thu, Mar 07, 2013 at 09:54:59PM -0500, Harold Pritchett wrote:
>>>>>>>> What other information do I need which may be available?
>>>>>>> What does 'vgscan' say?  'vgchange -a y' ?
>>>>>>>
>>>>>> [root at mickey www]# vgscan
>>>>>>        Reading all physical volumes.  This may take a while...
>>>>>>        Found volume group "VolGroup00" using metadata type lvm2
>>>>>>
>>>>> Do both Volume Groups on those two sets of disks have the same name?
>>>>>      VolGroup00
>>>> This is all to common an issue.  I make a point that all LVMs are
>>>> uniquely named.
>>>>
>>> Actually, no.  The VolGroup00 name is associated with the running
>> system.  It's the default name when you install CentOS with the default
>> option.  The vol group on the other disks
>>> is "vg0" and is the name I used when I created the system several years
>> ago.
>>
>> I would have expected that to show as a result of the vgscan and
>>
> I would have expected the same after vgchange.
>
>
>> vgchange commands.  Does RAID change things wrt LVM appareance to the
>> system?
>>
> No.

OK, I have just written off the disks as corrupt.  I put in another pair with yet another raid LV on them.  This time I was able to successfully mount the data.

Something like this:

After assembling the raid array from the two disks with

mdadm --assemble /dev/md125 /dev/sdc3 /dev/sdd3

[root at mickey ~]# cat /proc/mdstat
Personalities : [raid1]
md125 : active raid1 sdc3[0] sdd3[1]
       2925020024 blocks super 1.0 [2/2] [UU]
       [=>...................]  resync =  8.5% (249426816/2925020024) finish=357.5min speed=124707K/sec

unused devices: <none>

[root at mickey ~]# vgscan
   Reading all physical volumes.  This may take a while...
   Found volume group "rvg" using metadata type lvm2
   Found volume group "VolGroup00" using metadata type lvm2

[root at mickey ~]# vgchange -a y
   10 logical volume(s) in volume group "rvg" now active
   2 logical volume(s) in volume group "VolGroup00" now active

[root at mickey ~]# pvscan
   PV /dev/md125   VG rvg          lvm2 [2.72 TB / 1.66 TB free]
   PV /dev/sda2    VG VolGroup00   lvm2 [465.66 GB / 0 free]
   PV /dev/sdb1    VG VolGroup00   lvm2 [465.75 GB / 0 free]
   Total: 3 [3.63 TB] / in use: 3 [3.63 TB] / in no VG: 0 [0   ]

[root at mickey ~]# lvscan
   inactive          '/dev/rvg/lv00' [1.00 GB] inherit
   inactive          '/dev/rvg/lv08' [10.00 GB] inherit
   inactive          '/dev/rvg/lv09' [1000.00 GB] inherit
   inactive          '/dev/rvg/lv04' [20.00 GB] inherit
   inactive          '/dev/rvg/lv03' [2.00 GB] inherit
   inactive          '/dev/rvg/lv02' [4.00 GB] inherit
   inactive          '/dev/rvg/lv06' [40.00 GB] inherit
   inactive          '/dev/rvg/lv07' [10.00 GB] inherit
   inactive          '/dev/rvg/lv01' [5.00 GB] inherit
   inactive          '/dev/rvg/lv05' [512.00 MB] inherit
   ACTIVE            '/dev/VolGroup00/LogVol00' [925.75 GB] inherit
   ACTIVE            '/dev/VolGroup00/LogVol01' [5.66 GB] inherit

[root at mickey ~]# ls /dev/rvg
lv00  lv01  lv02  lv03  lv04  lv05  lv06  lv07  lv08  lv09

[root at mickey ~]# mount /dev/rvg/lv00 /mnt

[root at mickey ~]# ls /mnt
big   dev   lib         media  opt   sbin     sys       usr
bin   etc   lib64       misc   proc  selinux  tftpboot  var
boot  home  lost+found  mnt    root  srv      tmp

[root at mickey ~]#