From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j8OLnPV02730 for ; Sat, 24 Sep 2005 17:49:25 -0400 Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.203]) by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id j8OLnHuE017605 for ; Sat, 24 Sep 2005 17:49:17 -0400 Received: by xproxy.gmail.com with SMTP id s13so72811wxc for ; Sat, 24 Sep 2005 14:49:12 -0700 (PDT) Message-ID: <89f9efee05092414492ec70ed@mail.gmail.com> Date: Sat, 24 Sep 2005 16:49:12 -0500 From: Leonard Smith Subject: Re: [linux-lvm] Recover Partition Table - vgdisplay/vgscan fails In-Reply-To: <64A66E9DBE859F4993DBE06DECD4F95301B2D8E4@TLRUSMNEAGMBX21.ERF.THOMSON.COM> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12184_28659489.1127598552127" References: <64A66E9DBE859F4993DBE06DECD4F95301B2D8E4@TLRUSMNEAGMBX21.ERF.THOMSON.COM> Reply-To: Leonard Smith , LVM general discussion and development List-Id: LVM general discussion and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: To: LVM general discussion and development ------=_Part_12184_28659489.1127598552127 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We tested out the below steps and they appeared to work. First you need to remove the partition table on /dev/sd01. So issue the "fdisk /dev/sdo1" then delete the partition table and write out the changes= . A reboot is required since most of the lvm command fail due to the VDGA being inconsistent with what is in the kernel. All of the filesystems, that are in datavg, need to be commented out of /etc/fstab to avoid having the O= S try and mount them on reboot. When the system comes back up all the volume groups, logical volumes and filesystem should be up except for datavg, and its logical volumes and file-systems. The LVM commands no longer will error out. Once the system is back up a VGDA needs to be created on /dev/sdo1. "pvcreate -v /dev/sdo1" Recover the old VGDA data, for /dev/sdo1. "vgcfgrestore -v -n datavg /dev/sdo1" Scan for volume groups, "vgscan" Activate the "newly" found datavg volume group, "vgchange -a y datavg" At this point we were able to see datavg, all of the logical volumes, under datavg, and mount the filesystems. We un-commented the filesystems entries, in /etc/fstab, rebooted a few times and verified that the filesystem were available on the reboot. Len Smith On 9/23/05, paul.stein@thomson.com wrote: > > Additional information explaining what caused the below errors: > +++++++++++++++ start +++++++++++++++++++++++++++++++++++++++++++++ > # fdisk /dev/sdo1 > Device contains neither a valid DOS partition table, nor Sun, SGI or OSF > disklabel > Building a new DOS disklabel. Changes will remain in memory only, > until you decide to write them. After that, of course, the previous > content won't be recoverable. > > The number of cylinders for this disk is set to 3541. > There is nothing wrong with that, but this is larger than 1024, > and could in certain setups cause problems with: > 1) software that runs at boot time (e.g., old versions of LILO) > 2) booting and partitioning software from other OSs > (e.g., DOS FDISK, OS/2 FDISK) > Warning: invalid flag 0x0000 of partition table 4 will be corrected by > w(rite) > Command (m for help): o > Building a new DOS disklabel. Changes will remain in memory only, > until you decide to write them. After that, of course, the previous > content won't be recoverable. > > The number of cylinders for this disk is set to 3541. > There is nothing wrong with that, but this is larger than 1024, > and could in certain setups cause problems with: > 1) software that runs at boot time (e.g., old versions of LILO) > 2) booting and partitioning software from other OSs > (e.g., DOS FDISK, OS/2 FDISK) > Warning: invalid flag 0x0000 of partition table 4 will be corrected by > w(rite) > Command (m for help): m > Command action > a toggle a bootable flag > b edit bsd disklabel > c toggle the dos compatibility flag > d delete a partition > l list known partition types > m print this menu > n add a new partition > o create a new empty DOS partition table > p print the partition table > q quit without saving changes > s create a new empty Sun disklabel > t change a partition's system id > u change display/entry units > v verify the partition table > w write table to disk and exit > x extra functionality (experts only) > Command (m for help): n > Command action > e extended > p primary partition (1-4) > p > Partition number (1-4): 1 > First cylinder (1-3541, default 1): > Using default value 1 > Last cylinder or +size or +sizeM or +sizeK (1-3541, default 3541): > Using default value 3541 > Command (m for help): t > Selected partition 1 > Hex code (type L to list codes): 8e > Changed system type of partition 1 to 8e (Linux LVM) > Command (m for help): m > Command action > a toggle a bootable flag > b edit bsd disklabel > c toggle the dos compatibility flag > d delete a partition > l list known partition types > m print this menu > n add a new partition > o create a new empty DOS partition table > p print the partition table > q quit without saving changes > s create a new empty Sun disklabel > t change a partition's system id > u change display/entry units > v verify the partition table > w write table to disk and exit > x extra functionality (experts only) > Command (m for help): p > Disk /dev/sdo1: 29.1 GB, 29133909504 bytes > 255 heads, 63 sectors/track, 3541 cylinders > Units =3D cylinders of 16065 * 512 =3D 8225280 bytes > Device Boot Start End Blocks Id System > /dev/sdo1p1 1 3541 28443051 8e Linux LVM > Command (m for help): v > 62 unallocated sectors > Command (m for help): v > 62 unallocated sectors > Command (m for help): w > The partition table has been altered! > Calling ioctl() to re-read partition table. > WARNING: Re-reading the partition table failed with error 16: Device or > resource busy. > The kernel still uses the old table. > The new table will be used at the next reboot. > Syncing disks. > +++++++++++++++++++++++++++++ end ++++++++++++++++++++++++++++++++++++++ > ------------------------------ > *From:* linux-lvm-bounces@redhat.com [mailto:linux-lvm-bounces@redhat.com= ] > *On Behalf Of *Stein, Paul (TLR Corp) > *Sent:* Friday, September 23, 2005 11:20 AM > *To:* linux-lvm@redhat.com > *Subject:* [linux-lvm] Recover Partition Table - vgdisplay/vgscan fails > > I inadvertantly blew away the partition table on /dev/sdo that was in > use. While the system is still running and no errors have occured...yet, = I > need > to get the partition table restored and be able to vgdisplay the datavg. > Below is the sampling of error messages. > # vgdisplay datavg > vgdisplay -- ERROR: VGDA in kernel and lvmtab are NOT consistent; please > run vgscan > # vgscan > vgscan -- reading all physical volumes (this may take a while...) > vgscan -- found active volume group "rootvg" > vgscan -- found active volume group "localvg" > vgscan -- found active volume group "datavg" > vgscan -- ERROR "vg_read_with_pv_and_lv(): current PV" can't get data of > volume group "datavg" 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 > groups > Is it safe to clear VGDA using the "dd if=3D/dev/zero of=3DPhysicalVol= ume > bs=3D512 count=3D1" shown in the pvcreate man pages and the come back and > recreate the VGDA using pvcreate, or use pvcreate outright not using the > dd method? Or, is there a better method to get /dev/sdo back into the dat= avg > group while recreating the partition table? > Paul Stein > > _______________________________________________ > linux-lvm mailing list > linux-lvm@redhat.com > https://www.redhat.com/mailman/listinfo/linux-lvm > read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/ > > ------=_Part_12184_28659489.1127598552127 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We tested out the below steps and they appeared to work.

First you need to remove the partition table on /dev/sd01. So issue the "fdisk /dev/sdo1" then delete the partition table and write out t= he changes.

A reboot is required since most of the lvm command fail due to the VDGA being inconsistent with what is in the kernel. All of the filesystems, that are in datavg, need to be commented out of /etc/fstab to avoid having the OS try and mount them on reboot. When the system comes back up all the volume groups, logical volumes and filesystem should be up except for datavg, and its logical volumes and file-systems. The LVM commands no longer will error out.

Once the system is back up a VGDA needs to be created on /dev/sdo1. "p= vcreate -v /dev/sdo1"
Recover the old VGDA data, for /dev/sdo1. "vgcfgrestore -v -n datavg /= dev/sdo1"

Scan for volume groups, "vgscan"
Activate the "newly" found datavg volume group, "vgchange -a= y datavg"

At this point we were able to see datavg, all of the logical volumes, under datavg, and mount the filesystems. We un-commented the filesystems entries, in /etc/fstab, rebooted a few times and verified that the filesystem
were available on the reboot.

Len Smith


On 9/23/05, paul.stein@thomson.com <paul.stein@thomson.com<= /a> > wrote:
Additional information explaining what caused the below=20 errors:
 
+++++++++++++++ start=20 +++++++++++++++++++++++++++++++++++++++++++++
 
<root@paxton:~>#=20 fdisk /dev/sdo1
Device contains neither a valid DOS partition table, nor= Sun,=20 SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain i= n=20 memory only,
until you decide to write them. After that, of course, the= =20 previous
content won't be recoverable.
 

The number of=20 cylinders for this disk is set to 3541.
There is nothing wrong with that= , but=20 this is larger than 1024,
and could in certain setups cause problems=20 with:
1) software that runs at boot time (e.g., old versions of LILO)2)=20 booting and partitioning software from other OSs
   (e.g., DOS= =20 FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 wil= l be=20 corrected by w(rite)
 
Command (m for=20 help): o
Building a new DOS disklabel. Changes will remain in memory=20 only,
until you decide to write them. After that, of course, the=20 previous
content won't be recoverable.
 

The number of=20 cylinders for this disk is set to 3541.
There is nothing wrong with that= , but=20 this is larger than 1024,
and could in certain setups cause problems=20 with:
1) software that runs at boot time (e.g., old versions of LILO)2)=20 booting and partitioning software from other OSs
   (e.g., DOS= =20 FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 wil= l be=20 corrected by w(rite)
 
Command (m for=20 help): m
Command action
   a   toggle a bootable= =20 flag
   b   edit bsd disklabel
  =20 c   toggle the dos compatibility flag
   d &nbs= p;=20 delete a partition
   l   list known partition=20 types
   m   print this menu
  =20 n   add a new partition
   o   create a ne= w=20 empty DOS partition table
   p   print the partition= =20 table
   q   quit without saving changes
 &n= bsp;=20 s   create a new empty Sun disklabel
   t  = ;=20 change a partition's system id
   u   change=20 display/entry units
   v   verify the partition=20 table
   w   write table to disk and exit
 &= nbsp;=20 x   extra functionality (experts only)
 
Command (m for=20 help): n
Command action
   e  =20 extended
   p   primary partition (1-4)
p
Part= ition=20 number (1-4): 1
First cylinder (1-3541, default 1):
Using default val= ue=20 1
Last cylinder or +size or +sizeM or +sizeK (1-3541, default 3541):
= Using=20 default value 3541
 
Command (m for=20 help): t
Selected partition 1
Hex code (type L to list codes):=20 8e
Changed system type of partition 1 to 8e (Linux LVM)
 
Command (m for=20 help): m
Command action
   a   toggle a bootable= =20 flag
   b   edit bsd disklabel
  =20 c   toggle the dos compatibility flag
   d &nbs= p;=20 delete a partition
   l   list known partition=20 types
   m   print this menu
  =20 n   add a new partition
   o   create a ne= w=20 empty DOS partition table
   p   print the partition= =20 table
   q   quit without saving changes
 &n= bsp;=20 s   create a new empty Sun disklabel
   t  = ;=20 change a partition's system id
   u   change=20 display/entry units
   v   verify the partition=20 table
   w   write table to disk and exit
 &= nbsp;=20 x   extra functionality (experts only)
 
Command (m for=20 help): p
 
Disk /dev/sdo1:=20 29.1 GB, 29133909504 bytes
255 heads, 63 sectors/track, 3541=20 cylinders
Units =3D cylinders of 16065 * 512 =3D 8225280 bytes
 
     Device Boot   =20 Start       End   =20 Blocks   Id =20 System
/dev/sdo1p1         =    =20 1      3541  28443051   8e  Li= nux=20 LVM
 
Command (m for=20 help): v
62 unallocated sectors
 
Command (m for=20 help): v
62 unallocated sectors
 
Command (m for=20 help): w
The partition table has been altered!
 
Calling ioctl() to=20 re-read partition table.
 
WARNING:=20 Re-reading the partition table failed with error 16: Device or resource=20 busy.
The kernel still uses the old table.
The new table will be used= at=20 the next reboot.
Syncing disks.
 
+++++++++++++++++++++++++++++ end=20 ++++++++++++++++++++++++++++++++++++++

From: linux-lvm-bounces@redhat.com=20 [mailto:linux-lvm-bounces@r= edhat.com] On Behalf Of Stein, Paul (TLR=20 Corp)
Sent: Friday, September 23, 2005 11:20 AM
To:=20 linux-lvm@redhat.com
Subj= ect: [linux-lvm] Recover Partition Table -=20 vgdisplay/vgscan fails

I inadvertantly blew=20 away the partition table on /dev/sdo that was in use. While the system is s= till=20 running and no errors have occured...yet, I need
to get the partition=20 table restored and  be able to vgdisplay the datavg. Below is the samp= ling=20 of error messages.
 
<root@paxton:/proc/lvm># vgdisplay=20 datavg
vgdisplay -- ERROR: VGDA in kernel and lvmtab are NOT consistent;= =20 please run vgscan
<root@paxton:/proc/lvm>#=20 vgscan
vgscan -- reading all physical volumes (this may take a=20 while...)
vgscan -- found active volume group "rootvg"
vgsc= an -- found=20 active volume group "localvg"
vgscan -- found active volume gr= oup=20 "datavg"
vgscan -- ERROR "vg_read_with_pv_and_lv(): curre= nt PV" can't get=20 data of volume group "datavg" from physical volume(s)
vgscan -= - "/etc/lvmtab"=20 and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: Th= is program does=20 not do a VGDA backup of your volume groups
 
 
 
Is it safe to clear=20 VGDA using the "dd if=3D/dev/zero of=3DPhysicalVolume bs=3D512 count= =3D1"  shown in=20 the pvcreate man pages and the come back and
recreate the=20 VGDA  using pvcreate, or use pvcreate outright not using the dd method= ? Or,=20 is there a better method to get /dev/sdo back into the=20 datavg
group while=20 recreating the partition table?
 
Paul Stein
 

_______________________________________________
linux-l= vm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-T= O at http://tldp.org/HOWTO/LVM= -HOWTO/


------=_Part_12184_28659489.1127598552127--