HP-UX System Administrator's Guide: Routine Management Tasks
• Use lvreduce to reduce the size of the surrounding logical volume
• Verify and (only if necessary) restore any lost data to the newly resized logical
volume
To reduce the size of the logical volume/dev/vg01/lvol2 containing a VxFS file
system currently mounted to the directory /work/project5 where the new (smaller)
size of the logical volume is to be 500MB:
1. Make sure no one has files open in any file system on the logical volume and
that no one’s current working directory is contained within the file system:
fuser -cu /work/project5
NOTE: If the file system is shared with other systems, check on those other
systems that no one is using it (fuser works on NFS-mounted file systems as well
as local ones). Then unmount it from the remote client systems before unmounting
it from the server.
2. Back up the data in the file system:
Using a utility like tar or pax, backup the data contained in the logical volume
you are about to reduce. If your logical volume contains a database, use a backup
method appropriate for that database. In this example, to back up
/work/project5 to a tape device:
cd /work/project5
pax -w -f /dev/rtape/tape4QIC150 .
Or, copy the contents of the file system to a temporary location not within the
logical volume you are attempting to reduce:
pax -rw /work/project5 /somewhere_else/project5
You can use a different backup utility or application but, however you do it, protect
your data in case they are damaged by the logical volume reduction!
3. Before shrinking the size of the logical volume (the container), ensure that the
file system (the contents) will fit in the new smaller size.
In this example:
• The container is the logical volume /dev/vg01/lvol2
• The content is the file system currently mounted to /work/project5
Use the fsadm command with the -b option to reduce the size of a VxFS file system
so that it will fit inside the-smaller logical volume. As fsadm reduces the size of
the file system, it moves any data that reside in disk space being released so that
all file system data reside in the disk space that will remain part of the file system
after the reduction. This also ensures that you can safely reduce the size of the
surrounding logical volume without truncating important file system structures.
104 Managing Systems