# WARNING: READ ENTIRE DOCUMENT BEFORE PROCEEDING .
To extend the logical volumes for /tmp,
/home, /opt, /var, /usr, the filesystem must first be unmounted .
While in multi-user mode , if you try to unmount these logical volumes
you will receive the following error: DEVICE BUSY . This message is displayed
even if the command fuser -k /mountpoint is used . To unmount and
extend these logical volumes, do the following:
#** WARNING:
IMPORTANT - Always have a known good, current backup of the system or at
minimal , a backup of the filesystem that will be extended .
1) vgdisplay /dev/vg00
This command will give general info about
the volume group. Look for the column FREE PE's . This field tells the
total amount of free (not allocated) Physical Extents . If FREE PE's shows
0, then a logical volume will need to be reduced or moved to another volume
group in order to free up the Physical Extents. The size of the PE's
can be determined by looking at the PE SIZE (Mbytes) field . The default
size is 4 . To determine the total unallocated disk space in Mbytes do
the following: FREE PE's * PE SIZE = Total unallocated Disk Space
in Mbytes
2) lvdisplay /dev/vg00/lvolX
This command will give general info about
the logical volume. Before extending the lvol, the current size
needs to be determined . LV Size
(Mbytes ) displays the current logical volume size . Another factor that
needs to be checked is the Allocation field . If the output
from lvdisplay shows : Allocation -> strict/contiguous
. The logical volume must have concurrent free PE's to attach the logical
volume. The strict setting is to prevent mirroring a logical volume
to the same disk the primary logical volume resides.
3) Boot the system into single user mode
a) shutdown -r now
This will shutdown the system and then reboot
b) Interrupt escape
sequence
When the system reboots, and starts coming back up, the following message
will be displayed : For 800's : To interrupt boot sequence press
any key with in 10 seconds. For 700's : to interrupt boot sequence
press and hold the escape Key with in 10 seconds . This will bring
the system to the Boot Admin prompt.
c) Boot from primary
disk
For 800's : The Boot Admin prompt will ask if you want to boot from the
primary disk -> answer yes. It will then ask you if you want to interact
with IPL -> answer yes . This will bring you to ISL>. For 700's
: The Boot Admin prompt will show a search option. This is to search for
bootable devices . The internal scsi disk in a 700 by default
is set at scsi 6. The display will show a letter P and a number next to
the scsi setting : Example -> P0 scsi6, Type bo P0 . This will ask
if you want to interact with ISL. -> answer yes . This will
bring you to ISL>
d) Boot into single
usermode
From ISL> type the following: hpux -is (;0)/stand/vmunix [ENTER] This will
boot the system into single usermode. To verify the run lever , once
the system has booted up do the following: who -r -> output
will show init s or S
4) Extend the logical volume
When booting into single user mode, /usr, /var, /tmp, /home, and /opt may
already be unmounted . By typeing the command : mount -a . All filesystems
that are referenced in /etc/fstab will be mounted if they are currently
unmounted. type bdf -> this will display all mounted filesystems . From
this output do one final verification of the name of the filesytem
and and logical volume name.
a) Unmount the filesystem.
After verifying the logical volume and filesystem to extend, unmount the
filesystem :
umount /dir-name
umount /var
# this example unmounted the /var filesystem .
b) Extend the logical
volume. To extend the logical volume do the following:
lvextend -L (Total size) /dev/vg00/lvolX .
In the following example we want to extend
lvol4 to be total size of 400Mg.
lvextend -L 400 /dev/vg00/lvol4
A message should return that it
was successful.
c) Extend the filesystem.
After extending the logical volume, the file system must be extended. To
do this , you issue the extendfs command.
extendfs -F file-system-type /dev/vg00/rlvolX
In this example we will extend the filesystem
for lvol4.
extendfs -F vxfs /dev/vg00/rlvol4
This will return a message about new blocks
or for an HFS file system new super blocks . Note : If you are not
sure what type of filesystem you have, you can check /etc/fstab or do /usr/sbin/fstyp
/dev/vgname/lvolname. NOTE: /usr must be mounted to use the
fstyp command
5) Remount the filesystem
Issue the "mount -a" command to remount the file system. Do the "bdf" command
to verify the new filesystem size.
6) Reboot the system
Issue the "shutdown -r now" command . This will bring the system back to
multiuser mode .
******************************************************************************
What If I Don't Have Any Free PE's availible
In /dev/vg00 ?
NOTE: See above WARNING messages before
starting.
If the vgdisplay command displays that
the field FREE PE's =0, one of the following procedures will need
to be done:
A) Remove unused logical volumes
B) Reduce a logical volume in /dev/vg00
to free up the PE's
C) Move a logical volume to a different
volume group to free up the PE's
1) Determine if there are unused
logical volumes in /dev/vg00
To determine what logical volumes are in
/dev/vg00 do the following command:
vgdisplay -v /dev/vg00 |more.
This will display all logical volumes
in /dev/vg00.*NOTE* lvol2 is the default logical volume for swap
. Verify the this logical volume is being used be typing swapinfo -t.
This will display all swap devices . Compare the output of vgdisplay
-v /dev/vg00 to the contents of /etc/fstab . All matching logical
volumes in general should not be removed . Verify that all non matching
logical volumes are not being used by databases , developers , etc.
a) Removing unused logical
volumes. To remove unused logical volumes, issue the following command:
lvremove /dev/vgname/lvolname
lvremove /dev/vg00/lvol18
# In this example we are removing lvol18
After removing all unused logical volumes,
do the vgdisplay command to determine how many free PE's are now availible
. Follow the above procedure .
2) Determining what logical volume
in /dev/vg00 can be reduced
To determine what logical volume you will
reduce to free up PE's, do the bdf command. This will display all mounted
file systems.Look at the percent used field and file system size field.
Example: If bdf shows /home is 300Mg,
and only 30% of the filesystem is being used, this logical volume may be
selected to be reduced to free up PE's. *NOTE* / and /stand cant
be reduced . These filesystems are exempt from this process.
a) Reducing a logical volume.
Warning: reducing a logical volume corrupts the filesystem. Insure
that you have a known good backup of the filesytem before reducing
it. To reduce the logical issue the following command: unmount /mountpoint
. In this example we'll reduce /home . /home filesystem size
is currently 300MG , and we will reduce it to 240Mg. The lvolname
is /dev/vg00/lvol9. Example :
umount /home
lvreduce -L 240 /dev/vg00/lvol9
A message will display that the new selected
size is smaller than current -> do wish to proceed. type yes and the logical
volume will be reduced. At this point, it is very possible
the file system is corrupt.Issue the newfs command, mount the file system
and restore the data. Example :
newfs /dev/vg00/rlvol9
# **NOTE** newfs is ran on the rlvolX device file.
mount -a or mount /dev/vg00/lvolx /mountpoint. Example:
mount /dev/vg00/lvol9 /home
Restore the directory from your backup.
Issue the vgdisplay /dev/vg00 command to display the new FREE PE's.
Proceed with the above procedures.
3) Moving a logical volume to a different
volume group
To move a logical volume to a different
volume group, the following steps will need to be done: vgdisplay on the
volume group the logical volume will be moved to . Determine from the FREE
PE's field if enough disk space is availible to create a logical volume
of equal or greater size than the original. **NOTE** See above at vgdisplay
for determining FREE PE's.
a) Creating
a logical volume. A logical volume can be create either manually
, or by using SAM to create the logical volume manually do one of
the following:
lvcreate -L size -n name(optional) /dev/vgname
Example: We will create a 300Mg logical
volume, call new-home , on /dev/vg01
lvcreate -L 300 -n new-home /dev/vg01
If you wish to have the logical volume
on a specific disk in a volume group, do pvdisplay on the disk device to
determine if there are enough PE's availible to create the logical volume
Example: We will create a 300Mg logical volume called new-home on /dev/dsk/c0t5d0
in volume group vg01:
lvcreate -n new-home /dev/vg01
lvextend -L 300Mg /dev/vg01/new-home /dev/dsk/c0t5d0
In either case, after creating the
logical volume do the following: Example :
newfs /dev/vg01/rnew-home
mkdir /new-home
#Create a mount point for the new logical volume
mount /dev/vg01/new-home /new-home
#mount the new filesystem
bdf -> verify the lvol is mounted
b) Transfer the data
b.1)
The data can be transfered several different ways. The safest but most
time consuming is to do the following: unmount the original logical
volume and mount the mount point on the new logical volume and restore
the data from a backup.
Example: We will mount /home , which is currently on /dev/vg00/lvol8
to /dev/vg01/new-home .
umount /home
mount /dev/vg01/new-home /home
bdf -> verify that the bdf reflects the
new logical volume. restore the data from backup . This will
write to the new filesystem .
NOTE: IN ALL EXAMPLES, YOU MUST EDIT /etc/fstab
TO REFLECT THE NEW LOGICAL VOLUME.
b.2)
Another method is to mount the new logical volume on a seperate mount point
and use cpio or fbackup/frecover to transfer the data to the new logical
volume. After that data is tranferred unmount the new logical volume,
unmount the original logical volume and mount the new logical volume
on the original mountpoint. Example: We will transfer data
from /home to /new-home and mount the new logical volume on /home.
mount /dev/vg00/lvol9 /home
mount /dev/vg01/new-home /new-home
Either of the following commands can be
used to transfer the data.
fbackup -i /home -f - | (cd /new-home; frecover -Xrf -)
or
cd /home
find . -name -print -depth |cpio -pdmhlvxu /new-home
After data transfer is complete , do the
following: umount /home , umount /new-home . Boot
the system backup into multi-user mode and verify the new logical volume
is being mounted. If all appears to be working fine. IE: users can
login , applications run fine, then remove the original logical volume.
Once again do the vgdisplay command to verify to free available PE's .
At this point proceed with extend the logical volume in /dev/vg00
mount /dev/vg01/new-home /home
bdf ->verify the bdf reflects the new logical volume.
Edit /etc/fstab to reflect the new logical volume.
newfs /dev/vgname/rlvolname
lvreduce -L total-reduced-size /dev/vgname/lvolname
that will be extended. Strict is
the default settings for all logical volumes , unless manually
created with strict policy set to off.