Recovering data from a hard drive with LVM a partition
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.
Recovering data from a hard drive with LVM a partition
Hello all,
I have an external USB hard drive that I need to recover some data from, but I see from fdisk -l that the partition uses LVM:
Code:
[root@localhost ~]# fdisk -l /dev/sdd
Disk /dev/sdd: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 * 1 19457 156288321 8e Linux LVM
[root@localhost ~]#
I've followed various lvm tutorials all of which describe setting up lvm from fresh on empty disks. Unfortunately non mention how to 'install' new a drive that was previously set up with lvm.
I have had a go anyway and may have now lost my data. Here's what I've ended up with (the partition in question is sdd1):
Code:
[root@localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sdd1
VG Name vg02
PV Size 149.05 GB / not usable 1.31 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 38156
Free PE 12
Allocated PE 38144
PV UUID HmVjPK-gHmG-LJqF-jy1c-fQwK-M1KL-t0MlKs
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 7.90 GB / not usable 23.41 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 252
Free PE 0
Allocated PE 252
PV UUID 400PwS-P1j1-uQP0-2pNq-rqsL-DiNW-VYbM5j
Code:
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name vg02
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 149.05 GB
PE Size 4.00 MB
Total PE 38156
Alloc PE / Size 38144 / 149.00 GB
Free PE / Size 12 / 48.00 MB
VG UUID TSEAlK-3HlT-utMW-0JEm-n45l-Hgmb-Vu4u1E
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 7.88 GB
PE Size 32.00 MB
Total PE 252
Alloc PE / Size 252 / 7.88 GB
Free PE / Size 0 / 0
VG UUID BGOVZ1-5U0e-3ATo-XQLG-82l1-uuc8-hhaizP
Code:
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/vg02/lv02
VG Name vg02
LV UUID c2Ztsz-7yak-N5W0-aYs1-xXZd-lXQO-kC3VOs
LV Write Access read/write
LV Status available
# open 0
LV Size 149.00 GB
Current LE 38144
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID gbFYmV-F8uI-81R5-mYSg-p8KW-HNgo-V0R4hg
LV Write Access read/write
LV Status available
# open 1
LV Size 7.38 GB
Current LE 236
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID cCVgp7-5bXf-wfng-nyQO-e77D-aHgd-CBsI0B
LV Write Access read/write
LV Status available
# open 1
LV Size 512.00 MB
Current LE 16
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
Code:
[root@localhost ~]# mkdir /media/sdd1/
[root@localhost ~]# mount /dev/vg02/lv02 /media/sdd1/
mount: you must specify the filesystem type
[root@localhost ~]# mount -t ext3 /dev/vg02/lv02 /media/sdd1/
mount: wrong fs type, bad option, bad superblock on /dev/vg02/lv02,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
I've tried mounting with other fstypes, but all give the same error.
So I guessed that my system uses /dev/mapper rather than /dev/dm-.
Next I tried 'mount /dev/mapper/vg02-lv02 /media/sdd1'', this failed as before, the same goes for using -t:
Code:
[root@localhost ~]# mount /dev/mapper/vg02-lv02 /media/sdd1/
mount: you must specify the filesystem type
[root@localhost ~]# mount -t ext3 /dev/mapper/vg02-lv02 /media/sdd1/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg02-lv02,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
You are mounting the correct device (either path should work). I think the problem is either with broken filesystem (try fsck) or another filesystem type (try using mount without the -t option).
A quick check on a partition is to run "sudo file -s /dev/<device>". It will tell you what filesystem is on it. Then you can run fsck.<filesystem> to check the filesystem for errors.
Sometimes there is a filesystem in /dev/mapper/ and another such as /dev/dm-0.
Also look at "ls -l /dev/disk/by-uuid/" and follow the links. Using UUID=<UUID #> in /etc/fstab is preferable for external drives.
You are mounting the correct device (either path should work). I think the problem is either with broken filesystem (try fsck) or another filesystem type (try using mount without the -t option).
Thanks robo, I tried mounting without the -t, but when that failed I tried using explicit types.
Quote:
Originally Posted by jschiwal
A quick check on a partition is to run "sudo file -s /dev/<device>". It will tell you what filesystem is on it. Then you can run fsck.<filesystem> to check the filesystem for errors.
Sometimes there is a filesystem in /dev/mapper/ and another such as /dev/dm-0.
Also look at "ls -l /dev/disk/by-uuid/" and follow the links. Using UUID=<UUID #> in /etc/fstab is preferable for external drives.
It never occurred to me to use 'file' in that way, that's really handy!
Unfortunately I think I have a stuffed file system :-( as 'file' doesn't come back with anything useful, and I think I've done everything correctly.
I'll have to read up on the UUID stuff as it didn't make sense on my system, the UUIDs in there weren't used by anything listed by pv/vg/lvdisplay. Thanks for the pointer though.
Thanks for your help but I'll give up on this now,
Craig
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.