LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-13-2014, 12:25 PM   #1
eRJe
Member
 
Registered: May 2005
Location: Netherlands
Distribution: Slackware 14.1 Kernel 3.12.1
Posts: 103

Rep: Reputation: 16
restore lost LVM on md0 (1 PVs marked as missing)


I had to restore md0 which has a raid5 array configured due to a mix up in the sdX order. When I had it restored (it did a rebuild), I could not get LVM to locate the PV and/or LV's on the array.

Code:
#mdadm --examine --scan /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1
ARRAY /dev/md/0  metadata=1.2 UUID=984c1863:6972d400:55aa72ac:f6b089e2 name=RJ-Server:0

#mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Sun Jan 12 21:55:53 2014
     Raid Level : raid5
     Array Size : 2929886208 (2794.16 GiB 3000.20 GB)
  Used Dev Size : 976628736 (931.39 GiB 1000.07 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Mon Jan 13 01:00:49 2014
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 64K

           Name : RJ-Server:0  (local to host RJ-Server)
           UUID : 984c1863:6972d400:55aa72ac:f6b089e2
         Events : 39

    Number   Major   Minor   RaidDevice State
       0       8       49        0      active sync   /dev/sdd1
       1       8       65        1      active sync   /dev/sde1
       2       8       81        2      active sync   /dev/sdf1
       4       8       97        3      active sync   /dev/sdg1

#vgcfgrestore r5disk1vg
  Couldn't find device with uuid qlYT5y-TiqU-US31-TI6n-9FQT-wZUO-FdATKK.
  Cannot restore Volume Group r5disk1vg with 1 PVs marked as missing.
  Restore failed.
Will my best chance be to do

Code:
# pvcreate --uuid 984c1863:6972d400:55aa72ac:f6b089e2 /dev/md0
And retry to restore the vg with vgcfgrestore r5disk1vg?
 
Old 01-14-2014, 08:55 AM   #2
kbscores
Member
 
Registered: Oct 2011
Location: USA
Distribution: Red Hat
Posts: 259
Blog Entries: 9

Rep: Reputation: 32
Unless you have the restore file already or there is partial metadata it probably won't work. It will most likely turn out that you need to recreate the lvm structure and restore data from a backup.

Now - There is a chance that you can create a meta data file from another disk and use a hex editor to change the values within the file....however I do not recommend this because it is incredibly easy to overwrite data if you are off even a little bit.
 
Old 01-14-2014, 10:39 AM   #3
eRJe
Member
 
Registered: May 2005
Location: Netherlands
Distribution: Slackware 14.1 Kernel 3.12.1
Posts: 103

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by kbscores View Post
Unless you have the restore file already or there is partial metadata it probably won't work. It will most likely turn out that you need to recreate the lvm structure and restore data from a backup.
I have the restore file, asuming you talking about the bcakup file that is in /etc/lvm/backup. It looks like this:

Code:
# Generated by LVM2 version 2.02.100(2) (2013-08-13): Sun Dec  1 21:07:35 2013

contents = "Text Format Volume Group"
version = 1

description = "Created *after* executing 'vgdisplay'"

creation_host = "RJ-Server"     # Linux RJ-Server 3.12.1-eRJe #1 SMP Wed Nov 27 23:01:45 CET 2013 x86_64
creation_time = 1385928455      # Sun Dec  1 21:07:35 2013

r5disk1vg {
        id = "0WtcH9-QqHK-uB7H-oLOC-HuRm-VQ0G-eaUlNq"
        seqno = 32
        format = "lvm2" # informational
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0
        metadata_copies = 0

        physical_volumes {

                pv0 {
                        id = "qlYT5y-TiqU-US31-TI6n-9FQT-wZUO-FdATKK"
                        device = "/dev/md0"     # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 5860559232   # 2.72904 Terabytes
                        pe_start = 384
                        pe_count = 715400       # 2.72903 Terabytes
                }
        }

        logical_volumes {

                datalv {
                        id = "5xMXsN-7xk9-S8xn-aeMN-BX8u-zw8s-xViiZs"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        segment_count = 1

                        segment1 {
                                start_extent = 0
                                extent_count = 51200    # 200 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 0
                                ]
                        }
                }

                auvilv {
                        id = "zKcZxp-lQCY-gxfc-WyJW-BHyL-mZS4-atLOl6"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        segment_count = 1

                        segment1 {
                                start_extent = 0
                                extent_count = 524288   # 2 Terabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 51200
                                ]
                        }
                }
        }
}
My command I posted earlier is probably wrong and should have been this:
Code:
# pvcreate --uuid qlYT5y-TiqU-US31-TI6n-9FQT-wZUO-FdATKK /dev/md0
Since this is the UUID that is expected by this file?
And now I'm also wondering if I have to change the backupfile too, to match the correct UUID
Code:
r5disk1vg {
        id = "0WtcH9-QqHK-uB7H-oLOC-HuRm-VQ0G-eaUlNq"
Your help is very much appreciated! Thanks!

Last edited by eRJe; 01-14-2014 at 10:42 AM.
 
Old 01-14-2014, 07:01 PM   #4
eRJe
Member
 
Registered: May 2005
Location: Netherlands
Distribution: Slackware 14.1 Kernel 3.12.1
Posts: 103

Original Poster
Rep: Reputation: 16
I did the pv restore by doing the following (maybe it is of any help for someone in the future but be aware, I did not get my data back!):

Code:
root@RJ-Server:/etc/lvm/archive# pvdisplay
root@RJ-Server:/etc/lvm/archive# blkid | grep /dev/md0
root@RJ-Server:/etc/lvm/archive# file -s /dev/md0
/dev/md0: data

root@RJ-Server:/etc/lvm/archive# pvscan
  No matching physical volumes found

root@RJ-Server:/etc/lvm/archive# vgscan
  Reading all physical volumes.  This may take a while...
  No volume groups found

root@RJ-Server:/etc/lvm/archive# vgcfgrestore r5disk1vg
  Couldn't find device with uuid qlYT5y-TiqU-US31-TI6n-9FQT-wZUO-FdATKK.
  Cannot restore Volume Group r5disk1vg with 1 PVs marked as missing.
  Restore failed.

root@RJ-Server:/etc/lvm# pvcreate --uuid "qlYT5y-TiqU-US31-TI6n-9FQT-wZUO-FdATKK" --restorefile /etc/lvm/archive/r5disk1vg_00000-319877250.vg /dev/md0
  Couldn't find device with uuid qlYT5y-TiqU-US31-TI6n-9FQT-wZUO-FdATKK.
  Physical volume "/dev/md0" successfully created

root@RJ-Server:/etc/lvm# pvscan
  PV /dev/md0                      lvm2 [2.73 TiB]
  Total: 1 [2.73 TiB] / in use: 0 [0   ] / in no VG: 1 [2.73 TiB]

root@RJ-Server:/etc/lvm# vgscan
  Reading all physical volumes.  This may take a while...
  No volume groups found

root@RJ-Server:/etc/lvm# vgcfgrestore r5disk1vg
  Restored volume group r5disk1vg

root@RJ-Server:/etc/lvm# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "r5disk1vg" using metadata type lvm2

root@RJ-Server:/etc/lvm# lvscan
  inactive          '/dev/r5disk1vg/datalv' [200.00 GiB] inherit
  inactive          '/dev/r5disk1vg/auvilv' [2.00 TiB] inherit

root@RJ-Server:/dev# lvs -a -o +devices
  LV     VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert Devices
  auvilv r5disk1vg -wi-------   2.00t                                              /dev/md0(51200)
  datalv r5disk1vg -wi------- 200.00g                                              /dev/md0(0)

root@RJ-Server:/dev# vgchange -a y
  2 logical volume(s) in volume group "r5disk1vg" now active
Unfortunately I can not mount the lv's. I guess that during the array restore, something went wrong and corrupted more then just the LVM data...

Code:
root@RJ-Server:/dev# mount /dev/r5disk1vg/datalv /mnt/data/
mount: block device /dev/mapper/r5disk1vg-datalv is write-protected, mounting read-only
NTFS signature is missing.
Failed to mount '/dev/mapper/r5disk1vg-datalv': Invalid argument
The device '/dev/mapper/r5disk1vg-datalv' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
The filesystem is Reiserfs. reiserfsck /mnt/data/ or reiserfsck --rebuild-sb /mnt/data/ did not execute.

Code:
root@RJ-Server:/mnt#  reiserfsck --rebuild-sb /mnt/data/
reiserfsck 3.6.23 (2009 www.namesys.com)

*************************************************************
** If you are using the latest reiserfsprogs and  it fails **
** please  email bug reports to reiserfs-list@namesys.com, **
** providing  as  much  information  as  possible --  your **
** hardware,  kernel,  patches,  settings,  all reiserfsck **
** messages  (including version),  the reiserfsck logfile, **
** check  the  syslog file  for  any  related information. **
** If you would like advice on using this program, support **
** is available  for $25 at  www.namesys.com/support.html. **
*************************************************************

Will check superblock and rebuild it if needed
Will put log info to 'stdout'

Do you want to run this program?[N/Yes] (note need to type Yes if you do):Yes
bread: Cannot read the block (2): (Is a directory).
reiserfs_open: bread failed reading block 2
bread: Cannot read the block (16): (Is a directory).
reiserfs_open: bread failed reading block 16

reiserfs_open: the reiserfs superblock cannot be found on /mnt/data/.
rebuils_sb: cannot open device /mnt/data/
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shrink partition (LVM encrypted PVs + encrypted LVs) gedaj Linux - Newbie 2 05-22-2013 04:44 AM
LVM pvs is showing /dev/dm-x as PV name instead of /dev/mapper n0rus Linux - Enterprise 3 08-05-2012 01:12 PM
what does "Wiping cache of LVM-capable devices" mean in pvs? GenericLinuxUser Linux - Newbie 4 04-30-2012 02:09 PM
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 12:16 PM
Is there a way to resize PVs in LVM 1.0.8? Ken-ji Linux - Software 0 02-12-2006 10:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:20 AM.

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