HP-UX System Administrator's Guide: Logical Volume Management (5900-3028, March 2013)
Reducing a File System Created with OnlineJFS
Using the fsadm command shrinks the file system, provided the blocks it attempts to deallocate
are not currently in use; otherwise, it fails. If sufficient free space is currently unavailable, file system
defragmentation of both directories and extents might consolidate free space toward the end of
the file system, allowing the contraction process to succeed when retried.
For example, suppose your VxFS file system is currently 6 GB. However, you decide you only need
2 GB with an additional 1 GB for reserve space. Thus, you want to resize the file system to 3 GB.
Use fsadm with the -b option to specify the new size of the file system in sectors, then reduce the
size of the logical volume to match. Assuming the file system sector size is 1K, use the following
commands:
# fsadm -b 3145728 /home
# lvreduce -L 3072 /dev/vg01/lvol5
Reducing a File System Created with HFS or VxFS
To reduce the size of a file system created with HFS or VxFS, follow these steps:
1. Be sure no one has files open in any file system on the logical volume and that the logical
volume is no user's current working directory. For example::
# fuser -cu /dev/vg01/lvol5
NOTE: If the file system is exported using NFS to other systems, verify that no one is using
those other systems, then unmount the file system on those systems before unmounting it on
the server.
2. Back up the data in the logical volume.
For example, to back up /work/project5 to the system default tape device, enter the
following command:
# tar cv /work/project5
3. Remove the data in the file system the logical volume is mounted to, as follows:
# rm -r /work/project5
Because /work/project5 is a mount point, rm -r does not remove the directory itself.
4. Unmount the file system to which the logical volume is mounted as follows:
# umount /work/project5
5. Reduce the size of the logical volume as follows:
# lvreduce -L 500 /dev/vg01/lvol5
This command reduces the logical volume/dev/vg01/lvol5 to 500 MB.
6. Create a new file system in the reduced logical volume, using the character device file. For
example:
# newfs -f fstype /dev/vg01/rlvol5
7. Mount the logical volume as follows:
# mount /dev/vg01/lvol5 /work/project5
8. Recover the data from the backup. For example:
# tar xv
This recovers all the contents of a tape in the system default drive.
9. If /work/project5 continues to be used by NFS clients, re-export it on the server (exportfs
-a) and remount it on the clients (mount -a).
Administering File System Logical Volumes 99