Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Someone handed me a drive that used to be part of a RAID 1 (mirror) array. The drive apparently has LVM (1?) on it and EXT3 (I believe). What steps can I take to regain access to this drive?

Additional info:

  • The drive was a RAID array from a circa Fedora 6 system, so I'm assuming that it was of the era that it was still using LVM1 and EXT3.
  • I only have 1/2 of the RAID.
  • Drive is USB based. My current Fedodra 14 system is able to identify the drive fine (/dev/sdb1) and I can run commands such as:

    $ mdadm -A --force /dev/md2 /dev/sde1
    $ mdadm --detail /dev/md2
    

    The first seems to have added the array device onto my system since I can successfully run the 2nd command which show the array as clean, but in a degraded state (as expected).

    $ mdadm --detail /dev/md2
    /dev/md2:
            Version : 0.90
      Creation Time : Mon Jan 15 15:20:44 2007
         Raid Level : raid1
         Array Size : 156288256 (149.05 GiB 160.04 GB)
      Used Dev Size : 156288256 (149.05 GiB 160.04 GB)
       Raid Devices : 2
      Total Devices : 1
    Preferred Minor : 2
        Persistence : Superblock is persistent
    
        Update Time : Fri Sep 27 16:50:13 2013
              State : clean, degraded
     Active Devices : 1
    Working Devices : 1
     Failed Devices : 0
      Spare Devices : 0
    
               UUID : 0266bb35:6fcac8b4:12f56e39:0f78dafb
             Events : 0.19624
    
        Number   Major   Minor   RaidDevice State
           0       8       65        0      active sync   /dev/sde1
           1       0        0        1      removed
    

I'm getting stuck when I attempt to bring the LVM pieces back up.

EDIT #1: Follow-up Questions

  1. What does the command file -s /dev/{sde1,md2} yield?

    $ file -s /dev/{sde1,md2}
    /dev/sde1: LVM2 (Linux Logical Volume Manager) , UUID: ZK8IfBzUHPH5befvm5CZ81oIXHm11TG
    /dev/md2:  LVM2 (Linux Logical Volume Manager) , UUID: ZK8IfBzUHPH5befvm5CZ81oIXHm11TG
    
  2. What does the command vgscan yield?

    $ vgscan
      Reading all physical volumes.  This may take a while...
      Found volume group "kodak_vg" using metadata type lvm2
    
  3. Is there a physical LVM volume on /dev/md2?

    Yes there is a physical LVM volume on the RAID array /dev/md2.

  4. What does pvs yield?

    $ pvs
       PV         VG         Fmt  Attr PSize   PFree
       /dev/md2   kodak_vg   lvm2 a--  149.00G    0 
    
  5. Is there an encrypted partition or DOS partition table present?

    No there definitely is not either. It's a basic software RAID (md raid1) -> LVM -> EXT3.

EDIT #2

At this point the RAID seemed intact, but no LVM device mappers were present, also the Logical Volume (LV) seemed to be in an INACTIVE state.

$ lvscan
  inactive          '/dev/kodak_vg/lvm0' [149.00 GB] inherit

So I ran this command to activate it:

$ vgchange -ay
  1 logical volume(s) in volume group "kodak_vg" now active

Re-running lvscan showed the LV as active now:

$ lvscan
  ACTIVE            '/dev/kodak_vg/lvm0' [149.00 GB] inherit

Mounting

So at this point I thought I'd be OK with mounting the LVM mapper, /dev/kodak_vg/lvm0.

$ mount -t ext3 /dev/kodak_vg/lvm0 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/kodak_vg/lvm0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Here's the output from dmesg | tail:

$ demsg | tail
Buffer I/O error on device md2, logical block 48
usb 1-4: reset high speed USB device using ehci_hcd and address 5
usb 1-4: reset high speed USB device using ehci_hcd and address 5
usb 1-4: reset high speed USB device using ehci_hcd and address 5
usb 1-4: reset high speed USB device using ehci_hcd and address 5
usb 1-4: reset high speed USB device using ehci_hcd and address 5
sd 22:0:0:0: scsi: Device offlined - not ready after error recovery
sd 22:0:0:0: SCSI error: return code = 0x07050000
end_request: I/O error, dev sde, sector 387
EXT3-fs: unable to read superblock

Does this mean the drive medium may be failing or has failed?

EDIT #3: Follow-up Questions

Previous mounting attempt left the device in an inaccessible state. I initially power cycled the USB device, which was then redetected as /dev/sdf1. I then for the heck of it rebooted the system, but now the device is showing up in dmesg as /dev/sdj1. Not sure how to move it back, does it really matter?

Repeated steps above substituting in /dev/sdj1 for /dev/sde1 going forward for now.

At this point the device is being reported in lvscan as ACTIVE, but I've not yet attempted to mount the LVM mapper.

  1. What does the command smartctl -x /dev/sdj yield?

    This command didn't appear to work correctly:

    $ smartctl -x /dev/sdj
    smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-238.19.1.el5.centos.plus] (local build)
    Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
    
    /dev/sdj: Unknown USB bridge [0x0bc2:0x0503 (0x300)]
    Smartctl: please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary
    

    This command did however yield some additional information:

    $ smartctl -x /dev/sdj1
    smartctl 5.42 2011-10-20 r3458 [i686-linux-2.6.18-238.19.1.el5.centos.plus] (local build)
    Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
    
    Vendor:               Seagate
    Product:              External Drive
    User Capacity:        160,041,885,696 bytes [160 GB]
    Logical block size:   512 bytes
    Serial number:         
    Device type:          disk
    Local Time is:        Sat Sep 28 07:58:50 2013 EDT
    Device does not support SMART
    
    Error Counter logging not supported
    Device does not support Self Test logging
    Device does not support Background scan results logging
    scsiPrintSasPhy Log Sense Failed [unsupported scsi opcode]
    
  2. What does the command file -s /dev/kodak_vg/lvm0 yield?

    $ file -s /dev/kodak_vg/lvm0
    /dev/kodak_vg/lvm0: symbolic link to `/dev/mapper/kodak_vg-lvm0'
    

    Attempted to run the command file -s against the mapper device:

    $ file -s /dev/mapper/kodak_vg-lvm0 
    /dev/mapper/kodak_vg-lvm0: ERROR: cannot read `/dev/mapper/kodak_vg-lvm0' (Input/output error)
    
  3. What next?

    I'm going to take @Gilles advice and dd_rescue the drive to another device to see if we can't tease apart device issues with RAID/LVM issues.

    Any other advice before continuing?

References

share|improve this question
    
With RAID 1 and 0.90 metadata, you should be able to use it directly without even starting the md. As the RAID metadata is at the end, not the beginning. It would be more interesting to know what exactly is on the device itself. file -s /dev/{sdb1,md2} or if that yields nothing, hexdump -C the first few blocks. vgscan should yield something regardless if it's LVM1 or 2. –  frostschutz Sep 27 '13 at 21:52
    
Is there an LVM physical volume on /dev/md2 — what does pvs say? Is there an encrypted volume, or a DOS partition table (people do strange things sometimes) — what does file -s /dev/md2 say? –  Gilles Sep 27 '13 at 21:56
    
@slm: So it found a VG, and as it says it has nothing free, it must have LV as well. Seems like a standard LVM setup - what's the problem again? –  frostschutz Sep 28 '13 at 0:53
    
Well one was the Lv wasn't active. lvscan was showing it as inactive, I found this to fix that: vgchange -ay. Now it shows as ACTIVE. My next issue is that I should be able to mount it at this point, but that's failing. Wondering if the drive it self is having failures? –  slm Sep 28 '13 at 1:06
    
@frostschutz - getting this msg. when mounting: mount: wrong fs type, bad option, bad superblock on /dev/kodak_vg/lvm0, –  slm Sep 28 '13 at 1:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.