HP-UX SYSTEM ADMINISTRATION
System Administration Guide for HP-UX 10.##
This note shows how to configure a user volume group (/dev/vg01) assuming that the operating system installation has already occupied the first volume group (/dev/vg01). It also gives advice on how to manipulate the system based volume group and carry out such actions as increasing the size of existing logical volumes. It is worth reading these notes in conjunction with the relevant man pages.
It assumes that all the basic safeguards have already been carried out, such as saving the files containing sbtab and lvmtab information. It may also be prudent to save fstab to fstab.orig for reference.
Procedure To Set Up A new Volume Group
The following example shows how to create a new volume group consisting of two disks or physical volumes. Two logical volumes /dev/vg01/lvol1 and /dev/vg01/lvol2 within the /dev/vg01 volume group are also created requiring 400Mbytes and 200Mbytes respectively.
# /sbin/pvcreate /dev/rdsk/c0t4d0
# /sbin/pvcreate /dev/rdsk/c0t5d0
# /sbin/mkdir /dev/vg01
# /sbin/mknod /dev/vg01/group c 64 0x010000
(NB. Device 0x000000 will probably already be used by vg00 ie. /dev/vg00/group)
# vgcreate /dev/vg01 /dev/dsk/c0t4d0 /dev/dsk/c0t5d0
# /sbin/lvcreate -L 400 /dev/vg01/lvol1
# /sbin/lvcreate -L 200 /dev/vg01/lvol2
Procedure To Create A New Logical Volume.
The following example will create the logical volume /dev/vg01/lvol1 using the mount point /nfstest
# /sbin/lvcreate -L 100 /dev/vg01
This will create the required raw character device. Note the logical volume number that has been created as this will be required by the mount point. Unless named otherwise (lvcreate argument) the volume numbers will be sequential.
# /sbin/newfs /dev/vg01/rlvol1
This will create the file system.
# /sbin/mkdir /nfstest
# /sbin/mount /dev/vg01/lvol1 /nfstest
# bdf –l
Filesystem kbytes %used %avail %used Mounted on /dev/vg00/lvol1 47829 24590 18456 %57 / /dev/vg00/lvol3 ..... etc. /dev/vg01/lvol1 99669 9 89693 %0 /nfstest
In certain cases the file system will probably need to be exported. This may be done using sam. It should be noted that for non-system disk logical volumes they must be added to /etc/fstab to ensure that they are mounted correctly at boot time. This may be done manually by editing the file.
Procedure To Increase The Size Of An Existing Logical Volume.
a. Logical Volume NOT Residing Within A System Volume Group (ie. /dev/vg01)
This example shows how to increase the size of the logical volume of the mount point /vol2. It is necessary to first examine the volume group where the logical volume resides in order to see if there is sufficient space available.
# /sbin/vgdisplay /dev/vg01
--- Volume groups ---
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 3
Open LV 3
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 1016
PE Size (Mbytes) 4
Total PE 511
Alloc PE 308
Free PE 203
Total PVG 0
This shows that there are 203 free physical extents available each of 4 Mbytes, therefore 812 Mbytes.
# /sbin/lvextend -L 200 /dev/vg01/lvol2
# /sbin/umount /dev/vg01/lvol2
# /sbin/extendfs /dev/vg01/rlvol2
Note that the raw character device /dev/vg00/rlvol2 is required. Even having used the correct device type the extendfs command will report "Block device required". SIMPLY IGNORE THIS WARNING.
# /sbin/mount /dev/vg01/lvol2 /vol2
b. Logical Volume Residing Within A System Volume Group (ie. /dev/vg00)
Most modifications to system based volume groups will need to be carried out in single-user-mode. This is achieved as follows :
# /sbin/shutdown -r 0
The boot process must now be interrupted (warning: you have 10 seconds only) and the system allowed to search for bootable devices. The resulting menu will normally indicate that P0 is associated with the boot disk and this should be entered as follows :
Select from menu : b P0 isl [if 700 series] Select from menu : BO P0 isl [if 800 series]Alternatively you may use pri for primary boot device as follows :
Select from menu : b pri isl [if 700 series] Select from menu : BO pri isl [if 800 series]
The kernel may now be booted up into single-user-mode as follows :
ISL> hpux -is (;0) /stand/vmunix
If difficulties are encountered running any of the following commands, remember that mount -a will at least remount the vg00 system directories giving access to other such commands such as bdf -l etc.
# /sbin/lvextend -L 200 /dev/vg00/lvol5
# /sbin/umount /dev/vg00/lvol5
# /sbin/extendfs /dev/vg00/rlvol5
Note that the raw character device /dev/vg00/rlvol2 is required. Even using the correct device type the extendfs command will probably report "Block device required". SIMPLY IGNORE THIS WARNING.
# /sbin/mount /dev/vg00/lvol5 /opt
Following these required modifications, the machine will require a reboot. Note that after the reboot, it is recommended that if actions have been carried out on the system disk, they should be followed by the command :
# /sbin/lvlnboot -R –v
This will update all physical volumes in the volume group so that the correct logical volumes are used for root, swap etc.The /var/adm/sbtab and /etc/lvmtab should be saved in the /home/sysman/sbtab and /home/sysman/lvmtab as usual.
How to Recover From Disasters
This section will grow with experience.
a. Unable to Mount / Directories (can occur in single-user mode)
Do not forget the disk mount information that is held in /etc/fstab. If you need, for example, a command residing in the /usr directory that appears not to be mounted, try therefore :
# /sbin/mount /dev/vg00/lvol5 /usr
b. Corrupted lvmtab File
If the above command does not work because file /etc/lvmtab may have been corrupted in some way. This may be re-established using the command :
# /sbin/vgscan -v
c. Command vgscan Does Not Recreate The lvtab File
If problems are experienced running vgscan, it may be necessary to entirely regenerate individual volume group parts of the /etc/lvmtab by running the command :
# /sbin/vgcfgrestore -n /dev/vg01 –l
This will read the file /etc/lvmconf/vg01.conf and restore the LVM configuration in /etc/lvmtab. It will probably now be necessary to carry out the following procedure in order that the volume group is seen as before:
# /sbin/vgimport -v /dev/vg01
# /sbin/vgchange -a y /dev/vg01
[nb. activate arguments -a y = yes]
# /sbin/cfgbackup /dev/vg01
The above sequence could also be useful if moving a volume group set (external disk set) from one computer to another. Obviously the reverse of the above would need to be done before the move, as follows :
# /sbin/vgchange -a n /dev/vg01
# /sbin/vgexport -v /dev/vg01
[nb. activate arguments -a n = no]
The volume group vg01 may now be moved.
Some Useful Commands.
Most system administration commands are new to HPUX-10.01. Some, however, like bdf -l remain but give different output from those understood in HPUX-9.05. For example :
# bdf -l
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol1 47829 24590 18456 57% /
/dev/vg00/lvol8 342005 242432 65372 79% /var
/dev/vg00/lvol7 398869 194281 164701 54% /usr
/dev/vg00/lvol6 191989 873 171917 1% /tmp
/dev/vg00/lvol5 199381 142576 36866 79% /opt
/dev/dsk/c2t2d0 207702 207702 0 100% /cdrom.10
/dev/vg00/lvol4 199381 27134 152308 15% /home
/dev/vg01/lvol1 99669 9 89693 0% /nfstest
vgscan: The physical volume "/dev/dsk/c0t3d0" is already recorded in the "/etc/lvmtab" file.
vgscan: The physical volume "/dev/dsk/c0t6d0" is already recorded in the "/etc/lvmtab" file.
Physical Volume "/dev/dsk/c0t4d0" contains no LVM information
Physical Volume "/dev/dsk/c0t5d0" contains no LVM information
Physical Volume "/dev/dsk/c2t2d0" contains no LVM information
Typical output for a defined "physical volume" (disk) :
# /sbin/pvdisplay /dev/dsk/c0t3d0
--- Physical volumes ---
PV Name /dev/dsk/c0t3d0
VG Name /dev/vg00
PV Status available
Cur LV 0
PE Size (Mbytes) 4
Total PE 508
Free PE 508
Allocated PE 0
Stale PE 0
IO Timeout (Seconds) default
Typical output for a non-defined "physical volume" (disk) :
# /sbin/pvdisplay /dev/dsk/c0t4d0
pvdisplay: Couldn't find volume group to which physical volume "/dev/dsk/c0t4d0" belongs.
pvdisplay: Cannot display physical volume "/dev/dsk/c0t4d0".