Thursday, April 24, 2008

HPUX volume management

ioscan -fnC disk # scan for disk dev path
pvcreate -B /dev/rdsk/c3t15d0 # mark disk for use as PV in LVM
dd if=/dev/zero of=/dev/rdsk/c3t15d0 bs=64k count=10
# wipe out obsolete LVM marking on disk so that
# pvcreate will not complain, re run pvcreate cmd

mkdir /dev/vg01
mknod /dev/vg01/group c 64 0xNN0000 # c 64 is disk major number
# 0xNN0000 is uniq minor number hex, try 01, 02, ...
# eg, chk against ls -l /dev/vg*/group

vgcreate -s8 /dev/vg01 /dev/dsk/c3t15d0 # create a new vol grp. w/ Phy Extend = 8 mb

mkboot /dev/rdsk/c3t15d0 # make it bootable disk

lvcreate -C y -r n -L 1024 /dev/vg01 # create contiguous dev lvol1 size 1024 MB
lvcreate -C y -r n -L 1024 /dev/vg01 # ditto, will be named lvol2 automatically

lvlnboot -r /dev/vg01/lvol1 # make lvol1 a boot partition
lvlnboot -s /dev/vg01/lvol2 # make lvol2 a swap dev


newfs -F vxfs /dev/vg01/rlvol1 # create the fs as veritas fs
swapon /dev/vg01/lvol2 # activate swap
vi /etc/fstab...

# swap addition like this req disk to have a boot partition, even on 2nd disk.
# sam may provide easier alternative.
# also, may need to set kernel param maxswapchunk which limit max swap size in byte
# calc as swchunk * DEV_BSIZE, whose def are 2048 and 1024, resp.



non "system" volumes can be created as, eg /usr/local:
lvcreate /dev/vg00
lvextend -L 2000 /dev/vg00/lvol11 # allocate 2 GB for the Log Vol.
newfs -F vxfs /dev/vg00/rlvol11 # lvol11 assigned dyn from above

Clean up procedure, reverse of create...
lvrmboot -r /dev/vg01 # remove root vol req for the LV.
# undo lvlnboot -r and -s
lvremove /dev/vg01/lvol2 # remove the logic vol lvol2 from vg01
lvremove /dev/vg01/lvol1
vgremove vg # remove the whole vol grp

bdf # df, berkeley version

growfing the fs:
lvdisplay /dev/vg00/lvolX
# find out LE value
umount /fsmount
lvextend -l le_number /dev/vg00/lvolX # where le_number is new LE value
# or -L sizeInMB (final size)
extendfs /dev/vg00/lvolX # will fill up all allocated LE, JFS
fsadm -F vxfs size /fsmount # increase fs for onlineJFS.
mount /fsmount

unless have onlineJFS, need unmount before extend. /var, /usr need boot into
single user mode (ISL hpux -is, -lm main mode won't work!)
lvextend, extendfs, then reboot to increase such fs.
Not sure how to do / !!