linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] VG has wrong num of PV's; won't vgscan
@ 2002-02-09 15:28 Sean C. McCord
  2002-02-10 12:37 ` Heinz J . Mauelshagen
  0 siblings, 1 reply; 4+ messages in thread
From: Sean C. McCord @ 2002-02-09 15:28 UTC (permalink / raw)
  To: linux-lvm

I was attempting to add another PV to my VG 'mccord', and vgextend
segfaulted in the middle.  After I rebooted (the kernel dumped its LVM
core), there was no volume group found by vgscan.

I have seen similar posts in the archives, but most of them reference a
bug that was supposedly fixed before LVM 1.0, so this must not be it.

Anyway, pvdisplay on /dev/ide/host0/bus1/target0/lun0/part1 says
everythings's great, and that it is PV #1 of VG mccord.

pvdata says VG mccord has two PVs and that both are active.  The other PV,
though, is completely trashed.  pvdata also says that the LV seems to be
fine.

I have no backup of the vgdata that I can find (they are stored on the
first PV...), so I can't do what many of the other people did to get their
VGs back.

Is there any way to change the VG info back to having only one PV, and if
so, will that get vgscan to find the VG again?  If you need the debug
info, I can provide it.

My system is using LVM 1.0.1-rc4, devfs, Reiserfs, and I have my root file
system on that VG.

Thanks for any assistance anyone can offer,

Sean C. McCord

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

* Re: [linux-lvm] VG has wrong num of PV's; won't vgscan
  2002-02-09 15:28 [linux-lvm] VG has wrong num of PV's; won't vgscan Sean C. McCord
@ 2002-02-10 12:37 ` Heinz J . Mauelshagen
  2002-02-13 10:04   ` Sean C. McCord
  0 siblings, 1 reply; 4+ messages in thread
From: Heinz J . Mauelshagen @ 2002-02-10 12:37 UTC (permalink / raw)
  To: linux-lvm

[-- Attachment #1: Type: text/plain, Size: 2580 bytes --]


Sean,

I have attached a quick hack perl script to fix your VGDA on
/dev/ide/host0/bus1/target0/lun0/part1.

Please recognize that it *just* solves the very purpose of getting your
VG with the single PV on /dev/ide/host0/bus1/target0/lun0/part1 back!

Save your metadata before you run it by

dd if=/dev/ide/host0/bus1/target0/lun0/part1 bs=1k count=1024 of=vgda.sav

in order to be able to redi from start in case something goes badly wrong.

Regards,
Heinz    -- The LVM Guy --


On Sat, Feb 09, 2002 at 04:28:14PM -0500, Sean C. McCord wrote:
> I was attempting to add another PV to my VG 'mccord', and vgextend
> segfaulted in the middle.  After I rebooted (the kernel dumped its LVM
> core), there was no volume group found by vgscan.
> 
> I have seen similar posts in the archives, but most of them reference a
> bug that was supposedly fixed before LVM 1.0, so this must not be it.
> 
> Anyway, pvdisplay on /dev/ide/host0/bus1/target0/lun0/part1 says
> everythings's great, and that it is PV #1 of VG mccord.
> 
> pvdata says VG mccord has two PVs and that both are active.  The other PV,
> though, is completely trashed.  pvdata also says that the LV seems to be
> fine.
> 
> I have no backup of the vgdata that I can find (they are stored on the
> first PV...), so I can't do what many of the other people did to get their
> VGs back.
> 
> Is there any way to change the VG info back to having only one PV, and if
> so, will that get vgscan to find the VG again?  If you need the debug
> info, I can provide it.
> 
> My system is using LVM 1.0.1-rc4, devfs, Reiserfs, and I have my root file
> system on that VG.
> 
> Thanks for any assistance anyone can offer,
> 
> Sean C. McCord
> 
> 
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@sistina.com
> http://lists.sistina.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html

*** Software bugs are stupid.
    Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Sistina Software Inc.
Senior Consultant/Developer                       Am Sonnenhang 11
                                                  56242 Marienrachdorf
                                                  Germany
Mauelshagen@Sistina.com                           +49 2626 141200
                                                       FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

[-- Attachment #2: patch_vgda --]
[-- Type: text/plain, Size: 2415 bytes --]

#!/usr/bin/perl
#
# For Sean C. McMord to patch his metadata on
# /dev/ide/host0/bus1/target0/lun0/part1 to reflect a VG
# with just 1 PV
#

$PVNAME="/dev/ide/host0/bus1/target0/lun0/part1";

# various offsets we need to retrieve and patch members
$VG_ON_DISK_OFFSET = 12;
$PV_UUIDLIST_ON_DISK_OFFSET = 20;
$PV_MAX_OFFSET=152;
$PV_UUID_OFFSET=44;
$PV_PE_TOTAL_OFFSET=456;
$VG_PE_TOTAL_OFFSET=176;
$NAME_LEN=128;

open ( PV, "$PVNAME") || die "Error opening \"$PVNAME\" to read\n";

# get the offset of the VG structure

seek ( PV, $VG_ON_DISK_OFFSET, 0);
$vg_on_disk_base = unpack ('V', <PV>);
printf ( "VG on-disk base is at %d bytes\n", $vg_on_disk_base);

# get the PV UUID
seek ( PV, $PV_UUID_OFFSET, 0);
$pv_uuid = unpack ( "a$NAME_LEN", <PV>);
printf ( "PV UUID at offset %d is: \"%s\"\n",  $PV_UUID_OFFSET, $pv_uuid);

# get the current PV and actual PV count from the VG structure
seek ( PV, $vg_on_disk_base + $PV_MAX_OFFSET, 0);
( $pv_max, $pv_cur, $pv_act) = unpack ('V3', <PV>);
printf ( "pv_max: %d   pv_cur: %d   pv_act: %d\n", $pv_max, $pv_cur, $pv_act);

# get the total PE count from the PV strcuture
seek ( PV, $PV_PE_TOTAL_OFFSET, 0);
( $pe_total, $pe_allocated) = unpack ('V2', <PV>);
printf ( "pe_total: %d   pe_allocated: %d\n", $pe_total, $pe_allocated);

# get start of the PV UUID list
seek ( PV, $PV_UUIDLIST_ON_DISK_OFFSET, 0);
$pv_uuidlist_on_disk = unpack ( 'V', <PV>);
printf ( "PV UUIDLIST is at %d bytes\n", $pv_uuidlist_on_disk);

close ( PV);
open ( PV, ">$PVNAME") || die "Error opening \"$PVNAME\" to write\n";

# Now we've got all the parameters -> got to change them

# change the current PV and actual PV count in the VG structure
$pv_cur = $pv_act = 1;
seek ( PV, $vg_on_disk_base + $PV_MAX_OFFSET, 0);
syswrite ( PV, pack ( 'V3', $pv_max, $pv_cur, $pv_act), 12);
printf ( "Changed pv_cur and pv_act to %d in the VG structure\n", $pv_cur);

# change PE total and PE allocated in the VG structure
seek ( PV, $vg_on_disk_base + $VG_PE_TOTAL_OFFSET, 0);
syswrite ( PV, pack ( 'V2', $pe_total, $pe_allocated), 8);
print ( "Changed pv_total and pv_allocated in the VG structure\n");

# change the PV UUID list
seek ( PV, $pv_uuidlist_on_disk, 0);
syswrite ( PV, $pv_uuid, $NAME_LEN);

for ( $i = 1; $i < $pv_max; $i++) {
     seek ( PV, $pv_uuidlist_on_disk + $i * $NAME_LEN, 0);
     syswrite ( PV, 0, 1);
};
print ( "Changed PV UUID list\n");

close ( PV);
print ( "Done\n\n");

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

* Re: [linux-lvm] VG has wrong num of PV's; won't vgscan
  2002-02-10 12:37 ` Heinz J . Mauelshagen
@ 2002-02-13 10:04   ` Sean C. McCord
  2002-02-13 15:43     ` Heinz J . Mauelshagen
  0 siblings, 1 reply; 4+ messages in thread
From: Sean C. McCord @ 2002-02-13 10:04 UTC (permalink / raw)
  To: Heinz J . Mauelshagen; +Cc: linux-lvm

Thanks greatly!  That worked beautifully.

Let this me a lesson to me (again).... backup, backup, backup.


On Sun, 10 Feb 2002, Heinz J . Mauelshagen wrote:

>
> Sean,
>
> I have attached a quick hack perl script to fix your VGDA on
> /dev/ide/host0/bus1/target0/lun0/part1.
>
> Please recognize that it *just* solves the very purpose of getting your
> VG with the single PV on /dev/ide/host0/bus1/target0/lun0/part1 back!
>
> Save your metadata before you run it by
>
> dd if=/dev/ide/host0/bus1/target0/lun0/part1 bs=1k count=1024 of=vgda.sav
>
> in order to be able to redi from start in case something goes badly wrong.
>
> Regards,
> Heinz    -- The LVM Guy --
>
>
> On Sat, Feb 09, 2002 at 04:28:14PM -0500, Sean C. McCord wrote:
> > I was attempting to add another PV to my VG 'mccord', and vgextend
> > segfaulted in the middle.  After I rebooted (the kernel dumped its LVM
> > core), there was no volume group found by vgscan.
> >
> > I have seen similar posts in the archives, but most of them reference a
> > bug that was supposedly fixed before LVM 1.0, so this must not be it.
> >
> > Anyway, pvdisplay on /dev/ide/host0/bus1/target0/lun0/part1 says
> > everythings's great, and that it is PV #1 of VG mccord.
> >
> > pvdata says VG mccord has two PVs and that both are active.  The other PV,
> > though, is completely trashed.  pvdata also says that the LV seems to be
> > fine.
> >
> > I have no backup of the vgdata that I can find (they are stored on the
> > first PV...), so I can't do what many of the other people did to get their
> > VGs back.
> >
> > Is there any way to change the VG info back to having only one PV, and if
> > so, will that get vgscan to find the VG again?  If you need the debug
> > info, I can provide it.
> >
> > My system is using LVM 1.0.1-rc4, devfs, Reiserfs, and I have my root file
> > system on that VG.
> >
> > Thanks for any assistance anyone can offer,
> >
> > Sean C. McCord
> >
> >
> >
> > _______________________________________________
> > linux-lvm mailing list
> > linux-lvm@sistina.com
> > http://lists.sistina.com/mailman/listinfo/linux-lvm
> > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html
>
> *** Software bugs are stupid.
>     Nevertheless it needs not so stupid people to solve them ***
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> Heinz Mauelshagen                                 Sistina Software Inc.
> Senior Consultant/Developer                       Am Sonnenhang 11
>                                                   56242 Marienrachdorf
>                                                   Germany
> Mauelshagen@Sistina.com                           +49 2626 141200
>                                                        FAX 924446
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>

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

* Re: [linux-lvm] VG has wrong num of PV's; won't vgscan
  2002-02-13 10:04   ` Sean C. McCord
@ 2002-02-13 15:43     ` Heinz J . Mauelshagen
  0 siblings, 0 replies; 4+ messages in thread
From: Heinz J . Mauelshagen @ 2002-02-13 15:43 UTC (permalink / raw)
  To: Sean C. McCord; +Cc: Heinz J . Mauelshagen, linux-lvm

On Wed, Feb 13, 2002 at 11:04:32AM -0500, Sean C. McCord wrote:
> Thanks greatly!  That worked beautifully.
> 

You're welcome.

> Let this me a lesson to me (again).... backup, backup, backup.
> 

Should go for a backup here now ;-)

Regards,
Heinz    -- The LVM Guy --


> 
> On Sun, 10 Feb 2002, Heinz J . Mauelshagen wrote:
> 
> >
> > Sean,
> >
> > I have attached a quick hack perl script to fix your VGDA on
> > /dev/ide/host0/bus1/target0/lun0/part1.
> >
> > Please recognize that it *just* solves the very purpose of getting your
> > VG with the single PV on /dev/ide/host0/bus1/target0/lun0/part1 back!
> >
> > Save your metadata before you run it by
> >
> > dd if=/dev/ide/host0/bus1/target0/lun0/part1 bs=1k count=1024 of=vgda.sav
> >
> > in order to be able to redi from start in case something goes badly wrong.
> >
> > Regards,
> > Heinz    -- The LVM Guy --
> >
> >
> > On Sat, Feb 09, 2002 at 04:28:14PM -0500, Sean C. McCord wrote:
> > > I was attempting to add another PV to my VG 'mccord', and vgextend
> > > segfaulted in the middle.  After I rebooted (the kernel dumped its LVM
> > > core), there was no volume group found by vgscan.
> > >
> > > I have seen similar posts in the archives, but most of them reference a
> > > bug that was supposedly fixed before LVM 1.0, so this must not be it.
> > >
> > > Anyway, pvdisplay on /dev/ide/host0/bus1/target0/lun0/part1 says
> > > everythings's great, and that it is PV #1 of VG mccord.
> > >
> > > pvdata says VG mccord has two PVs and that both are active.  The other PV,
> > > though, is completely trashed.  pvdata also says that the LV seems to be
> > > fine.
> > >
> > > I have no backup of the vgdata that I can find (they are stored on the
> > > first PV...), so I can't do what many of the other people did to get their
> > > VGs back.
> > >
> > > Is there any way to change the VG info back to having only one PV, and if
> > > so, will that get vgscan to find the VG again?  If you need the debug
> > > info, I can provide it.
> > >
> > > My system is using LVM 1.0.1-rc4, devfs, Reiserfs, and I have my root file
> > > system on that VG.
> > >
> > > Thanks for any assistance anyone can offer,
> > >
> > > Sean C. McCord
> > >
> > >
> > >
> > > _______________________________________________
> > > linux-lvm mailing list
> > > linux-lvm@sistina.com
> > > http://lists.sistina.com/mailman/listinfo/linux-lvm
> > > read the LVM HOW-TO at http://www.sistina.com/lvm/Pages/howto.html
> >
> > *** Software bugs are stupid.
> >     Nevertheless it needs not so stupid people to solve them ***

*** Software bugs are stupid.
    Nevertheless it needs not so stupid people to solve them ***

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Sistina Software Inc.
Senior Consultant/Developer                       Am Sonnenhang 11
                                                  56242 Marienrachdorf
                                                  Germany
Mauelshagen@Sistina.com                           +49 2626 141200
                                                       FAX 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

end of thread, other threads:[~2002-02-13 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-09 15:28 [linux-lvm] VG has wrong num of PV's; won't vgscan Sean C. McCord
2002-02-10 12:37 ` Heinz J . Mauelshagen
2002-02-13 10:04   ` Sean C. McCord
2002-02-13 15:43     ` Heinz J . Mauelshagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).