Can't find physical volume / vgcfgrestore not helping
Greetings,
I am having problems with my LVM setup. I recently had to reboot my
machine and when it came back my, my LVM is not mounting. It is currently only a one-drive setup (was going to add more drives to LVM eventually). Any help would be greatly appreciated. Most of this data is backed up, however there are a significant number of photos that can't be replaced from a recent event. If anyone could point me in the right direction for something to try that I've missed, it would be greatly appreciated.
pvscan, lvscan, vgscan, and lvmdiskscan all report nothing useable.
I have a current backup in /etc/lvm/backup/media_vg
# vgcfgrestore -vv media_vg
Setting global/locking_type to 1
Setting global/locking_dir to /var/lock/lvm
File-based locking enabled.
Locking /var/lock/lvm/P_orphans WB
Locking /var/lock/lvm/V_media_vg W
/dev/hda1: No label detected
/dev/hda2: No label detected
/dev/hda3: No label detected
/dev/hdb1: No label detected
/dev/hda1: No label detected
/dev/hda2: No label detected
/dev/hda3: No label detected
/dev/hdb1: No label detected
Couldn't find device with uuid 'Hot5vl-31e1-MI0e-MbAD-ZNjY-WGFs-6LyVgG'. Couldn't find all physical volumes for volume group media_vg.
Unlocking /var/lock/lvm/V_media_vg
Unlocking /var/lock/lvm/P_orphans
Restore failed.
# fdisk -l /dev/hdb <snip> Device Boot Start End Blocks Id System /dev/hdb1 1 14593 117218241 83 Linux
(Is that a proper Id? Plus, looking at my media_vg backup, I don't believe there should be a partition because the hint is /dev/hdb, not /dev/hdb1)
# parted /dev/hdb print Disk geometry for /dev/ide/host0/bus0/target1/lun0/disc: 0.000-114473.460 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 114470.969 primary
And finally, my /etc/lvm/backup/media_vg
# Generated by LVM2: Sat Jan 24 11:14:02 2004
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing 'lvcreate -l 28618 media_vg -n media_lv'"
creation_host = "rocky" # Linux rocky 2.6.2-rc1 #1 Thu Jan 22 01:07:01 EST 2004 i686creation_time = 1074960842 # Sat Jan 24 11:14:02 2004
media_vg {
id = "qwA0eK-7qJo-Y5pL-w0Wi-mvIT-bqaY-fsmVWz"
seqno = 2
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192 # 4 Megabytes
max_lv = 255
max_pv = 255
physical_volumes {
pv0 {
id = "Hot5vl-31e1-MI0e-MbAD-ZNjY-WGFs-6LyVgG"
device = "/dev/hdb" # Hint only
status = ["ALLOCATABLE"]
pe_start = 384
pe_count = 28618 # 111.789 Gigabytes
}
}
logical_volumes {
media_lv {
id = "uUGJw0-TaGx-nFKh-SZKI-94cU-oadb-3BNzXU"
status = ["READ", "WRITE", "VISIBLE"]
segment_count = 1
segment1 {
start_extent = 0
extent_count = 28618 # 111.789 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 0
]
}
}
}
}Quoted 7 lines · Bryan Ragon
# fdisk -l /dev/hdb /dev/hdb1 1 14593 117218241 83 Linux(Is that a proper Id? Plus, looking at my
media_vgbackup, I don't believe there should be a partition because the hint is/dev/hdb, not/dev/hdb1)device = "
/dev/hdb" # Hint only
Chances are you didn't remove the partition table before using the entire unpartitioned device as a physical volume, or ran pvcreate on /dev/hdb when you intended to use hdb1.
(Recent lvm2 versions of pvcreate handle this better.)
Try removing the partition table.
[eg delete the partition with fdisk/parted, or write 512 zero bytes to the start of /dev/hdb - back it up first - and run blockdev --rereadpt]
Alasdair
Signature · 1 line
[email protected]
RE: [linux-lvm] Can't find physical volume / vgcfgrestore not helping (Success!!)
-----Original Message-----
Quoted 11 lines
Quoted 9 lines · Bryan Ragon
# fdisk -l /dev/hdb /dev/hdb1 1 14593 117218241 83 Linux(Is that a proper Id? Plus, looking at my
media_vgbackup, I don't believe there should be a partition because the hint is/dev/hdb, not/dev/hdb1)device = "
/dev/hdb" # Hint onlyChances are you didn't remove the partition table before using the entire
unpartitioned device as a physical
Quoted 7 lines
volume, or ran pvcreate on
/dev/hdbwhen you intended to use hdb1.(Recent lvm2 versions of pvcreate handle this better.)
Try removing the partition table.
[eg delete the partition with fdisk/parted, or write 512 zero bytes to the
start of /dev/hdb -
Quoted 1 line
back it up first - and run blockdev --rereadpt]
Here is a detailed list of steps that worked:
;; first backed up the first 512 bytes of /dev/hdb
# dd if=/dev/hdb of=~/hdb.first512 count=1 bs=512 1+0 records in 1+0 records out
;; zero them out, per Alasdair
# dd if=/dev/zero of=/dev/hdb count=1 bs=512 1+0 records in 1+0 records out
;; verified
# blockdev --rereadpt /dev/hdb BLKRRPART: Input/output error
;; find the volumes
# vgscan Reading all physical volumes. This may take a while... Found volume group "media_vg" using metadata type lvm2
# pvscan PV /dev/hdb VG media_vg lvm2 [111.79 GB / 0 free] Total: 1 [111.79 GB] / in use: 1 [111.79 GB] / in no VG: 0 [0 ]
# lvmdiskscan /dev/hda1 [ 494.16 MB] /dev/hda2 [ 1.92 GB] /dev/hda3 [ 18.65 GB] /dev/hdb [ 111.79 GB] LVM physical volume /dev/hdd1 [ 71.59 GB] 0 disks 4 partitions 1 LVM physical volume whole disk 0 LVM physical volumes
# vgchange -a y 1 logical volume(s) in volume group "media_vg" now active
;; /media is a defined mount point in fstab, listed below for future archive searches
# mount /media # ls /media graphics lost+found movies music
Success!! Thank you, Alasdair!!!!
/etc/fstab
<snip>/dev/media_vg/media_lv /media ext3 noatime
0 0
<snip>