Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
First I would like to say hello to everyone as this is my first post on LinuxQuestions.org.
I need help with data recovery from a lost LVM logical volume.
My OS is Debian 7.1.0 amd64. Here is the output of parted -l after connecting the disk to my machine and opening the encypted sdb3 partition with cryptmount. Unnecessary lines belonging to sda are removed.
Code:
$ parted -l
Model: WD A MK506 External (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 8389kB 7340kB biosgrub bios_grub
2 8389kB 209MB 200MB xfs boot
3 209MB 500GB 500GB crypto
Error:
dev/mapper/udisks-luks-uuid-770503ef-50cc-486d-bf46-ecf296f83ec6-uid1000:
unrecognised disk label
The partition sdb3 is a pysical volume for dm-crypt encryption. Inside the encrypted volume, there is a physical volume for LVM, with one volume group which is called vg1. In vg1, there are fsroot, home, swap, level1 and level2 logical volumes. I don't know the exact size and the order of the partitions. This setup was created using the debian wheezy installer some time in 2013 when wheezy was still in testing.
What I need is the contents of vg1-home. By the way, the os can not be booted from the drive, after unlocking the encrypted partition (wihch is called sda3 when I try to boot from it on another machine) the OS complains about not finding the root filesystem and gives me busybox prompt.
The problems came after removing the disk from its original place and mounting the lvm volumes while attached to another machine. After one successful mount, I could not boot from the disk or mount any of the logical volumes anymore. I can still unlock sdb3, access the files on sdb2 and according to S.M.A.R.T. there are no pending or reallocated sectors on the drive.
Here are the output of some commands. Note that sda contains a very similar filesystem structure. vg0 is on sda3, vg1 is on sdb3. I need the contents of vg1-home.
Code:
$ pvdisplay
--- Physical volume ---
PV Name /dev/dm-0
VG Name vg0
PV Size 232.69 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 59568
Free PE 0
Allocated PE 59568
PV UUID ******-****-****-****-****-****-z4MGEg
"/dev/mapper/udisks-luks-uuid-770503ef-50cc-486d-bf46-ecf296f83ec6-uid1000" is a new physical volume of "465.56 GiB"
--- NEW Physical volume ---
PV Name /dev/mapper/udisks-luks-uuid-770503ef-50cc-486d-bf46-ecf296f83ec6-uid1000
VG Name
PV Size 465.56 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ******-****-****-****-****-****-8Z4tOj
Code:
$ vgdisplay
--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 232.69 GiB
PE Size 4.00 MiB
Total PE 59568
Alloc PE / Size 59568 / 232.69 GiB
Free PE / Size 0 / 0
VG UUID ******-****-****-****-****-****-RbhxHd
Code:
$ lvdisplay
--- Logical volume ---
LV Path /dev/vg0/*******
LV Name private
VG Name vg0
LV UUID ******-****-****-****-****-****-3161Oo
LV Write Access read/write
LV Creation host, time [host], [time]
LV Status available
# open 0
LV Size 952.00 MiB
Current LE 238
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
--- Logical volume ---
LV Path /dev/vg0/swap
LV Name swap
VG Name vg0
LV UUID ******-****-****-****-****-****-mdpGQ7
LV Write Access read/write
LV Creation host, time [host], [time]
LV Status available
# open 2
LV Size 952.00 MiB
Current LE 238
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:2
--- Logical volume ---
LV Path /dev/vg0/fsroot
LV Name fsroot
VG Name vg0
LV UUID ******-****-****-****-****-****-tmHR01
LV Write Access read/write
LV Creation host, time [host], [time]
LV Status available
# open 1
LV Size 18.62 GiB
Current LE 4768
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:3
--- Logical volume ---
LV Path /dev/vg0/home
LV Name home
VG Name vg0
LV UUID ******-****-****-****-****-****-mAOzlx
LV Write Access read/write
LV Creation host, time [host], [time]
LV Status available
# open 1
LV Size 212.20 GiB
Current LE 54324
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:4
These pages helped me a LOT when somehow my LVM partition was deleted. I was able to regain access to everything without having to restore from a backup.
Thanks for the links. I successfully restored LVM metadata from backup, but this doesn't help. vgscan still can't find the missing vg. But I dont't care about repairing my LVM setup, I just need to copy the data from one of the logical volumes. I can still mount the first lv in the corrupted vg this way:
Code:
echo 0 974359424 linear /dev/mapper/lvm 2048 | dmsetup create test
mount /dev/mapper/test /media/test
The problem is, I dont know how to calculate the values so I can mount a lv other than the first one in the vg. Can someone point me in the right direction?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.