Search This Blog

Showing posts with label vgimport. Show all posts
Showing posts with label vgimport. Show all posts

Tuesday, 22 February 2011

Renaming Volume Group in HP Unix

Renaming VG in hpux.
Here is the procedure for renaming a VG in hpux. Renaming a VG is simple as exporting the the VG as importing with different name. (eg: vgapp to vgdb)
1. Verify the existing configuration

#vgdisplay vgapp
VG Name                     /dev/vgapp
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      2
Open LV                     2
Max PV                      16
Cur PV                      4
Act PV                      4
Max PE per PV               1016
VGDA                        8
PE Size (Mbytes)            32
Total PE                    508
Alloc PE                    336
Free PE                     172
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 508g
VG Max Extents              16256


1. Umount all the logical volume from vgapp.
# bdf|grep vgapp
/dev/vgapp/test1   10485760   20062 9811599    0% /apps/test1
# umount /apps/test1



2. Deactivate Vg.

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



3. Create  a map file which can be used whileimporting back . File name is /tmp/vgapp

# vgexport -v \ # -->
-p \   # Preview the actions to be taken without updating lvmtab
-s \ #  Scan option for creating map file
-m /tmp/vgapp vgapp  #description of the volume group and its associated logical volume
Beginning the export process on Volume Group "vgapp".
/dev/disk/disk38
/dev/disk/disk39
/dev/disk/disk40
/dev/disk/disk41
vgexport: Preview of vgexport on volume group "vgapp" succeeded.



4. Export VG

# vgexport vgapp
vgexport: Volume group "vgapp" has been successfully removed.



5. Create device files for vgdb

root@rx16-243   [/root]
# ls -l /dev/*/group
crw-r-----   1 root       sys         64 0x000000 Feb 18 20:30 /dev/vg00/group
# mknod /dev/vgdb/group c 64 0x010000
# ls -l /dev/*/group
crw-r-----   1 root       sys         64 0x000000 Feb 18 20:30 /dev/vg00/group
crw-r--r--   1 root       sys         64 0x010000 Feb 20 04:36 /dev/vgdb/group



6. Import the VG with new name using the mapfile
# vgimport -s -N -m /tmp/vgapp vgdb
vgimport: Volume group "/dev/vgdb" 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.
Note: -N is for pvlink to be in new persistant dsf naming 



7.  Activate the new VG.

# vgchange -a y vgdb
Activated volume group.
Volume group "vgdb" has been successfully changed.



8. Verify the VG and mount the volume

# vgdisplay -v vgdb
--- Volume groups ---
VG Name                     /dev/vgdb
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      2
Open LV                     2
Max PV                      16
Cur PV                      4
Act PV                      4
Max PE per PV               1016
VGDA                        8
PE Size (Mbytes)            32
Total PE                    508
Alloc PE                    336
Free PE                     172
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 508g
VG Max Extents              16256


   --- Logical volumes ---
   LV Name                     /dev/vgdb/test
   LV Status                   available/syncd
   LV Size (Mbytes)            512
   Current LE                  16
   Allocated PE                16
   Used PV                     1


   LV Name                     /dev/vgdb/test1
   LV Status                   available/syncd
   LV Size (Mbytes)            10240
   Current LE                  320
   Allocated PE                320
   Used PV                     3




   --- Physical volumes ---
   PV Name                     /dev/disk/disk38
   PV Status                   available
   Total PE                    127
   Free PE                     0
   Autoswitch                  On
   Proactive Polling           On


   PV Name                     /dev/disk/disk39
   PV Status                   available
   Total PE                    127
   Free PE                     0
   Autoswitch                  On
   Proactive Polling           On


   PV Name                     /dev/disk/disk40
   PV Status                   available
   Total PE                    127
   Free PE                     45
   Autoswitch                  On
   Proactive Polling           On


   PV Name                     /dev/disk/disk41
   PV Status                   available
   Total PE                    127
   Free PE                     127
   Autoswitch                  On
   Proactive Polling           On
# mount /dev/vgdb/test1 /mnt
# bdf /mnt
Filesystem          kbytes    used   avail %used Mounted on
/dev/vgdb/test1    10485760   20062 9811599    0% /mnt


Tuesday, 26 October 2010

Mounting LVM volume after reinstalling Linux

 

Today, I reinstalled my Linux box with latest Redhat version, but I failed to mount the LVS from two application VGs, which are from SAN. Below are the steps how i resolved the issue.

For listing and checking the status of available SAN disks (pv-physical volumes). Here, all three disk are visible including vlgroup00 (its is the OS volume)

[root@test3 ]# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/sda2  VolGroup00 lvm2 a-    29.88G       0
  /dev/sdb1  VolBsl     lvm2 a-    69.97G    2.72G
  /dev/sdc   OraEai     lvm2 a-   170.00G 1020.00M

Below command lists the existing volume groups (VGs) related each disk. Notice the status “Found exported volume group “ in below output, which means, VGs are not exported. Let us import it by next steps. 
[root@test3 ]# vgscan
  Reading all physical volumes.  This may take a while...
  Found exported volume group "OraEai" using metadata type lvm2
  Found exported volume group "VolBsl" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2

Now let us import it.
[root@test3 ]# vgimport OraEai
  Volume group "OraEai" successfully imported
[root@sdl003 mapper]# vgimport VolBsl
  Volume group "VolBsl" successfully imported

Volumes are imported. see the status below.

[root@test3 ]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "OraEai" using metadata type lvm2
  Found volume group "VolBsl" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2

Now let us see the status of logical volumes (LVs) all the volume from above two VGs are inactive. For mounting a volume, it must be ACTIVE status.
[root@test3 ]# lvscan
  inactive          '/dev/OraEai/LvOracle' [10.00 GB] inherit
  inactive          '/dev/OraEai/LvOraEai' [149.00 GB] inherit
  inactive          '/dev/OraEai/LvOraArchive' [10.00 GB] inherit
  inactive          '/dev/VolBsl/LogVol02' [48.81 GB] inherit
  inactive          '/dev/VolBsl/LogVol00' [4.53 GB] inherit
  inactive          '/dev/VolBsl/LogVol01' [3.91 GB] inherit
  inactive          '/dev/VolBsl/home_wbimbprd' [5.00 GB] inherit
  inactive          '/dev/VolBsl/var_mqsi' [5.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [25.97 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [3.91 GB] inherit

Let us activate all volume using lvchange -ay lvname. Here is the single command loop to do the same for all inactive LVs .
[root@test3 ]# for i in `lvscan|grep inactive|awk -F\' {'print $2'}`; do lvchange -ay $i; done
[root@test3 ]# lvscan
  ACTIVE            '/dev/OraEai/LvOracle' [10.00 GB] inherit
  ACTIVE            '/dev/OraEai/LvOraEai' [149.00 GB] inherit
  ACTIVE            '/dev/OraEai/LvOraArchive' [10.00 GB] inherit
  ACTIVE            '/dev/VolBsl/LogVol02' [48.81 GB] inherit
  ACTIVE            '/dev/VolBsl/LogVol00' [4.53 GB] inherit
  ACTIVE            '/dev/VolBsl/LogVol01' [3.91 GB] inherit
  ACTIVE            '/dev/VolBsl/home_wbimbprd' [5.00 GB] inherit
  ACTIVE            '/dev/VolBsl/var_mqsi' [5.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [25.97 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [3.91 GB] inherit

Great…, Now I am able to mount the volume..

[root@test3 ]# mount /dev/mapper/OraEai-LvOraArchive /oracle/eaitest/archive