UnixPedia : HPUX / LINUX / SOLARIS: HPUX : How to rename a Volume group in LVM,

Wednesday, July 16, 2014

HPUX : How to rename a Volume group in LVM,

How to rename a volume group in LVM

Overview
 How to rename a Volume group in LVM
Procedures

Create a vg_test and rename it to vg_original.
#-> vgdisplay -v /dev/vg_test
--- Volume groups ---
VG Name                     /dev/vg_test
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      0     
Open LV                     0     
Max PV                      255   
Cur PV                      4     
Act PV                      4     
Max PE per PV               10000       
VGDA                        8  
PE Size (Mbytes)            128            
Total PE                    1596   
Alloc PE                    0      
Free PE                     1596   
Total PVG                   1       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 318750g   
VG Max Extents              2550000      


   --- Physical volumes ---
   PV Name                     /dev/disk/disk68
   PV Status                   available               
   Total PE                    399    
   Free PE                     399    
   Autoswitch                  On       
   Proactive Polling           On              

   PV Name                     /dev/disk/disk72
   PV Status                   available               
   Total PE                    399    
   Free PE                     399    
   Autoswitch                  On       
   Proactive Polling           On              

   PV Name                     /dev/disk/disk73
   PV Status                   available               
   Total PE                    399    
   Free PE                     399    
   Autoswitch                  On       
   Proactive Polling           On              

   PV Name                     /dev/disk/disk66
   PV Status                   available               
   Total PE                    399    
   Free PE                     399    
   Autoswitch                  On       
   Proactive Polling           On              


   --- Physical volume groups ---
   PVG Name                    PVG001
   PV Name                     /dev/disk/disk68
   PV Name                     /dev/disk/disk72
   PV Name                     /dev/disk/disk73
   PV Name                     /dev/disk/disk66



#-> vgdisplay /dev/vg_test
--- Volume groups ---
VG Name                     /dev/vg_test
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      0     
Open LV                     0     
Max PV                      255   
Cur PV                      4     
Act PV                      4     
Max PE per PV               10000       
VGDA                        8  
PE Size (Mbytes)            128            
Total PE                    1596   
Alloc PE                    0      
Free PE                     1596   
Total PVG                   1       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 318750g   
VG Max Extents              2550000      


#-> #Rename the vg vg_test to vg_original

#-> vgexport -s -v -m vg_test.mapfile vg_test
Beginning the export process on Volume Group "vg_test".
vgexport: Volume group "vg_test" is still active.
vgexport: Couldn't export volume group "vg_test".

#-> ll vg_test.mapfile
vg_test.mapfile not found

#-> vgexport -p -s -v -m vg_test.mapfile vg_test
Beginning the export process on Volume Group "vg_test".
vgexport: Volume group "vg_test" is still active.
/dev/disk/disk68
/dev/disk/disk72
/dev/disk/disk73
/dev/disk/disk66
vgexport: Preview of vgexport on volume group "vg_test" succeeded.

Deactivate the volume group by entering the following command

#-> vgchange -a n vg_test
Volume group "vg_test" has been successfully changed.


If you want to retain the same minor number for the volume group, examine the volume group's
group file as follows

#-> ll /dev/vg_test/group
crw-r--r--   1 root       sys         64 0x280000 Jul  8 08:20 /dev/vg_test/group


Remove the volume group device files and its entry from the LVM configuration files by entering
the following command:
#-> vgexport vg_test
Physical volume "/dev/disk/disk68" has been successfully deleted from
physical volume group "PVG001".
Physical volume "/dev/disk/disk72" has been successfully deleted from
physical volume group "PVG001".
Physical volume "/dev/disk/disk73" has been successfully deleted from
physical volume group "PVG001".
Physical volume "/dev/disk/disk66" has been successfully deleted from
physical volume group "PVG001".
vgexport: Volume group "vg_test" has been successfully removed.

#-> mkdir /dev/vg_original

#-> mknod /dev/vg_original/group c 64 0x280000

#-> vgimport -s -v -m vg_test.mapfile /dev/vg_original
The legacy naming model has been disabled on the system.
Try with the -N option.

Add the volume group entry back to the LVM configuration files using the vgimport command
as follows use new volume group name to import the information:

#-> vgimport -s -v -N -m vg_test.mapfile /dev/vg_original
Beginning the import process on Volume Group "/dev/vg_original".
vgimport: Volume group "/dev/vg_original" 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.

Activate the newly imported volume group as follows:

#-> vgdisplay /dev/vg_original
vgdisplay: Volume group not activated.
vgdisplay: Cannot display volume group "/dev/vg_original".

#-> vgchange -a y /dev/vg_original
Activated volume group.
Volume group "/dev/vg_original" has been successfully changed.

#-> vgdisplay /dev/vg_original
--- Volume groups ---
VG Name                     /dev/vg_original
VG Write Access             read/write    
VG Status                   available                
Max LV                      255   
Cur LV                      0     
Open LV                     0     
Max PV                      255   
Cur PV                      4     
Act PV                      4     
Max PE per PV               10000       
VGDA                        8  
PE Size (Mbytes)            128            
Total PE                    1596   
Alloc PE                    0      
Free PE                     1596   
Total PVG                   0       
Total Spare PVs             0             
Total Spare PVs in use      0                    
VG Version                  1.0      
VG Max Size                 318750g   
VG Max Extents              2550000   

Back up the volume group configuration as follows
#-> vgcfgbackup   /dev/vg_original

Keywords.                                                                                                                                           
vgimport , vgexport

No comments:

Post a Comment