UnixPedia : HPUX / LINUX / SOLARIS: FileSystem Administration
Showing posts with label FileSystem Administration. Show all posts
Showing posts with label FileSystem Administration. Show all posts

Wednesday, February 4, 2015

How to Create rename a volume group in LVM



#-> 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

How to Create a Stripe - logical Volume File System in LVM


1.    Determine the disk's associated device file. To show the disks attached to the system and their
device file names, enter the ioscan command with the -f, -N, and -n options.

#-> cat >ldev
6D:6F
6D:70
6D:71
6D:72

Execute the xpinfo to collect the ldev and array information.
#/usr/contrib/bin/xpinfo    -il   >xpinfo.out

#collect
#-> cat ldev|while read i
> do
> cat xpout.info |grep -i $i |grep -i 66657
> done
/dev/rdisk/disk68            d1  --- 9e  CL6R  6d:6f  OPEN-V           00066657
/dev/rdisk/disk72            d1  --- 9f  CL6R  6d:70  OPEN-V           00066657
/dev/rdisk/disk73            dc  --- a0  CL5R  6d:71  OPEN-V           00066657
/dev/rdisk/disk66            dc  --- a1  CL5R  6d:72  OPEN-V           00066657

#-> cat >rdisk
/dev/rdisk/disk68
/dev/rdisk/disk72
/dev/rdisk/disk73
/dev/rdisk/disk66

Once disk are sure that not part of any lvm configuration.
#-> strings /etc/lvmtab|grep -iE "disk68|disk72|disk73|disk66"

#-> cat rdisk |sed  "s/rdisk/disk/" |while read i
> do
> strings /etc/lvmtab |grep -w $i
> done

#-> cat rdisk |sed  "s/rdisk/disk/" |while read i
> do
> pvdisplay $i
> done
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk68" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk68".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk72" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk72".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk73" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk73".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk66" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk66".

#-> cat rdisk |while read i
> do
> pvcreate $i
> done
Physical volume "/dev/rdisk/disk68" has been successfully created.
Physical volume "/dev/rdisk/disk72" has been successfully created.
Physical volume "/dev/rdisk/disk73" has been successfully created.
Physical volume "/dev/rdisk/disk66" has been successfully created.


2.     Create a directory for the volume group. For example:
# mkdir /dev/vgname
#mkdir /dev/vg_testdata

By convention, vgname is vgnn, where nn is a unique number across all volume groups.
However, you can choose any unique name up to 255 characters.   

3.     Create a device file named group in the volume group directory with the mknod command.
For example:

# mknod /dev/vgname/group c major 0xminor

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

The c following the device file name specifies that group is a character device file.
major is the major number for the group device file. For a Version 1.0 volume group, it is
64. For a Version 2.x volume group, it is 128.
  
4.    To create a Version 1.0 volume group, use the vgcreate command, specifying each physical
volume to be included. For example:

#->cp -p /etc/lvmab  /etc/lvmab.mmddyyyy

#-> vgcreate  /dev/vg_test /dev/disk/disk68 /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
Increased the number of physical extents per phy
sical volume to 12800.
Volume group "/dev/vg_test" has been successfully created.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

You can set volume group attributes using the following options:
-V 1.0 Version 1.0 volume group (default)
-s pe_size Size of a physical extent in MB (default 4)
-e max_pe Maximum number of physical extents per physical volume (default 1016)
-l max_lv Maximum number of logical volumes (default 255)
-p max_pv Maximum number of physical volumes (default 255)
The size of a physical volume is limited by pe_size times max_pe. If you plan to assign a disk
larger than approximately 4 GB (1016 * 4 MB) to this volume group, use a larger value of pe_size
or max_pe.

#-> vgcreate -l 255 -p 255 -s 128 -e 10000 /dev/vg_test /dev/disk/disk68
Volume group "/dev/vg_test" has been successfully created.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

Check the attribute of Volume group:
#-> 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                      16
Cur PV                      4
Act PV                      4
Max PE per PV               12800
VGDA                        8
PE Size (Mbytes)            4
Total PE                    51196
Alloc PE                    0
Free PE                     51196
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 800g
VG Max Extents              204800
   
5.    Add the physical volume to the volume group using the vgextend command and the block
 file for the disk. For example:

#-> vgextend /dev/vg_test /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
Volume group "/dev/vg_test" has been successfully extended.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

#-> 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                      16
Cur PV                      4
Act PV                      4
Max PE per PV               12800
VGDA                        8
PE Size (Mbytes)            4
Total PE                    51196
Alloc PE                    0
Free PE                     51196
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 800g
VG Max Extents              204800

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

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

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

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

6.    To create a logical volume, follow these steps:
6.1    Decide how much disk space the logical volume needs. Calculate the size of the LV and decide the name of  LV : example:

#->  lvcreate -i 4 -I  128 -n Lv_test /dev/vg_test
Logical volume "/dev/vg_test/Lv_test" has been successfully created with
character device "/dev/vg_test/rLv_test".
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

6.2    Allocate 1GB to   the logical volume

#-> lvextend -L 1024M /dev/vg_test/Lv_test
Logical volume "/dev/vg_test/Lv_test" has been successfully extended.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

#-> lvdisplay /dev/vg_test/Lv_test
--- Logical volumes ---
LV Name                     /dev/vg_test/Lv_test
VG Name                     /dev/vg_test
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    striped
LV Size (Mbytes)            1024
Current LE                  8
Allocated PE                8
Stripes                     4
Stripe Size (Kbytes)        128
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default


7.    To create a logical volume run newfs to raw lv

#-> newfs -F vxfs -o largefiles -b 8192 /dev/vg_test/rLv_test
   version 7 layout
   1048576 sectors, 131072 blocks of size 8192, log size 2048 blocks
   largefiles supported
8.    Check the type of file system. For example:
#-> /usr/sbin/fstyp  /dev/vg_test/rLv_test
             Vxfs
      #-> /usr/sbin/fstyp -v /dev/vg_test/rLv_test
vxfs
version: 7
f_bsize: 8192
f_frsize: 8192
f_blocks: 131072
    f_bfree: 128863
    f_bavail: 127857
    f_files: 32224
    f_ffree: 32192
    f_favail: 32192
    f_fsid: 1076363265
    f_basetype: vxfs
    f_namemax: 254
    f_magic: a501fcf5
    f_featurebits: 0
    f_flag: 16
    f_fsindex: 10
    f_size: 131072

9.    Create a mount point for mouting of Logical Volume.
#mkdir /oracle/Test

10.    Mount /dev/vg_test/Lv_test on /oracle/Test with correct option as per performance guidelines.
#-> mount  /dev/vg_test/Lv_test /test

#-> bdf /test
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg_test/Lv_test
                   1048576   17672 1022864    2% /test
11.    Check the mount option from mnttab.
#-> mount -v |grep -i test
/dev/vg_test/Lv_test on /test type vxfs ioerror=mwdisable,largefiles,delaylog,dev=40280001 on Tue Jul  8 08:57:31 2014

12.    Check the load balancing for the disk

For 11iv3 systems make sure the load balance policy is also set on the newly added disk:
Verify LB policy: scsimgr -p get_attr all_lun -a device_file -a load_bal_policy
Set LB policy on all disks: scsimgr save_attr -N "/escsi/esdisk" -a load_bal_policy=<LB policy>
Set LB policy on one disk :  scsimgr save_attr -D /dev/rdisk/disk530 -a load_bal_policy=<LB policy>

How to Create a Strict-Distributed- logical Volume File System in LVM


1.    Determine the disk's associated device file. To show the disks attached to the system and their
device file names, enter the ioscan command with the -f, -N, and -n options.
#-> cat >ldev
6D:6F
6D:70
6D:71
6D:72

Execute the xpinfo to collect the ldev and array information.
#/usr/contrib/bin/xpinfo    -il   >xpinfo.out

#collect
#-> cat ldev|while read i
> do
> cat xpout.info |grep -i $i |grep -i 66657
> done
/dev/rdisk/disk68            d1  --- 9e  CL6R  6d:6f  OPEN-V           00066657
/dev/rdisk/disk72            d1  --- 9f  CL6R  6d:70  OPEN-V           00066657
/dev/rdisk/disk73            dc  --- a0  CL5R  6d:71  OPEN-V           00066657
/dev/rdisk/disk66            dc  --- a1  CL5R  6d:72  OPEN-V           00066657

#-> cat >rdisk
/dev/rdisk/disk68
/dev/rdisk/disk72
/dev/rdisk/disk73
/dev/rdisk/disk66

Once disk are sure that not part of any lvm configuration.
#-> strings /etc/lvmtab|grep -iE "disk68|disk72|disk73|disk66"

#-> cat rdisk |sed  "s/rdisk/disk/" |while read i
> do
> strings /etc/lvmtab |grep -w $i
> done

#-> cat rdisk |sed  "s/rdisk/disk/" |while read i
> do
> pvdisplay $i
> done
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk68" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk68".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk72" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk72".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk73" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk73".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk66" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk66".

#-> cat rdisk |while read i
> do
> pvcreate $i
> done
Physical volume "/dev/rdisk/disk68" has been successfully created.
Physical volume "/dev/rdisk/disk72" has been successfully created.
Physical volume "/dev/rdisk/disk73" has been successfully created.
Physical volume "/dev/rdisk/disk66" has been successfully created.


2.     Create a directory for the volume group. For example:
# mkdir /dev/vgname
#mkdir /dev/vg_testdata

By convention, vgname is vgnn, where nn is a unique number across all volume groups.
However, you can choose any unique name up to 255 characters.   

3.     Create a device file named group in the volume group directory with the mknod command.
For example:

# mknod /dev/vgname/group c major 0xminor

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

The c following the device file name specifies that group is a character device file.
major is the major number for the group device file. For a Version 1.0 volume group, it is
64. For a Version 2.x volume group, it is 128.
  
4.    To create a Version 1.0 volume group, use the vgcreate command, specifying each physical
volume to be included. For example:

#->cp -p /etc/lvmpvg /etc/lvmpvg.mmddyyyy
#->cp –p /etc/lvmab  /etc/lvmab.mmddyyyy

#-> vgcreate  /dev/vg_test /dev/disk/disk68 /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
Increased the number of physical extents per phy
sical volume to 12800.
Volume group "/dev/vg_test" has been successfully created.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

You can set volume group attributes using the following options:
-V 1.0 Version 1.0 volume group (default)
-s pe_size Size of a physical extent in MB (default 4)
-e max_pe Maximum number of physical extents per physical volume (default 1016)
-l max_lv Maximum number of logical volumes (default 255)
-p max_pv Maximum number of physical volumes (default 255)
The size of a physical volume is limited by pe_size times max_pe. If you plan to assign a disk
larger than approximately 4 GB (1016 * 4 MB) to this volume group, use a larger value of pe_size
or max_pe.

#-> vgcreate -l 255 -p 255 -s 128 -e 10000 /dev/vg_test /dev/disk/disk68
Volume group "/dev/vg_test" has been successfully created.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

Check the attribute of Volume group:
#-> 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                      16
Cur PV                      4
Act PV                      4
Max PE per PV               12800
VGDA                        8
PE Size (Mbytes)            4
Total PE                    51196
Alloc PE                    0
Free PE                     51196
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 800g
VG Max Extents              204800
   
5.    Add the physical volume to the volume group using the vgextend command and the block
 file for the disk. For example:

#-> vgextend /dev/vg_test /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
Volume group "/dev/vg_test" has been successfully extended.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

To create a PVG :

#vgextend -g PVG001 /dev/vg_test /dev/disk/disk68 /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
#-> 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

6.    To create a logical volume, follow these steps:
6.1    Decide how much disk space the logical volume needs. Calculate the size of the LV and decide the name of  LV : example:

#-> lvcreate -D y -s g -n Lv_test /dev/vg_test
Logical volume "/dev/vg_test/Lv_test" has been successfully created with
character device "/dev/vg_test/rLv_test".
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf


6.2    Allocate 1GB to   the logical volume

#-> lvextend -L 1024M /dev/vg_test/Lv_test PVG001
Logical volume "/dev/vg_test/Lv_test" has been successfully extended.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf


#-> lvdisplay /dev/vg_test/Lv_test
--- Logical volumes ---
LV Name                     /dev/vg_test/Lv_test
VG Name                     /dev/vg_test
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            1024
Current LE                  8
Allocated PE                8
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  PVG-strict/distributed
IO Timeout (Seconds)        default



7.    To create a logical volume run newfs to raw lv

#-> newfs -F vxfs -o largefiles -b 8192 /dev/vg_test/rLv_test
   version 7 layout
   1048576 sectors, 131072 blocks of size 8192, log size 2048 blocks
   largefiles supported
8.    Check the type of file system. For example:
#-> /usr/sbin/fstyp  /dev/vg_test/rLv_test
             Vxfs
      #-> /usr/sbin/fstyp -v /dev/vg_test/rLv_test
vxfs
version: 7
f_bsize: 8192
f_frsize: 8192
f_blocks: 131072
    f_bfree: 128863
    f_bavail: 127857
    f_files: 32224
    f_ffree: 32192
    f_favail: 32192
    f_fsid: 1076363265
    f_basetype: vxfs
    f_namemax: 254
    f_magic: a501fcf5
    f_featurebits: 0
    f_flag: 16
    f_fsindex: 10
    f_size: 131072

9.    Create a mount point for mouting of Logical Volume.
#mkdir /oracle/Test

10.    Mount /dev/vg_test/Lv_test on /oracle/Test with correct option as per performance guidelines.
#-> mount  /dev/vg_test/Lv_test /test

#-> bdf /test
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg_test/Lv_test
                   1048576   17672 1022864    2% /test
11.    Check the mount option from mnttab.
#-> mount -v |grep -i test
/dev/vg_test/Lv_test on /test type vxfs ioerror=mwdisable,largefiles,delaylog,dev=40280001 on Tue Jul  8 08:57:31 2014

12.    Check the load balancing for the disk

For 11iv3 systems make sure the load balance policy is also set on the newly added disk:
Verify LB policy: scsimgr -p get_attr all_lun -a device_file -a load_bal_policy
Set LB policy on all disks: scsimgr save_attr -N "/escsi/esdisk" -a load_bal_policy=<LB policy>
Set LB policy on one disk :  scsimgr save_attr -D /dev/rdisk/disk530 -a load_bal_policy=<LB policy>

How to Create a Strict - logical Volume File System in LVM


1.    Determine the disk's associated device file. To show the disks attached to the system and their
device file names, enter the ioscan command with the -f, -N, and -n options.


#-> cat >ldev
6D:6F
6D:70
6D:71
6D:72

Execute the xpinfo to collect the ldev and array information.
#/usr/contrib/bin/xpinfo    -il   >xpinfo.out

#collect
#-> cat ldev|while read i
> do
> cat xpout.info |grep -i $i |grep -i 66657
> done
/dev/rdisk/disk68            d1  --- 9e  CL6R  6d:6f  OPEN-V           00066657
/dev/rdisk/disk72            d1  --- 9f  CL6R  6d:70  OPEN-V           00066657
/dev/rdisk/disk73            dc  --- a0  CL5R  6d:71  OPEN-V           00066657
/dev/rdisk/disk66            dc  --- a1  CL5R  6d:72  OPEN-V           00066657

#-> cat >rdisk
/dev/rdisk/disk68
/dev/rdisk/disk72
/dev/rdisk/disk73
/dev/rdisk/disk66

Once disk are sure that not part of any lvm configuration.
#-> strings /etc/lvmtab|grep -iE "disk68|disk72|disk73|disk66"

#-> cat rdisk |sed  "s/rdisk/disk/" |while read i
> do
> strings /etc/lvmtab |grep -w $i
> done

#-> cat rdisk |sed  "s/rdisk/disk/" |while read i
> do
> pvdisplay $i
> done
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk68" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk68".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk72" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk72".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk73" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk73".
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/disk/disk66" belongs.
pvdisplay: Cannot display physical volume "/dev/disk/disk66".

#-> cat rdisk |while read i
> do
> pvcreate $i
> done
Physical volume "/dev/rdisk/disk68" has been successfully created.
Physical volume "/dev/rdisk/disk72" has been successfully created.
Physical volume "/dev/rdisk/disk73" has been successfully created.
Physical volume "/dev/rdisk/disk66" has been successfully created.


2.     Create a directory for the volume group. For example:
# mkdir /dev/vgname
#mkdir /dev/vg_testdata

By convention, vgname is vgnn, where nn is a unique number across all volume groups.
However, you can choose any unique name up to 255 characters.   

3.     Create a device file named group in the volume group directory with the mknod command.
For example:

# mknod /dev/vgname/group c major 0xminor

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

The c following the device file name specifies that group is a character device file.
major is the major number for the group device file. For a Version 1.0 volume group, it is
64. For a Version 2.x volume group, it is 128.
  
4.    To create a Version 1.0 volume group, use the vgcreate command, specifying each physical
volume to be included. For example:

#-> vgcreate  /dev/vg_test /dev/disk/disk68 /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
Increased the number of physical extents per phy
sical volume to 12800.
Volume group "/dev/vg_test" has been successfully created.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

You can set volume group attributes using the following options:
-V 1.0 Version 1.0 volume group (default)
-s pe_size Size of a physical extent in MB (default 4)
-e max_pe Maximum number of physical extents per physical volume (default 1016)
-l max_lv Maximum number of logical volumes (default 255)
-p max_pv Maximum number of physical volumes (default 255)
The size of a physical volume is limited by pe_size times max_pe. If you plan to assign a disk
larger than approximately 4 GB (1016 * 4 MB) to this volume group, use a larger value of pe_size
or max_pe.

#-> vgcreate -l 255 -p 255 -s 128 -e 10000 /dev/vg_test /dev/disk/disk68
Volume group "/dev/vg_test" has been successfully created.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

Check the attribute of Volume group:
#-> 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                      16
Cur PV                      4
Act PV                      4
Max PE per PV               12800
VGDA                        8
PE Size (Mbytes)            4
Total PE                    51196
Alloc PE                    0
Free PE                     51196
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 800g
VG Max Extents              204800
   
5.    Add the physical volume to the volume group using the vgextend command and the block
 file for the disk. For example:

#-> vgextend /dev/vg_test /dev/disk/disk72 /dev/disk/disk73 /dev/disk/disk66
Volume group "/dev/vg_test" has been successfully extended.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

#-> 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                      16
Cur PV                      4
Act PV                      4
Max PE per PV               12800
VGDA                        8
PE Size (Mbytes)            4
Total PE                    51196
Alloc PE                    0
Free PE                     51196
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0
VG Max Size                 800g
VG Max Extents              204800

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

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

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

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

6.    To create a logical volume, follow these steps:
6.1    Decide how much disk space the logical volume needs. Calculate the size of the LV and decide the name of  LV : example:
#-> lvcreate -n Lv_test /dev/vg_test
Logical volume "/dev/vg_test/Lv_test" has been successfully created with
character device "/dev/vg_test/rLv_test".
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

6.2    Allocate 1GB to   the logical volume

#-> lvextend -L 1024M /dev/vg_test/Lv_test
Logical volume "/dev/vg_test/Lv_test" has been successfully extended.
Volume Group configuration for /dev/vg_test has been saved in /etc/lvmconf/vg_test.conf

7.    To create a logical volume run newfs to raw lv

#-> newfs -F vxfs -o largefiles -b 8192 /dev/vg_test/rLv_test
   version 7 layout
   1048576 sectors, 131072 blocks of size 8192, log size 2048 blocks
   largefiles supported
8.    Check the type of file system. For example:
#-> /usr/sbin/fstyp  /dev/vg_test/rLv_test
             Vxfs
      #-> /usr/sbin/fstyp -v /dev/vg_test/rLv_test
vxfs
version: 7
f_bsize: 8192
f_frsize: 8192
f_blocks: 131072
    f_bfree: 128863
    f_bavail: 127857
    f_files: 32224
    f_ffree: 32192
    f_favail: 32192
    f_fsid: 1076363265
    f_basetype: vxfs
    f_namemax: 254
    f_magic: a501fcf5
    f_featurebits: 0
    f_flag: 16
    f_fsindex: 10
    f_size: 131072

9.    Create a mount point for mouting of Logical Volume.
#mkdir /oracle/Test

10.    Mount /dev/vg_test/Lv_test on /oracle/Test with correct option as per performance guidelines.
#-> mount  /dev/vg_test/Lv_test /test

#-> bdf /test
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg_test/Lv_test
                   1048576   17672 1022864    2% /test
11.    Check the mount option from mnttab.
#-> mount -v |grep -i test
/dev/vg_test/Lv_test on /test type vxfs ioerror=mwdisable,largefiles,delaylog,dev=40280001 on Tue Jul  8 08:57:31 2014

12.    Check the load balancing for the disk

For 11iv3 systems make sure the load balance policy is also set on the newly added disk:
Verify LB policy: scsimgr -p get_attr all_lun -a device_file -a load_bal_policy
    Set LB policy on all disks: scsimgr save_attr -N "/escsi/esdisk" -a load_bal_policy=<LB policy>
Set LB policy on one disk:  scsimgr save_attr -D /dev/rdisk/disk530 -a load_bal_policy=<LB policy>

Saturday, October 18, 2014

HPUX : /var utilization "Google "file system Full"


/var file system


1./var file system full 95% , how to delete unwanted files
    #cd /var
    # find . -xdev -size +1000000 -exec ll {} \;

2.why every patch installation /var mount point some save patch file ocupied

1. /var file system full 95%, how to delete unwanted files
          You first have to find them.
           /var/tmp/ is fair game to just remove old files
            Use cleanup(1m) for /var/adm/sw/.

2. why every patch installation /var mount point some save patch file ocupied
In case you want to remove patches, swinstall has to save the previous patches so swremove can put back the older patch.

3.what is cleanup command
See cleanup(1m).  You can use this command to remove superseded patches.  You can select preview (-p) and you can also limit the number (-c N) of copies.

Sunday, September 28, 2014

HPUX : Extending a File system

Extending a File system


Login to the system and follow the procedure given below for extending a filesystem.

1. # bdf /<filesystem to extend>

From the output of the above command note the volume group and logical volume associated with the filesystem.

Check if the VG has the required space to extend the logical volume.

2. # vgdisplay <vg name>

Note the following two parameters from the vgdisplay output.

PE Size (Mbytes)
Free PE

Available free space (in Mb) in the volume group = PE Size (Mbytes) x Free PE

If the VG Status is “available, exclusive” then the VG is cluster aware. If any changes are done to the VG status then the WI for (Extending a file system on a Cluster node.) has to be followed after the last step in this WI.

VG Status available, exclusive

Check if the logical volume that needs to be extended is mirrored.

3. # lvdisplay <lv name>

Note the following 2 parameters from the lvdisplay output.

Mirror copies 1
Allocation PVG-strict

In the case the logical volume is mirrored, then the available free space in the VG should be considered as half of the available free space:
Available free space (in Mb) in the volume group / 2

Also it is a good practice to confirm if the system has Online JFS installed. If not you will need to ask downtime (for the particular file system), from the customer, to extend it.

4. # swlist –l product | grep -i jfs
B3929BA B.11.00 HP OnLineJFS (Advanced VxFS)

If the available space in the VG is enough to extend the LV jump to step 8.

If the space available in the VG doesn’t fit the requirement, request Data Storage team to assign new LUN’s. (follow the WI Creating a Change request for requesting new LUNs” and “Configuring newly assigned LUN on a system”)

Before proceeding for pvcreate confirm the following:

a. Check the size of the disk that you will be adding to the existing VG -

# diskinfo /dev/rdsk/c20t6d2 | grep size
size: 35354880 Kbytes

b. Check the size of disk that can be added to the existing VG –

# vgdisplay vgsap |grep -i -e 'max pe' -e 'pe size'
Max PE per PV 1016
PE Size (Mbytes) 16

The size of the disk that can be added to the VG is = Max PE per PV x PE Size (Mbytes)

In our example the disk with size (1016x16) 16256 Mb can be added. So the

c. Check if the disk/s being configured in the VG are not already in use by another VG, this is just to make double sure you are looking at the correct disks.

5. # strings /etc/lvmtab | grep cXtYdZ

If the above command returns an output then you need to verify if you are looking at the correct disk. Proceed only after confirming.

6. # pvcreate /dev/rdsk/cXtYdZ (use -f option if required to force pvcreate)

Load balancing:
With vgdisplay –v <vgname>, note the sequence of disks under --- Physical volumes ---, and decide which device will be the next primary path.

Considering the output from the above point, extend the VG with the device file of the disk that will be the primary link, first.

7. # vgextend vgname /dev/dsk/<primary path> /dev/dsk/<secondary path>

Note: If powerpath is installed then do not use the alternate link.

Check for powerpath package installed.

# powerrmt display dev=all
If powerpath is installed then it will show the output.

For logical volumes with Allocation policy PVG-strict; edit the /etc/lvmpvg file to add the entry of the device file of the primary link.

8. # lvextend –L <size in Mb> /dev/vgname/lvoln pv_path
<size in Mb> = Total of (Current LV Size (Mbytes) + Add-on size in Mb)

9. # fsadm –b (size in Mb)M /<filesystem name> (use the same value as used in lvextend)

check the outputs of vgdisplay , lvdisplay and bdf to confirm.


Know errors with fsadm

Error:
fsadm -F vxfs -b 4096M /<file system name>
vxfs fsadm: /dev/vgsamba/rlvol1 is currently 2097152 sectors - size will be increased
vxfs fsadm: attempt to resize /dev/vgsamba/rlvol1 failed with errno 28

Solution:
If fsadm returns error 28 while trying to grow a VxFS file system, check to see if the file system is full or almost full. fsadm needs some work space to grow the file system. File system usage can be verified using the df command:
df –F vxfs –k
If error 28 is returned, first try to grow the file system in small increments until there is enough free space to grow to the full amount. If this does not work because the file system is completely full, it will be necessary to delete some files to free up space*. Occasionally, error
28 will be returned even when the file system does not seem to be full. This is usually caused by excessive fragmentation and can be avoided by defragmenting the file systems regularly.

*Move the files to a temporary location and back when the file system is extended


If fsadm fails with error 16 while attempting to resize the file system, one of three conditions exists:
1.) the file system is too busy to be resized
2.) the file system has a snapshot file system mounted on it
3.) the file system has some corruption and needs to be fsck’d

If error 16 occurs, try the following procedures to resolve the problem:
1.) try resizing the file system when it is less busy
2.) verify a snapshot file system is not mounted on it
3.) try unmounting the file system, running fsck, and mounting the file system again


Occasionally, shrinking a file system will fail because inodes and blocks that cannot be moved are allocated in the part of the file system
to be shrunk. When this occurs, defragmenting the file system is necessary. Once again, those situations can be avoided by
defragmenting file systems regularly using fsadm,