1.
If the file system must be unmounted, unmount it.
a.
Be sure no one has files open in any file system mounted to this logical volume and that
it is no user's current working directory. For example:
# fuser -cu /work/project5
If the logical volume is in use, confirm that the underlying applications no longer need it.
If necessary, stop the applications.
NOTE:
If the file system is exported using NFS to other systems, verify that no one is
using those other systems, then unmount it on those systems.
b.
If you cannot stop the applications using the logical volume, or it is a system directory
such as
/var
or
/usr
, change to single-user state as follows:
# /sbin/shutdown
c.
Unmount the file system as follows:
# /sbin/umount /dev/vg01/lvol2
2.
Extend the logical volume. For example:
# /sbin/lvextend -L 332 /dev/vg01/lvol2
This increases the size of this volume to 332 MB.
3.
Extend the file system size to the logical volume size. If the file system is unmounted, use the
extendfs
command as follows:
# /sbin/extendfs /dev/vg01/rlvol2
If you did not have to unmount the file system, use the
fsadm
command instead. The new size
is specified in terms of the block size of the file system. In this example, the block size of the
file system
/work/project5
is 1 KB. To extend the file system to 332 MB, the number of
blocks is 339968 (332 times 1024). For example:
# fsadm -b 339968 /work/project5
4.
If you unmounted the file system, mount it again.
a.
If you had to change to single-user state, reboot the system.
# /sbin/reboot -r
You can skip any additional steps to mount the file system and export it, since the boot
process mounts and exports any file systems.
b.
Remount the file system as follows:
# /sbin/mount /dev/vg01/rlvol2 /mount_point
NOTE:
If the file system will continue to be used by NFS clients, export it on the server
(
exportfs -a
) and remount it on the clients (
mount -a
).
5.
Verify that the file system reflects the expansion by entering
bdf
,
df
, or
fsadm -E
.
Reducing the Size of a File System
You might want to shrink a file system that has been allocated more disk space than it needs,
allowing that disk space to be freed for other uses.
Reducing the size of a file system is more complicated than extending it. Because of file system
block allocation strategies, data can be scattered throughout the logical volume. Reducing the
logical volume reclaims space at the end of the logical volume, requiring file system drivers to
coalesce and rearrange data blocks ahead of time. Most types of file system are unable to do
such coalescence, so you must back up the data in the file system, reduce the logical volume,
create a new file system in the smaller logical volume, and restore the data from your backup.
The only current file system type able to do online coalescence and size reduction is OnlineJFS,
and it can fail in some cases.
Administering File System Logical Volumes
99