Linux LVM users
 help / color / mirror / Atom feed
* [linux-lvm] recovering a bad physical volume
@ 2002-07-15 19:01 Matthew Johnson
  2002-07-16  2:14 ` Patrick Caulfield
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Johnson @ 2002-07-15 19:01 UTC (permalink / raw)
  To: linux-lvm

Hi, I have just got lvm setup on my machine - and it works fine. However,
I had a problem with my root partition (not lvm) and when it came back up
one of the 2 lvm partitions on that disk said it wasn't a valid physical
volume. The otherone was fine, and the logical volumes that weren't on the
first physical volume (it wasn't striped) mounted OK. The one that was
partially on that first pv didn't, though - it said the device was not a
valid block device.

The question is, can I easily get the partition back so it mounts OK, and
failing that can I recover all (or any) of the data. all my /usr is on
there, plus some other less critical stuff, so I really could do with it.

more system details: Debian woody, with a custom 2.4.19 kernel with lvm
compiled in. The fs's all run reiserfs. THe volume group contains
/dev/hde6 /dev/hde7 & /dev/hda5. e7 & a5 are OK when I run pvdisplay, and
/dev/lvm1/var and /dev/lvm1/utils mount fine. /dev/lvm1/music doesn't
mount - I get errors reading superblock etc, and when I pvdisplay
/dev/hde6 it says it is not a valid physical volume.

Thanks,

Matthew Johnson

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-15 19:01 [linux-lvm] recovering a bad physical volume Matthew Johnson
@ 2002-07-16  2:14 ` Patrick Caulfield
  2002-07-16 16:22   ` Matthew Johnson
  0 siblings, 1 reply; 8+ messages in thread
From: Patrick Caulfield @ 2002-07-16  2:14 UTC (permalink / raw)
  To: linux-lvm

On Tue, Jul 16, 2002 at 01:02:08AM +0100, Matthew Johnson wrote:
> Hi, I have just got lvm setup on my machine - and it works fine. However,
> I had a problem with my root partition (not lvm) and when it came back up
> one of the 2 lvm partitions on that disk said it wasn't a valid physical
> volume. The otherone was fine, and the logical volumes that weren't on the
> first physical volume (it wasn't striped) mounted OK. The one that was
> partially on that first pv didn't, though - it said the device was not a
> valid block device.
> 
> The question is, can I easily get the partition back so it mounts OK, and
> failing that can I recover all (or any) of the data. all my /usr is on
> there, plus some other less critical stuff, so I really could do with it.
> 
> more system details: Debian woody, with a custom 2.4.19 kernel with lvm
> compiled in. The fs's all run reiserfs. THe volume group contains
> /dev/hde6 /dev/hde7 & /dev/hda5. e7 & a5 are OK when I run pvdisplay, and
> /dev/lvm1/var and /dev/lvm1/utils mount fine. /dev/lvm1/music doesn't
> mount - I get errors reading superblock etc, and when I pvdisplay
> /dev/hde6 it says it is not a valid physical volume.

# pvcreate /dev/hde6
# vgcfgrestore -n lvm1 /dev/hde6
# vgscan

should recover the volume group for you.


-- 

patrick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-16  2:14 ` Patrick Caulfield
@ 2002-07-16 16:22   ` Matthew Johnson
  2002-07-17  2:21     ` Patrick Caulfield
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Johnson @ 2002-07-16 16:22 UTC (permalink / raw)
  To: linux-lvm


On Tue, 16 Jul 2002, Patrick Caulfield wrote:

> On Tue, Jul 16, 2002 at 01:02:08AM +0100, Matthew Johnson wrote:
> > Hi, I have just got lvm setup on my machine - and it works fine. However,
> > I had a problem with my root partition (not lvm) and when it came back up
> > one of the 2 lvm partitions on that disk said it wasn't a valid physical
> > volume. The otherone was fine, and the logical volumes that weren't on the
> > first physical volume (it wasn't striped) mounted OK. The one that
was
> > partially on that first pv didn't, though - it said the device was not a
> > valid block device.
> >
> > The question is, can I easily get the partition back so it mounts OK, and
> > failing that can I recover all (or any) of the data. all my /usr is on
> > there, plus some other less critical stuff, so I really could do with it.
> >
> > more system details: Debian woody, with a custom 2.4.19 kernel with lvm
> > compiled in. The fs's all run reiserfs. THe volume group contains
> > /dev/hde6 /dev/hde7 & /dev/hda5. e7 & a5 are OK when I run pvdisplay, and
> > /dev/lvm1/var and /dev/lvm1/utils mount fine. /dev/lvm1/music doesn't
> > mount - I get errors reading superblock etc, and when I pvdisplay
> > /dev/hde6 it says it is not a valid physical volume.
>
> # pvcreate /dev/hde6
> # vgcfgrestore -n lvm1 /dev/hde6
> # vgscan
>
> should recover the volume group for you.
>

OK, from that I get the error "size of volume differs from backup",
although the volume group mounts fine. However, mount can't find a
filesystem. Bit more info - I checked the partition sizes (I was playing
around with some) - but they cylinder numbers are the same as the list I
have before I started. Second - its a 3gb partition, and the missing
logical volume is a 10Gb one. Hence, the last 7Gb are on the OK physical volumes. Can I
get back at least those, if not the whole lot.

Alternatively, at this point the question might better be asked to the
reiserfs lists.

Matt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-16 16:22   ` Matthew Johnson
@ 2002-07-17  2:21     ` Patrick Caulfield
  2002-07-18 19:16       ` Matthew Johnson
  0 siblings, 1 reply; 8+ messages in thread
From: Patrick Caulfield @ 2002-07-17  2:21 UTC (permalink / raw)
  To: linux-lvm

On Tue, Jul 16, 2002 at 10:22:43PM +0100, Matthew Johnson wrote:
> 
> OK, from that I get the error "size of volume differs from backup",
> although the volume group mounts fine. However, mount can't find a
> filesystem. Bit more info - I checked the partition sizes (I was playing
> around with some) - but they cylinder numbers are the same as the list I
> have before I started. Second - its a 3gb partition, and the missing
> logical volume is a 10Gb one. Hence, the last 7Gb are on the OK physical volumes. Can I
> get back at least those, if not the whole lot.
> 
> Alternatively, at this point the question might better be asked to the
> reiserfs lists.


Hmm, that message is a bit odd. Check that the partition sizes really do match
what LVM thinks they ought to be. vgcfgrestore -ll -n <vg> will show you this.

If the sizes match up and the disk is OK there's no reason why the filesystem
shouldn't mount.

-- 

patrick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-17  2:21     ` Patrick Caulfield
@ 2002-07-18 19:16       ` Matthew Johnson
  2002-07-19  1:41         ` Patrick Caulfield
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Johnson @ 2002-07-18 19:16 UTC (permalink / raw)
  To: linux-lvm

On Wed, 17 Jul 2002, Patrick Caulfield wrote:

> Hmm, that message is a bit odd. Check that the partition sizes really do match
> what LVM thinks they ought to be. vgcfgrestore -ll -n <vg> will show you this.
>
> If the sizes match up and the disk is OK there's no reason why the filesystem
> shouldn't mount.
>

OK, I ran that, and that PV has 756 extents, and 746*4096*1024 is
3170893824. From fdisk, (end sector - start sector)*1008*512 the partition
is 3176054784, a difference of 5160960, or 10 cylinders. Now, I'm sure I
copied the values for the partition sizes back in fine - but possibly I
accidentally made that one 10 too large.

Now, on that drive I had <hde5 hde6 hde7> in the extended partition. I
wanted to reduce hde5 in size, and insert hde8 between 5 & 6, then add
that to the lvm. With fdisk, you have to delete, then re-add 5 as the
smaller size. Unfortunately when you do that it renumbers 6 & 7 to 5 & 6.
Hence to keep the correct partition numbers (I don't know how to change
where a vg looks for its pvs for example) You have to delete them all, and
add them in number, not location, order.

Since hde7 worked fine, I assume the end cylinder of hde6 is correct, and
if I just move the start cylinder up 10, then that will then work. Is
there a better way to do this than with fdisk? since I'll have to delete
them all again and then create them, to keep the numbering correct.

Thanks again,

Matt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-18 19:16       ` Matthew Johnson
@ 2002-07-19  1:41         ` Patrick Caulfield
  2002-07-19  6:10           ` Matthew Johnson
  0 siblings, 1 reply; 8+ messages in thread
From: Patrick Caulfield @ 2002-07-19  1:41 UTC (permalink / raw)
  To: linux-lvm

On Fri, Jul 19, 2002 at 01:16:39AM +0100, Matthew Johnson wrote:
> On Wed, 17 Jul 2002, Patrick Caulfield wrote:
> 
> > Hmm, that message is a bit odd. Check that the partition sizes really do match
> > what LVM thinks they ought to be. vgcfgrestore -ll -n <vg> will show you this.
> >
> > If the sizes match up and the disk is OK there's no reason why the filesystem
> > shouldn't mount.
> >
> 
> OK, I ran that, and that PV has 756 extents, and 746*4096*1024 is
> 3170893824. From fdisk, (end sector - start sector)*1008*512 the partition
> is 3176054784, a difference of 5160960, or 10 cylinders. Now, I'm sure I
> copied the values for the partition sizes back in fine - but possibly I
> accidentally made that one 10 too large.
> 
> Now, on that drive I had <hde5 hde6 hde7> in the extended partition. I
> wanted to reduce hde5 in size, and insert hde8 between 5 & 6, then add
> that to the lvm. With fdisk, you have to delete, then re-add 5 as the
> smaller size. Unfortunately when you do that it renumbers 6 & 7 to 5 & 6.
> Hence to keep the correct partition numbers (I don't know how to change
> where a vg looks for its pvs for example) You have to delete them all, and
> add them in number, not location, order.
> 
> Since hde7 worked fine, I assume the end cylinder of hde6 is correct, and
> if I just move the start cylinder up 10, then that will then work. Is
> there a better way to do this than with fdisk? since I'll have to delete
> them all again and then create them, to keep the numbering correct.

Other than fdisk and parted I don't know of any other way of doing it. and parted
works in MB/GB rather than cylinders so I doubt you'd get the control you need
here.

Don't worry about the partition numbers being the same, LVM doesn't care what the
partitions are called, as long as it can find the PV metadata (which contains a
UUID)and a complete PV somewhere it should be able to activate the VG. LVM is
designed to cope with things like SCSI devices which rename themselves if you move
them around of the SCSI chain so IDE partitions that do the same will be no
problem.

-- 

patrick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-19  1:41         ` Patrick Caulfield
@ 2002-07-19  6:10           ` Matthew Johnson
  2002-07-22  3:29             ` Patrick Caulfield
  0 siblings, 1 reply; 8+ messages in thread
From: Matthew Johnson @ 2002-07-19  6:10 UTC (permalink / raw)
  To: linux-lvm

On Fri, 19 Jul 2002, Patrick Caulfield wrote:

> Other than fdisk and parted I don't know of any other way of doing it. and parted
> works in MB/GB rather than cylinders so I doubt you'd get the control you need
> here.
>
> Don't worry about the partition numbers being the same, LVM doesn't care what the
> partitions are called, as long as it can find the PV metadata (which contains a
> UUID)and a complete PV somewhere it should be able to activate the VG. LVM is
> designed to cope with things like SCSI devices which rename themselves if you move
> them around of the SCSI chain so IDE partitions that do the same will be no
> problem.

It complained that /de/hde8 was not part of the volumegroup, so I just
made sure the partition numbers were correct.

Anyway, I still get the "vgcfgrestore -- size of physical volume /dev/hde6
differs from backup" [from vgcfgrestore -n lvm1 /dev/hde6]. So, heres a
few details - see if ou can see the
problem.

vgcfgrestore -n lvm1 -ll :

[cut lv & pv details]
--- Physical volume ---
PV Name               /dev/hde6
VG Name               lvm1
PV Size               2.96 GB [6204177 secs] / NOT usable 4.19 MB [LVM:
130 KB]
PV#                   1
PV Status             available
Allocatable           yes (but full)
Cur LV                1
PE Size (KByte)       4096
Total PE              756
Free PE               0
Allocated PE          756
PV UUID               9F9nNV-cQS2-BSl6-Ex72-NV1J-9J2v-2wE04a

now, 4096*1024*756 = 3170893824

fdisk -l /dev/hde:

Disk /dev/hde: 16 heads, 63 sectors, 116336 cylinders
Units = cylinders of 1008 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hde1             1     62415  31457128+   b  Win95 FAT32
/dev/hde2         62416     83221  10486224   83  Linux
/dev/hde3         83222    116336  16689960    5  Extended
/dev/hde5         83222     85302   1048792+  83  Linux
/dev/hde6        104039    110182   3096576   8e  Linux LVM
/dev/hde7        110183    116336   3101584+  8e  Linux LVM

here we have 3096576*1024 = 3170893824
or (10182 - 104039 + 1)*1008*512 = 3170893824 [note that this includes
both the end and start cylinder, hence the +1]

so, it looks to be the correct size, as far as I can see.

Any more ideas?

(btw, thanks - you've been really helpful so far)

Note that /dev/hde7 works fine with those cylinder numbers, so if anything
is incorrect its the value of 104039.

Matt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [linux-lvm] recovering a bad physical volume
  2002-07-19  6:10           ` Matthew Johnson
@ 2002-07-22  3:29             ` Patrick Caulfield
  0 siblings, 0 replies; 8+ messages in thread
From: Patrick Caulfield @ 2002-07-22  3:29 UTC (permalink / raw)
  To: linux-lvm

On Fri, Jul 19, 2002 at 12:10:30PM +0100, Matthew Johnson wrote:
> On Fri, 19 Jul 2002, Patrick Caulfield wrote:
> 
> > Other than fdisk and parted I don't know of any other way of doing it. and parted
> > works in MB/GB rather than cylinders so I doubt you'd get the control you need
> > here.
> >
> > Don't worry about the partition numbers being the same, LVM doesn't care what the
> > partitions are called, as long as it can find the PV metadata (which contains a
> > UUID)and a complete PV somewhere it should be able to activate the VG. LVM is
> > designed to cope with things like SCSI devices which rename themselves if you move
> > them around of the SCSI chain so IDE partitions that do the same will be no
> > problem.
> 
> It complained that /de/hde8 was not part of the volumegroup, so I just
> made sure the partition numbers were correct.
> 
> Anyway, I still get the "vgcfgrestore -- size of physical volume /dev/hde6
> differs from backup" [from vgcfgrestore -n lvm1 /dev/hde6]. So, heres a
> few details - see if ou can see the
> problem.
> 
> vgcfgrestore -n lvm1 -ll :
> 
> [cut lv & pv details]
> --- Physical volume ---
> PV Name               /dev/hde6
> VG Name               lvm1
> PV Size               2.96 GB [6204177 secs] / NOT usable 4.19 MB [LVM:
> 130 KB]
> PV#                   1
> PV Status             available
> Allocatable           yes (but full)
> Cur LV                1
> PE Size (KByte)       4096
> Total PE              756
> Free PE               0
> Allocated PE          756
> PV UUID               9F9nNV-cQS2-BSl6-Ex72-NV1J-9J2v-2wE04a
> 
> now, 4096*1024*756 = 3170893824

Ah yes, but you should be using the PV size rather than the number of PEs to
work out the partition size! The PV is greater than the aggregated size of the
PEs because of the space needed for the LVM metadata.

So I make it that 6204177 sectors is 3176538624 bytes so you're still a little
short.


patrick

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-07-22  3:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-15 19:01 [linux-lvm] recovering a bad physical volume Matthew Johnson
2002-07-16  2:14 ` Patrick Caulfield
2002-07-16 16:22   ` Matthew Johnson
2002-07-17  2:21     ` Patrick Caulfield
2002-07-18 19:16       ` Matthew Johnson
2002-07-19  1:41         ` Patrick Caulfield
2002-07-19  6:10           ` Matthew Johnson
2002-07-22  3:29             ` Patrick Caulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox