Friday, February 12, 2010

Create logical volumes in HP-UX

I have been requested some time ago by one of our DBA’s to assist in building some test environments. We do currently have some HP-UX systems available as test environments. Problem is that those servers have been used in the past couple of years for all kind of test environments and for some reason people decided to organize the disks and logical volumes in a strange way by dividing them all in small parts where we will be in need of some large logical volumes to be able to install Oracle EBS R12.

To be able to get a large /u01 mount to be able to install Oracle EBS R12 on HP-UX I have taken the following steps:

(1) Identify how the disks are currently arranged. You can use the standard df command for this.


cjibu601:root-/ # df -k
/appora/cjibow (/dev/vg00/dbsoft ) : 19662197 total allocated Kb
19639976 free allocated Kb
22221 used allocated Kb
0 % allocation used
/asmbck (/dev/vg00/asmbck ) : 62916663 total allocated Kb
62883134 free allocated Kb
33529 used allocated Kb
0 % allocation used
/backup (/dev/vg00/backup ) : 97305244 total allocated Kb
77897028 free allocated Kb
19408216 used allocated Kb
19 % allocation used
/home (/dev/vg00/lvol5 ) : 130920 total allocated Kb
22928 free allocated Kb
107992 used allocated Kb
82 % allocation used
/mnt/test (/dev/vg00/test ) : 19662196 total allocated Kb
19639975 free allocated Kb
22221 used allocated Kb
0 % allocation used
/opt (/dev/vg00/lvol6 ) : 6533208 total allocated Kb
2597920 free allocated Kb
3935288 used allocated Kb
60 % allocation used
/oradata (/dev/vg00/oradata ) : 98306681 total allocated Kb
98263900 free allocated Kb
42781 used allocated Kb
0 % allocation used
/tmp (/dev/vg00/lvol4 ) : 521568 total allocated Kb
458424 free allocated Kb
63144 used allocated Kb
12 % allocation used
/usr (/dev/vg00/lvol7 ) : 6392288 total allocated Kb
3854232 free allocated Kb
2538056 used allocated Kb
39 % allocation used
/var (/dev/vg00/lvol8 ) : 4710776 total allocated Kb
1003760 free allocated Kb
3707016 used allocated Kb
78 % allocation used
/stand (/dev/vg00/lvol1 ) : 391712 total allocated Kb
204008 free allocated Kb
187704 used allocated Kb
47 % allocation used
/ (/dev/vg00/lvol3 ) : 654256 total allocated Kb
214200 free allocated Kb
440056 used allocated Kb
67 % allocation used
cjibu601:root-/ #



(2) Now we do know what is mounted and where they are mounted so we will be able to take a closer look at the logical volumes. You can check the settings of a logical volume in HP-UX by using the lvdisplay command. For example a lvdisplay on /dev/vg00/backup


cjibu601:root-/tmp # lvdisplay /dev/vg00/backup
--- Logical volumes ---
LV Name /dev/vg00/backup
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 100096
Current LE 782
Allocated PE 782
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default



(3) After we have found all the information we needed we can remove the logical volumes. First you have to unmount them by using umount. When the logical volumes you want to remove are dismounted you can remove them by using lvremove. For example lvremove /dev/vg00/backup


(4) After removing all the unwanted logical volumes you want to do some housekeeping by removing all the references in /etc/fstab and removing the mountpoint on your filesystem. This will prevent you system from trying to mount a logical volume in the future which is no longer existing because you just removed it.


(5) Now you can create a large new logical volume. One can do so by using the command lvcreate. When executing lvcreate you need to give some extra information. –L is the size you want it to have in MB’s, -n is the name you want your logical volume to have. In our case that is u01 and you have to state what logical volume group it will be part of. This last one is in our case /dev/vg00

This will end up in the following:


cjibu601:root-/dev/vg00 # lvcreate -L 319232 -n u01 /dev/vg00
Logical volume "/dev/vg00/u01" has been successfully created with
character device "/dev/vg00/ru01".
Logical volume "/dev/vg00/u01" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
cjibu601:root-/dev/vg00 #



(6) Now we have a new logical volume named u01 which is located at /dev/vg00/u01 all we have to do now is to make sure we get a filesystem on this one. One can do so by executing the newfs command. Please note that we do NOT use /dev/vg00/u01 we do use in this case /dev/vg00/ru01 .


cjibu601:root-/dev/vg00 # newfs -F vxfs /dev/vg00/ru01
version 6 layout
326893568 sectors, 326893568 blocks of size 1024, log size 16384 blocks
largefiles supported
cjibu601:root-/dev/vg00 #



(7) Now you can add this to your /etc/fstab file and mount your new logical volume.
Post a Comment