Restore VG config

 
SOLVED
Go to solution
Ramaprasad K
Regular Advisor

Restore VG config

Hi all,

Server: rp7420
OS: HP-UX 11.11

Had issue with OS, reinstalled it. Before reinstallation, had 2 disks - 1 boot disk and other data disk. Now installation would disturb only the root disk, and data on other disk would be intact.

Is there any way to restore the VG config of other disk? What are the commands? (FYI: each disk was part of one VG).

Thanks,
Ram
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Restore VG config

mkdir /dev/vg01
mknod /dev/vg01/group c64 0x010000
vgimport -s /dev/vg01

If you have problems with the -s option then run
vgimport -v /dev/vg01 /dev/dsk/c0t1d0 /dev/dsk/c0t3d0

You'll need to specify the specific disks you're using rather than c0t1d0 and c0t3d0.


Pete

Pete
Robert-Jan Goossens_1
Honored Contributor

Re: Restore VG config

Hi Ram,

You can use vgimport to import the old disk into a volumegroup.

# mkdir /dev/vg01
# ll /dev/*/group
choose a free group file minor number
# mknod /dev/vg01/group c 64 0x010000
# vgimport -v /dev/vg01 /dev/dsk/cxtydz
# vgchange -a y vg01
create mount points
# mkdir ....
mount your lvols on the mount points.
add the lvols and mount point to your /etc/fstab.

Regards,
Robert-Jan
Ganesan R
Honored Contributor
Solution

Re: Restore VG config

Hi Ramaprasad,

That is the feature of LVM. LVM will keep the configuration on two places. One is on the corresponding VG dir under /etc/lvmconf

Example: /etc/lvmconf/vg01.conf

Another place is on the disk. If disk fails we can restore from the configuration file. If confiruation file corrupts or not exist we can restore from the disk headers.

Now you need to follow the second method.

#mkdir /dev/vgname
#mknod /dev/vgname/group c 64 0x010000
#vgimport vgname /dev/dsk/cxtxdx -> Here you need to specify all the disks

#vgchange -a y vgname

#vgdisplay -v vgname

Best wishes,

Ganesh.
Ramaprasad K
Regular Advisor

Re: Restore VG config

# mkdir /dev/vg01
# ll /dev/*/group
crw-r----- 1 root sys 64 0x000000 Apr 24 14:48 /dev/vg00/group
# mknod /dev/vg01/group c 64 0x010000
# ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
==========================================================================
disk 0 1/0/0/3/0.6.0 sdisk CLAIMED DEVICE HP 73.4GATLAS10K3_73_SCA
/dev/dsk/c0t6d0 /dev/rdsk/c0t6d0
disk 1 1/0/0/3/1.2.0 sdisk CLAIMED DEVICE HP DVD-ROM 305
/dev/dsk/c1t2d0 /dev/rdsk/c1t2d0
disk 2 1/0/1/0/0/1/1.6.0 sdisk CLAIMED DEVICE HP 36.4GST336753LC
/dev/dsk/c3t6d0 /dev/rdsk/c3t6d0
# vgimport -v /dev/vg01 /dev/dsk/c3t6d0
Beginning the import process on Volume Group "/dev/vg01".
Logical volume "/dev/vg01/lvol1" has been successfully created
with lv number 1.
Logical volume "/dev/vg01/lvol2" has been successfully created
with lv number 2.
Logical volume "/dev/vg01/lvol6" has been successfully created
with lv number 6.
Logical volume "/dev/vg01/lvol7" has been successfully created
with lv number 7.
Volume group "/dev/vg01" has been successfully created.
Warning: A backup of this volume group may not exist on this machine.
Please remember to take a backup using the vgcfgbackup command after activating the volume group.

# vgcfgbackup vg01
vgcfgbackup: Warning: couldn't query physical volume "/dev/dsk/c3t6d0":
The specified path does not correspond to physical volume attached to
this volume group
vgcfgbackup: Warning: couldn't query all of the physical volumes.
vgcfgbackup: Volume group not activated.
# vgchange -a y vg01
Activated volume group
Volume group "vg01" has been successfully changed.
# vgcfgbackup vg01
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
# mkdir /ora920
# mount /dev/vg01/lvol1 /ora920
# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1048576 126472 914952 12% /
/dev/vg00/lvol1 505392 59336 395512 13% /stand
/dev/vg00/lvol11 5128192 1250072 3849448 25% /var
/dev/vg00/lvol10 2048000 1327760 714696 65% /usr
/dev/vg00/lvol9 1048576 560752 484080 54% /tmp
/dev/vg00/lvol8 5128192 2361 4805474 0% /projects/ipdr
/dev/vg00/lvol7 2572288 1735 2409901 0% /oracle
/dev/vg00/lvol6 3080192 1693392 1375976 55% /opt
/dev/vg00/lvol5 32768 2280 30264 7% /home
/dev/vg00/lvol4 1228800 1406 1150689 0% /eAC
/dev/vg01/lvol1 5120000 4194158 868024 83% /ora920
#
.
.
.


Thanks all for your replies. Specially Ganesan for explaining the logic behind it. Full points to all of you.

Regards,
Ram.
Ramaprasad K
Regular Advisor

Re: Restore VG config

Hi all,

I was able to restore the config for vg01 by following the steps noted above. (copy-pasted exactly as I run the commands which might help novices).

Pete, Robert and Ganesan gave their excellent answers within no time.

Thanks all again,
Ram.