UnixPedia : HPUX / LINUX / SOLARIS: How to Create a Stripe - logical Volume File System in LVM

Wednesday, February 4, 2015

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>

No comments:

Post a Comment