return to PRS Technologies website
HP/UX Logical Volume Manager notes
- Configure a brand new volume group and logical volumes from scratch (without using SAM)
- Find out which devices you have
- Find out the size of the disk you want to allocate
- diskinfo -v /dev/rdsk/cXtXdX
- Create a directory for the new volume group (with a character special file called group).
- mkdir /dev/vgXX
- mknod /dev/vgXX/group c 64 0xNN0000
Note: The minor number for the group file should be unique among all
the volume groups on the system. It has the format 0xNN0000,
where NN runs from 00 to 09. The maximum value of NN is
controlled by the kernel tunable parameter maxvgs. Convention: NN is the
same as the volume group number XX above.
- Initialize the disk using pvcreate
- pvcreate /dev/rdsk/cXtXdX
- Create the physical volume group consisting of 1 or many disks
- vgcreate /dev/vgXX /dev/dsk/cXtXdX [disk2] [disk3] ...
Note 1: Use the block device notation here, not the character device.
Note 2: You can use the -s option to specify the physical extent size (PE SIZE)
Note 3: A volume group can consist of multiple disks.
- Create a (zero size) logical volume
- lvcreate -n lvol1 /dev/vgXX
Note: by not allocating the size here, the door is open to create mirrored logical volume using lvextend where the mirror is on a different disk drive.
- Extend the logical volume to the desired size
- lvextend -L [Megs] /dev/vgXX/lvol1 /dev/dsk/cXtXd0
- Create a mirror on a different disk drive
- lvextend -m 1 /dev/vgXX/lvol1 /dev/dsk/cXtXd1
- There is alternate way to create and extend a mirrored logical volume all in one step.
- lvcreate -n lvol2 -L 1024 -m 1 -D y -s g /dev/vg01
- Logical volume name = lvol2
- Size = 1 gig (1024 meg)
- -m 1 = One mirror copy
- -D y = Turn on distributed allocation (distribute evenly between physical volumes)
- -s g = Set a strict allocation policy. Mirrors of a logical extent cannot share the same physical volume.
- Prepare logical volumes for use with Informix
- Note: make sure you use the character device here (rlvol1)
- chmod 660 /dev/vgXX/rlvol1
- chown informix:informix /dev/vgXX/rlvol1
- ln -s /dev/vgXX/rlvol1 /RawSpaces/chunk1
- Run the hp_disk_table1.sh to interrogate /etc/lvmtab to map hardware addresses to device names on HP/UX
- Output looks like:
sdisk card instance 2 SCSI target 6 SCSI LUN 0 section 0 at address 0/0/2/1.6.0 /dev/dsk/c2t6d0
sdisk card instance 1 SCSI target 6 SCSI LUN 0 section 0 at address 0/0/2/0.6.0 /dev/dsk/c1t6d0
Here's an example of the whole thing in a script. This will need to be edited before use.
Note: When using 2 Gb logical volumes with a size of 2,048 Mb, create Informix chunks that are 2,097,150 Kb.
mkdir /dev/vg04
mknod /dev/vg04/group c 64 0x040000
ls -ls /dev/vg04
pvcreate /dev/rdsk/c5t1d3
vgcreate /dev/vg04 /dev/dsk/c5t1d3
lvcreate -n root_dbs /dev/vg04
lvcreate -n physical_dbs /dev/vg04
lvcreate -n logical_dbs /dev/vg04
lvcreate -n chunk1 /dev/vg04
lvcreate -n chunk2 /dev/vg04
lvcreate -n chunk3 /dev/vg04
lvcreate -n chunk4 /dev/vg04
lvcreate -n chunk5 /dev/vg04
lvcreate -n chunk6 /dev/vg04
lvcreate -n chunk7 /dev/vg04
lvextend -L 2048 /dev/vg04/root_dbs /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/physical_dbs /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/logical_dbs /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk1 /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk2 /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk3 /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk4 /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk5 /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk6 /dev/dsk/c5t1d3
lvextend -L 2048 /dev/vg04/chunk7 /dev/dsk/c5t1d3
chmod 660 /dev/vg04/rroot_dbs
chmod 660 /dev/vg04/rphysical_dbs
chmod 660 /dev/vg04/rlogical_dbs
chmod 660 /dev/vg04/rchunk1
chmod 660 /dev/vg04/rchunk2
chmod 660 /dev/vg04/rchunk3
chmod 660 /dev/vg04/rchunk4
chmod 660 /dev/vg04/rchunk5
chmod 660 /dev/vg04/rchunk6
chmod 660 /dev/vg04/rchunk7
chown informix:informix /dev/vg04/rroot_dbs
chown informix:informix /dev/vg04/rphysical_dbs
chown informix:informix /dev/vg04/rlogical_dbs
chown informix:informix /dev/vg04/rchunk1
chown informix:informix /dev/vg04/rchunk2
chown informix:informix /dev/vg04/rchunk3
chown informix:informix /dev/vg04/rchunk4
chown informix:informix /dev/vg04/rchunk5
chown informix:informix /dev/vg04/rchunk6
chown informix:informix /dev/vg04/rchunk7
ln -s /dev/vg04/rroot_dbs /RawSpaces/root_dbs
ln -s /dev/vg04/rphysical_dbs /RawSpaces/physical_dbs
ln -s /dev/vg04/rlogical_dbs /RawSpaces/logical_dbs
ln -s /dev/vg04/rchunk1 /RawSpaces/chunk1
ln -s /dev/vg04/rchunk2 /RawSpaces/chunk2
ln -s /dev/vg04/rchunk3 /RawSpaces/chunk3
ln -s /dev/vg04/rchunk4 /RawSpaces/chunk4
ln -s /dev/vg04/rchunk5 /RawSpaces/chunk5
ln -s /dev/vg04/rchunk6 /RawSpaces/chunk6
ln -s /dev/vg04/rchunk7 /RawSpaces/chunk7
mirror_stripe.ksh Script to do mirroring and striping at the same time on HP-UX.
mirror_stripe_config.ksh Config file used with above script.
Change the size of /usr, /var, /tmp filesystems
If you want to change the size of a Unix filesystem that is always mounted
and used by the operating system, it is a problem because you can only change
the size of a filesystem that is un-mounted. This is how you get around
that problem.
The following example is how I increased the size of /usr
(on /dev/vg00/lvol7) from 400 MG to 700 MG.
- Make sure you have free PE's in that volume group.
- Backup the system. At least make a tar tape of /usr.
- Shutdown to single user mode. When prompted,
press any key to interrupt the boot and go into single user mode.
- Boot from the primary device and invoke ISL.
- Interact with ISL ? - respond: Y
- Boot into single user mode.
- Extend the logical volume that holds the filesystem.
- /sbin/lvextend -L 700 /dev/vg00/lvol7
- Note: 700 is the desired end result size, NOT just the amount to increase.
- Note: If you want to run 'bdf', it is located in /usr/bin.
- Make sure /usr is not mounted. If it is mounted, mount and unmount
/usr to get it to be unmounted. I know this should be unneccessary - but I had to do it!
- mount (to see if /usr is mounted)
- mount /dev/vg00/lvol7 /usr (to mount /usr)
- umount /dev/vg00/lvol7 (to un-mount /usr)
- mount (to see if /usr is still mounted)
- Extend the filesystem. Don't forget to use the character device below.
- /sbin/extendfs -F hfs /dev/vg00/rlvol7
- Reboot back to multi-user mode.
- Check the size of the new /usr filesystem