LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 05-02-2003, 01:39 PM   #1
frig_neutron
LQ Newbie
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 12

Rep: Reputation: 0
Exclamation LVM problem


Hi,
I was running lvm with one PV [/dev/hdb3], making up one GV
[/dev/data], which was completely allocated to one LV [/dev/data/homes]. My root was a separate harddisk [/dev/hda1]. hda is now gone, and so is my /etc, where my VGDA was.

Is there a way for me to get at the data that is still stored on /dev/hdb3 (I am running slackware linux 9; linux-2.4.20, lvm-1.0.6)?

When I run pvscan I get the following:

root@ved:~# pvscan -v
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- walking through all physical volumes found
pvscan -- inactive PV "/dev/hdb3" is associated to unknown VG "data"
(run vgscan)
pvscan -- total: 1 [13.64 GB] / in use: 1 [13.64 GB] / in no VG: 0 [0]

This suggests I run vgscan...

root@ved:~# vgscan -v
vgscan -- removing "/etc/lvmtab" and "/etc/lvmtab.d"
vgscan -- creating empty "/etc/lvmtab" and "/etc/lvmtab.d"
vgscan -- reading all physical volumes (this may take a while...)
vgscan -- scanning for all active volume group(s) first
vgscan -- reading data of volume group "data" from physical volume(s)
vgscan -- ERROR "vg_read_with_pv_and_lv(): current PV" can't get data of
volume group "data" from physical volume(s)
vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: This program does not do a VGDA backup of your volume
group

...

vgimport segfaults on me when I try to import the VG as shown:

root@ved:~# vgimport -fv data /dev/hdb3
vgimport -- locking logical volume manager
vgimport -- checking volume group name
vgimport -- checking volume group "data" existence
vgimport -- trying to read physical volume
vgimport -- checking for duplicate physical volumes
vgimport -- checking physical volume name "/dev/hdb3"
vgimport -- reading data of physical volume "/dev/hdb3" from disk
vgimport -- checking for exported physical volume "/dev/hdb3"
vgimport -- checking consistency of physical volume "/dev/hdb3"
vgimport -- reallocating memory
Segmentation fault

"pvdata -P /dev/hdb3" yields

--- Physical volume ---
PV Name /dev/hdb3
VG Name data
PV Size 13.64 GB [28611765 secs] / NOT usable 4.19 MB
[LVM: 141 KB]
PV# 1
PV Status NOT available
Allocatable yes (but full)
Cur LV 1
PE Size (KByte) 4096
Total PE 3491
Free PE 0
Allocated PE 3491
PV UUID gdtjvf-8UHQ-SbSF-zmaG-7E0z-5olx-cCQRrI



Any help will be greatly appreciated. Thanks.
 
Old 05-03-2003, 02:30 AM   #2
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Re: LVM problem

Quote:
Originally posted by frig_neutron
Hi,
I was running lvm with one PV [/dev/hdb3], making up one GV
[/dev/data], which was completely allocated to one LV [/dev/data/homes]. My root was a separate harddisk [/dev/hda1]. hda is now gone, and so is my /etc, where my VGDA was.

Is there a way for me to get at the data that is still stored on /dev/hdb3 (I am running slackware linux 9; linux-2.4.20, lvm-1.0.6)?

When I run pvscan I get the following:

root@ved:~# pvscan -v
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- walking through all physical volumes found
pvscan -- inactive PV "/dev/hdb3" is associated to unknown VG "data"
(run vgscan)
pvscan -- total: 1 [13.64 GB] / in use: 1 [13.64 GB] / in no VG: 0 [0]

This suggests I run vgscan...

root@ved:~# vgscan -v
vgscan -- removing "/etc/lvmtab" and "/etc/lvmtab.d"
vgscan -- creating empty "/etc/lvmtab" and "/etc/lvmtab.d"
vgscan -- reading all physical volumes (this may take a while...)
vgscan -- scanning for all active volume group(s) first
vgscan -- reading data of volume group "data" from physical volume(s)
vgscan -- ERROR "vg_read_with_pv_and_lv(): current PV" can't get data of
volume group "data" from physical volume(s)
vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: This program does not do a VGDA backup of your volume
group

...

vgimport segfaults on me when I try to import the VG as shown:

root@ved:~# vgimport -fv data /dev/hdb3
vgimport -- locking logical volume manager
vgimport -- checking volume group name
vgimport -- checking volume group "data" existence
vgimport -- trying to read physical volume
vgimport -- checking for duplicate physical volumes
vgimport -- checking physical volume name "/dev/hdb3"
vgimport -- reading data of physical volume "/dev/hdb3" from disk
vgimport -- checking for exported physical volume "/dev/hdb3"
vgimport -- checking consistency of physical volume "/dev/hdb3"
vgimport -- reallocating memory
Segmentation fault

"pvdata -P /dev/hdb3" yields

--- Physical volume ---
PV Name /dev/hdb3
VG Name data
PV Size 13.64 GB [28611765 secs] / NOT usable 4.19 MB
[LVM: 141 KB]
PV# 1
PV Status NOT available
Allocatable yes (but full)
Cur LV 1
PE Size (KByte) 4096
Total PE 3491
Free PE 0
Allocated PE 3491
PV UUID gdtjvf-8UHQ-SbSF-zmaG-7E0z-5olx-cCQRrI



Any help will be greatly appreciated. Thanks.
you could copy physically your /dev/hda3
you could use dd
how to do that?
read info dd
 
Old 05-07-2003, 02:53 AM   #3
frig_neutron
LQ Newbie
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 12

Original Poster
Rep: Reputation: 0
I already seem to have extracted most of my ext3 filesystem, by looking for the superblock (identifying it by magic number), and extracting from 0x400 bytes before the superblock. Interestingly enough, if I extract from the first superblock (which I believe started 675 sectors into the partition) using dd if=/dev/hdb3 of=diskdump bs=512 skip=..., I can't dumpe2fs (or mount, or fsck for that matter) the filesystem image because it says the inode bitmap is not present. If I extract from the first backup superblock, then I get more success with the dumpe2fs and mount, but I get a fsckload of errors on fsck and (as expected) a lot of IO errors trying to read some percentage of files from the mounted image. With this in mind...

Is there any documentation regarding the ondisk format of PVs? Any charts, maps, tables of address mappings.... anything? FAQ's, howtos, usenet posts all accepted

Thanks.
 
Old 05-07-2003, 03:17 AM   #4
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Quote:
Originally posted by frig_neutron
I already seem to have extracted most of my ext3 filesystem, by looking for the superblock (identifying it by magic number), and extracting from 0x400 bytes before the superblock. Interestingly enough, if I extract from the first superblock (which I believe started 675 sectors into the partition) using dd if=/dev/hdb3 of=diskdump bs=512 skip=..., I can't dumpe2fs (or mount, or fsck for that matter) the filesystem image because it says the inode bitmap is not present. If I extract from the first backup superblock, then I get more success with the dumpe2fs and mount, but I get a fsckload of errors on fsck and (as expected) a lot of IO errors trying to read some percentage of files from the mounted image. With this in mind...

Is there any documentation regarding the ondisk format of PVs? Any charts, maps, tables of address mappings.... anything? FAQ's, howtos, usenet posts all accepted

Thanks.
I am not sure about it but maybe it will work with loopback
try mouting loopback
that is
mount -o loop diskdump <directory where you want to mount >
 
Old 05-07-2003, 04:21 PM   #5
frig_neutron
LQ Newbie
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 12

Original Poster
Rep: Reputation: 0
I can't mount the partition image because it is an LVM PV - i.e. the filesystem does not start at the beginning. I need to accurately determine where in the image the filesystem starts so I can extract the filesystem to a separate image, which I can then mount (or write back to the disk). The problem is I cannot find any relevant documentation (except for AIX - but there seem to be implementation differences). There was even a doc which told me what source header to look into to determine the constant field sizes - but again that was for AIX, so the header did not exist in the Sistina Linux implementation.

P.S.: Searching through the image for the ext2 superblock (keying in on the magicnumber's relative position in the sector) doesn't work too well - seems the first "superblock" I find using this method is missing it's inode bitmap, despite the fact that everything else seems ok. The second superblock I locate (presumably the first backup superblock) has an inode bitmap, but some files generate IO errors, indicates they cannot be found on the filesystem (probably omitted by me starting the read too far into the image).
 
Old 05-08-2003, 04:44 AM   #6
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
so mount -o loop did not worked !
ok
lets try od
try
od -Ad -a diskdump |grep "E x t"
/the spaces are important/
important:which is your filesystem?
 
Old 05-08-2003, 04:47 AM   #7
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
just to add it should be "E x t" ie three spacebar after E ,x

Last edited by rch; 05-08-2003 at 04:49 AM.
 
Old 05-08-2003, 04:59 AM   #8
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
I must be getter more stupid every time
I forgot to mention the use of od
after you get a line containing the ext block you could subtract 65584 bytes from the address of the line
and starting copying from that point using dd to another file
now do a loopback mount on the file and pray that it works this time.
 
Old 05-08-2003, 11:02 AM   #9
frig_neutron
LQ Newbie
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 12

Original Poster
Rep: Reputation: 0
I don't think that would produce good results..

I tested this method with a known good working ext3 filesystem (no lvm) - which means that following the method you suggested, the first address I should come up with is 0. Following the method, the first address I come up with is 15654064.

I also tested it with the disk image I have. Needless to say - it didn't work.

Maybe we searched for the wrong string?

How did you come up with the search string "Ext"? AFAIK there is nothing in the ext2/3 filesystem spec that states the filesystem should include the ASCII string Ext anywhere on disk.

Do you have docs I can reference for this information?

Thanks
 
Old 05-08-2003, 10:24 PM   #10
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Quote:
I tested this method with a known good working ext3 filesystem (no lvm) - which means that following the method you suggested, the first address I should come up with is 0. Following the method, the first address I come up with is 15654064.
could you tell me the exact command that you used!
Quote:
I also tested it with the disk image I have. Needless to say - it didn't work.
It didnot worked?
what happened -did it came up with no line containing ext or it didn't.
Incidentally i just want to add here -I am working in a dynamic disk to basic disk conversion software -and this things are necessary for me.
If you want i will send you a sample code to determine probable location of ext3 partition in a harddisk
 
Old 05-09-2003, 09:10 AM   #11
frig_neutron
LQ Newbie
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by rch
could you tell me the exact command that you used!
I used
od -Ad -a /dev/hda3 | grep "E x t "
("E x t" has 3 spaces between each letter)

the command comes up with the following result:
9040528 + v bs E x t 7 D e dc2 W C i y d $
(and more later - but if this one is off, all subsequent addresses will be off).

Doing the subtraction...
9040528 - 65584 = 8974944

Since this was a straight ext3 partition, the number should have been 0.

Quote:
It didnot worked?
what happened -did it came up with no line containing ext or it didn't.
Incidentally i just want to add here -I am working in a dynamic disk to basic disk conversion software -and this things are necessary for me.
If you want i will send you a sample code to determine probable location of ext3 partition in a harddisk
It came up with a series of invalid addresses - just like it did on /dev/hda3

My question is - where did you get the idea of searching for the string "Ext" - I couldn't find it in the ext2/3 filesystem description... am I not understanding something?
 
Old 05-09-2003, 11:13 PM   #12
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Sorry I made a small mistake
It should be EXT
well I came up with the idea writing for the dynamic disk conversion
The string EXT defines the start of the EXT partition
I knew about the string from the source code of a program called testdisk ,some ideas from which I have gracefully copied.
 
Old 05-13-2003, 02:15 AM   #13
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Anything new?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't boot, LVM and inode problem Raoul68 Linux - General 2 11-01-2005 01:34 PM
Can't boot, LVM and inode problem Raoul68 Linux - Hardware 0 10-30-2005 03:14 AM
LVM problem System doesn't want to initialize. Poul Fedora 1 05-03-2005 04:00 AM
LVM Problem ZilverZtream Linux - Software 1 01-15-2005 05:08 AM
wierd lvm problem saranga2000 Linux - Hardware 0 01-10-2005 07:58 AM


All times are GMT -5. The time now is 10:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration