HP-UX: How to create logical volume

Posted on April 22, 2009

1


Sometimes it is hard to remember all commands for every single UNIX and Linux system. This is the manual how to create a logical volume in HP-UX 11i v3.

First, look for the target disk using `ioscan`

# ioscan -fnCdisk
Class     I  H/W Path  Driver S/W State   H/W Type     Description
==================================================================
disk     10  0/0/0/1/0/0/0.0.4  sdisk   CLAIMED     DEVICE       HP      LOGICAL VOLUME
                      /dev/dsk/c0t0d4   /dev/rdsk/c0t0d4

Second, create the physical volume using `pvcreate`

# pvcreate /dev/rdsk/c0t0d4
The physical volume has a file system on it.
Would you like to proceed (y/n) : y
Physical volume "/dev/rdsk/c0t0d4" has been successfully created.

Third, create the volume group using `vgcreate`
Update: as advised by Richard Molenkamp, the volume group directory and file have to be created manually. Another interesting thing is that VolGroup04, the “04” is in fact a hex value 0x040000. And he suggests to define `physical_extend_size=4MB` and `max_physical_extends=65535`.

# mkdir /dev/VolGroup04/group
# mknod c 64 0x040000
# chhown -R root:sys /dev/VolGroup04
# chmod 755 /dev/VolGroup04
# chmod 640 /dev/VolGroup04/group
# vgcreate VolGroup04 /dev/dsk/c0t0d4
# vgcreate -e 65535 -s 64 VolGroup04 /dev/dsk/c0t0d4
Increased the number of physical extents per physical volume to 17493.
Volume group "/dev/VolGroup04" has been successfully created.
Volume Group configuration for /dev/VolGroup04 has been saved in /etc/lvmconf/VolGroup04.conf

Finally, create the logical volume, using `lvcreate`

# lvcreate -n LogVol0401 -L 69632 -p w VolGroup04
Logical volume "/dev/VolGroup04/LogVol0401" has been successfully created with
character device "/dev/VolGroup04/rLogVol0401".
Logical volume "/dev/VolGroup04/LogVol0401" has been successfully extended.
Volume Group configuration for /dev/VolGroup04 has been saved in /etc/lvmconf/VolGroup04.conf

Alternatively, disk, physical volume, volume group and logical volume configuration might be done through System Management Homepage, which is accessible through web browser port 2301.

Advertisements
Tagged:
Posted in: MyWay, Technology