Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
01-18-2010, 06:19 AM
|
#1
|
|
LQ Newbie
Registered: Jan 2001
Location: UK - Midlands
Distribution: Redhat various
Posts: 29
Rep:
|
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.
Can anyone help me recover my data please?
Thanks,
Craig
|
|
|
|
01-18-2010, 07:16 AM
|
#2
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Use "/sbin/vgmknodes" to create the /dev/dm-* nodes for the logical partition on the LVM volume. Then mount those nodes.
|
|
|
|
01-18-2010, 10:36 AM
|
#3
|
|
LQ Newbie
Registered: Jan 2001
Location: UK - Midlands
Distribution: Redhat various
Posts: 29
Original Poster
Rep:
|
Hi jschiwal,
Thanks for your reply, unfortunately it didn't help on this occasion.
At first vgmknodes didn't seem to do anything, especially as nothing appears in /dev/dm-*, not even for the working LVM drives.
So I ran 'vgmknodes -v -v', part of the output is here:
Code:
/dev/sdd1: lvm2 label detected
Locking /var/lock/lvm/V_vg02 RB
/dev/sdd1: lvm2 label detected
/dev/sdd1: lvm2 label detected
Removing /dev/vg02/lv02
Linking /dev/vg02/lv02 -> /dev/mapper/vg02-lv02
Unlocking /var/lock/lvm/V_vg02
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
Thanks again,
Craig
|
|
|
|
01-19-2010, 03:54 AM
|
#4
|
|
Member
Registered: Aug 2004
Location: Europe
Posts: 587
Rep:
|
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).
|
|
|
|
01-19-2010, 06:47 AM
|
#5
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
Last edited by jschiwal; 01-19-2010 at 06:54 AM.
|
|
|
|
01-19-2010, 07:47 AM
|
#6
|
|
LQ Newbie
Registered: Jan 2001
Location: UK - Midlands
Distribution: Redhat various
Posts: 29
Original Poster
Rep:
|
given up
Quote:
Originally Posted by r0b0
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
|
|
|
|
01-21-2010, 02:03 AM
|
#7
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Be sure you use "file -s" on the logical volume. Using it on a Physical volume or volume group won't give you a filesystem.
If the logical volumes were used to create a raid array, then you may not have a filesystem on the logical volume.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:39 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|