Mabuhay

Hello world! This is it. I've always wanted to blog. I don't want no fame but just to let myself heard. No! Just to express myself. So, I don't really care if someone believes in what I'm going to write here nor if ever someone gets interested reading it. My blogs may be a novel-like, a one-liner, it doesn't matter. Still, I'm willing to listen to your views, as long as it justifies mine... Well, enjoy your stay, and I hope you'll learn something new because I just did and sharing it with you.. Welcome!

Wednesday, April 30, 2008

LVM: PVG-strict/distributed allocation

It's a bit "incomplete". My goal is to make an example of creating an FS, a striped that is but, unfortunately, what was assigned to me covers only the PVG-strict/distributed allocation with 1TB in size. But still hoping that this will create an interest on your part. Btw, we usually do this sequence which a bit [again] proven. Enjoy.

================================
1. I first checked if the allocated LUNs are still available for this FS creation. [Of course, all here are available..].

[root@hpux01:/home/user17]
# for i in `more 20080429diskinfo.rpt | grep -i lvm | grep -v "0(" | sort -u | awk '{print $1}'`
> do
> strings /etc/lvmtab | grep ${i}
> echo "--------------"
> pvdisplay /dev/dsk/${i}
> echo "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
> done

--------------
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c52t10d7" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c52t10d7".
XXXXXXXXXXXXXXXXXXXXXXXXXXX
--------------
.....
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c82t2d7" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c82t2d7".
XXXXXXXXXXXXXXXXXXXXXXXXXXX
--------------
pvdisplay: Couldn't find the volume group to which
physical volume "/dev/dsk/c82t3d0" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c82t3d0".
XXXXXXXXXXXXXXXXXXXXXXXXXXX

[root@hpux01:/home/user17]
#


================================
2. Just like before, we will initialize the LUNs for LVM use.

[root@hpux01:/home/user17]
# for i in `cat LUNs.txt`
> do
> pvcreate /dev/rdsk/${i}
> echo "----------"
> done
Physical volume "/dev/rdsk/c52t3d0" has been successfully created.
----------
.....
Physical volume "/dev/rdsk/c82t2d7" has been successfully created.
----------
Physical volume "/dev/rdsk/c82t3d0" has been successfully created.
----------

[root@hpux01:/home/user17]
#

================================
3. Create the device file for the VG group.

[root@hpux01:/home/user17]
# mkdir -p /dev/vg_name

[root@hpux01:/home/user17]
# ll -d /dev/vg_name
drwxr-xr-x 2 root sys 96 Apr 30 03:43 /dev/vg_name

[root@hpux01:/home/user17]
# mknod /dev/vg_name/group c 64 0x330000

[root@hpux01:/home/user17]
# ll /dev/vg_name/group
crw-r--r-- 1 root sys 64 0x330000 Apr 30 03:44 /dev/vg_name/group

[root@hpux01:/home/user17]
#

================================
4. Let's make a VG with the following characteristics:

a. Maximum number of LUNs set to 64 - this limits the number of disk that can be added to the volume group to 64
b. PE size of 64MB
c. extent size of 15000 - this addresses the number of extents that can be created on a disk. If this is not specified, it'll take the maximum number of extents that can be created on the first disk joined to the VG. Which will limit the usage of other LUNs bigger [in capacity] than the initialized disk.
Ex: If you initialize a disk with size 8GB w/out specifying -e flag, when you join a disk bigger than 8GB, it'll limit only the usage of this disk to 8GB. I hope you get the picture, if NOT, leave a comment. I'd be happy to answer.
d. Create a PVG

4.1. This is just an initialization. I made a li'l script below which will add other disks.
# vgcreate -p 64 -s 64 -e 15000 -g PVG0 /dev/vg_name /dev/dsk/c52t3d0

4.2. Add the remaining primary disks.
# for i in `cat LUNs.txt`
> do
> vgextend -g PVG0 vg_name /dev/dsk/${i}
> echo "---"
> done


4.3. Add the alternate links.
# for i in `cat Alt_LUNs.txt`
> do
> vgextend /dev/vg_name /dev/dsk/${i}
> echo "---- PV Link added ----"
> done


================================
5. Create the LV with PVG-strict/distributed allocation.

[root@hpux01:/home/user17]
# lvcreate -L 1044480 -n lv_data7 -s g -D y /dev/vg_name
Logical volume "/dev/vg_name/lv_data7" has been successfully created with
character device "/dev/vg_name/rlv_data7".
Logical volume "/dev/vg_name/lv_data7" has been successfully extended.
Volume Group configuration for /dev/vg_name has been saved in /etc/lvmconf/vg_name.conf

[root@hpux01:/home/user17]
# lvdisplay /dev/vg_name/lv_data7
--- Logical volumes ---
LV Name /dev/vg_name/lv_data7
VG Name /dev/vg_name
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 1044480
Current LE 16320
Allocated PE 16320
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation PVG-strict/distributed
IO Timeout (Seconds) default

[root@hpux01:/home/user17]


================================
6. For comparison purpose [will be referenced for the creation].

# mkfs -m /dev/vg_old_name/lv_data6
mkfs -F vxfs -o ninode=unlimited,bsize=8192,version=4,inosize=256,logsize=256,largefiles /dev/vg_old_name/lv_data6 1069547520


================================
7. Format for FS usage [enabling large file support].

[root@hpux01:/home/user17]
# newfs -F vxfs -o largefiles /dev/vg_name/rlv_data7
version 4 layout
1069547520 sectors, 133693440 blocks of size 8192, log size 256 blocks
unlimited inodes, largefiles supported
133693440 data blocks, 133688056 free data blocks
4080 allocation units of 32768 blocks, 32768 data blocks

[root@hpux01:/home/user17]
# mkfs -m /dev/vg_name/lv_data7
mkfs: /etc/default/fs is used for determining the file system type
mkfs -F vxfs -o ninode=unlimited,bsize=8192,version=4,inosize=256,logsize=256,largefiles /dev/vg_name/lv_data7 1069547520

[root@hpux01:/home/user17]
#


================================
8. Create the mount point; add entry in the fstab, and mount.

[root@hpux01:/home/user17]
# mkdir -p /mount/point/sapdata7

[root@hpux01:/home/user17]
# ll -d /mount/point/sapdata7
drwxr-xr-x 2 root sys 96 Apr 30 04:23
/mount/point/sapdata7

[root@hpux01:/home/user17]
# vi /etc/fstab
...
/dev/vg_old_name/lv_data6
/mount/point/sapdata6 vxfs log 0 0
/dev/vg_name/lv_data7
/mount/point/sapdata7 vxfs log 0 0

[root@hpux01:/home/user17]
# mount
/mount/point/sapdata7

[root@hpux01:/home/user17]
# bdf
/mount/point/sapdata7
Filesystem kbytes used avail %used Mounted on
/dev/vg_name/lv_data7
1069547520 35032 1061156936 0%
/mount/point/sapdata7

[root@hpux01:/home/user17]
#


================================
9. Change ownership and/or permissions as needed.

[root@hpux01:/home/user17]
# chown -R oraf6r:dba
/mount/point/sapdata7

[root@hpux01:/home/user17]
# ll -d
/mount/point/sapdata7
drwxr-xr-x 3 oraf6r dba 96 Apr 30 04:21 /mount/point/sapdata7

[root@hpux01:/home/user17]
#

================================
These were used when I have to re-create the VG.

A. Reducing the VG until 1 LUN is left.

for i in `cat /root/list_LUNs.txt`
do
echo "-----"
vgreduce /dev/vg_name $i
pvdisplay $i
echo "-----"
done


B. Removing the VG.
vgremove
/dev/vg_name

C. Removing the LV.
lvremove /dev/vg_name/lv_data7

1 comment:

  1. When mounting several, rather than mounting all and get errors of already mounted FS, try to execute this:

    # mount -aF FS_type -eQ

    This mounts FS of the type, in verbose mode, and "suppressing" errors reported from already mounted FSes.

    ReplyDelete

World Clock