[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]
System Management Guide:
Operating System and Devices
Reduce the Size of a File System in Your Root Volume Group
The simplest way to reduce all file
systems to their minimum size is to set the SHRINK option to yes when restoring the base operating system from backup. The SHRINK
option and the following scenario cannot be used in tandem. If you set the
SHRINK option to yes after doing the following procedure,
the installation overrides your changes to the /image.data file.
This scenario leads you through a manual process to reduce the size of
a selected rootvg file system. You will identify a file system that is not
using all of its allocated disk space and then reallocate based on the amount
of space the file system actually uses, thus freeing more space for the root
volume group's use. As part of this procedure, you will back up your volume
groups and reinstall the operating system, using the revised allocations.
Attention: This procedure requires shutting down and reinstalling the base
operating system. Whenever you reinstall any operating system, schedule your
downtime when it least impacts your workload to protect yourself from a possible
loss of data or functionality. Before reinstalling the operating system, ensure
you have reliable backups of your data and any customized applications or
volume groups.
- Create a separate backup of all file systems that are not contained in the rootvg. The separate backup helps ensure the integrity
of all your file systems.
- With root authority, check which file systems in your root volume group
are not using their allocated disk space by typing the following command:
df -k
The -k flag displays the file-system sizes
in kilobytes. Your result will look similar to the following:
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 196608 4976 98% 1944 2% /
/dev/hd2 1769472 623988 65% 36984 9% /usr
/dev/hd9var 163840 65116 61% 676 2% /var
/dev/hd3 65536 63024 4% 115 1% /tmp
/dev/hd1 49152 8536 83% 832 7% /home
/proc - - - - - /proc
/dev/hd10opt 32768 26340 20% 293 4% /opt
Looking at these results, you notice a large number of free blocks
and a fairly low percentage of use associated with the file system that is
mounted on /usr. You decide you can release a significant
number of blocks by reducing the number of partitions allocated to the /usr file system.
- Check the contents of the /etc/filesystems file
to ensure that all file systems in the rootvg are mounted. If not, they will
not be included in the reinstalled system.
- Create an /image.data file, which lists all the
active file systems in the rootvg that are included in the installation procedure,
by typing the following command:
mkszfile
- Open the /image.data file in your favorite editor.
- Search for the usr text string to locate the lv_data stanza
that pertains to the /usr file system. Use numbers from
this stanza as a base to determine how much you can reduce the /usr file system's number of logical partitions. The default size of
each additional logical partition is defined in the PP_SIZE entry
of the /image.data file. Your /image.data file would look similar to the following:
lv_data:
VOLUME_GROUP= rootvg
LV_SOURCE_DISK_LIST= hdisk0
LV_IDENTIFIER= 00042345d300bf15.5
LOGICAL_VOLUME= hd2
VG_STAT= active/complete
TYPE= jfs
MAX_LPS= 32512
COPIES= 1
LPs= 108
STALE_PPs= 0
INTER_POLICY= minimum
INTRA_POLICY= center
MOUNT_POINT= /usr
MIRROR_WRITE_CONSISTENCY= on/ACTIVE
LV_SEPARATE_PV= yes
PERMISSION= read/write
LV_STATE= opened/syncd
WRITE_VERIFY= off
PP_SIZE= 16
SCHED_POLICY= parallel
PP= 108
BB_POLICY= relocatable
RELOCATABLE= yes
UPPER_BOUND= 32
LABEL= /usr
MAPFILE=
LV_MIN_LPS= 70
STRIPE_WIDTH=
STRIPE_SIZE=
The number of logical partitions devoted to this logical
volume is 108 (LPs=108).
- Determine the number of logical partitions needed by the existing data
in the /usr file system by using your result from step
2. You can display the existing file sizes specifically for the /usr file system by using the following command:
df -k /usr
The result repeats the numbers (in kilobytes) you received for the /usr file system in step 2. For example:
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd2 1769472 623988 65% 36984 9% /usr
- Subtract the amount of free space from the total number of 1024-blocks
allocated:
1769472 - 623988 = 1145484
- Add an estimate of the space you might need to accommodate any future
growth expected in this file system. For this example, add 200000 to the result.
1145484 + 200000 = 1345484
- Divide the result by the logical-partition size in bytes (16*1024) to
determine the minimum number of logical partitions you need.
1345484 / 16384 = 82.121826171875
Use this result, rounded upward, to redefine the number of logical partitions
needed (LPs=83).
- In your image.data file, change the LPs field
from 108 to 83.
- Find the fs_data stanza that pertains to the /usr file
system. Your fs_data stanza will look similar to the following:
fs_data:
FS_NAME= /usr
FS_SIZE= 3538944
FS_MIN_SIZE= 2290968
FS_LV= /dev/hd2
FS_FS= 4096
FS_NBPI= 4096
FS_COMPRESS= no
FS_BF= false
FS_AGSIZE= 8
- Calculate the file-system size (FS_SIZE) by multiplying the
physical partition size (PP_SIZE) by 2 (the number of 512-byte
blocks used by the physical partitions) by the number of logical partitions
(LPs). Given the values used in this example, the calculation is:
PP_SIZE * 512 blocks * LPs = FS_SIZE
16384 * 2 * 83 = 2719744
- In your image.data file, change the FS_SIZE field from 3538944 to 2719744.
- Calculate the minimum file-system size (FS_MIN_SIZE) based
on the actual size of the current data used by the /usr file
system, as follows:
- Calculate the minimum number of partitions needed. Given the values used
in this example, the calculation is:
size_in_use (see step 7a) / PP_SIZE = partitions
1145484 / 16384 = 69.914794921875
- Calculate the minimum size required by that number of partitions. Rounding
the previous calculation results upward to 70, the calculation is:
PP_SIZE * 512 blocks * partitions = FS_MIN_SIZE
16384 * 2 * 70 = 2293760
- In your image.data file, change the FS_MIN_SIZE field from 2290968 to 2293760.
- Save your edits and exit the editor.
- Unmount all file systems that are not in the rootvg volume group.
- If you have any user-defined volume groups, type the following commands
to vary off and export them:
varyoffvg VGName
exportvg VGName
- With a tape in the tape drive, type the following command to initiate
a complete system backup:
mksysb /dev/rmt0
This type of backup
includes the file-system size information you specified in the /image.data file, which will be used later to reinstall your system with
the new file-system sizes.
Note
To initiate this backup, you
must run the mksysb command from the command line. If
you use a system management tool, such as SMIT, the backup creates a new image.data file, overwriting the changes you have made.
- Use this backup to reinstall the operating system using the Install With Current System Settings option. During the installation,
check that the following options are set appropriately:
- Use Maps must be set to no
- Shrink the File Systems must be set to no
If you need
more information about the installation procedure, see the AIX 5L Version 5.2 Installation Guide.
- After the operating system is installed, reboot the system in Normal mode.
At this point, the /usr file system is resized, but
your user-defined file systems are not available.
- Mount all file systems by typing the following command:
mount all
If you receive Device Busy messages about file systems
that are already mounted, you can ignore these messages.
At this point, your /usr file system is resized,
your root volume group has more free space, and your file systems are usable.
[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]