Allocation Policies
To make full use of multi-volume support features, VxFS provides support for allocation policies that allow files or groups of files to be assigned to specified volumes within the volume set.
A policy specifies a list of volumes and the order in which to attempt allocations. A policy can be assigned to a file, to a file system, or to a Storage Checkpoint created from a file system. When policies are assigned to objects in the file system, you must specify how the policy maps to both metadata and file data. For example, if a policy is assigned to a single file, the file system must know where to place both the file data and metadata. If no policies are specified, the file system places data randomly.
The following example shows how allocation policies work. Assume that there are two volumes from different classes of storage:
# vxvset -g rootdg list myvset
VOLUME INDEX LENGTH STATE CONTEXT
vol1 0 102400 ACTIVE -
vol2 1 102400 ACTIVE -
Create a file system on the myvset volume set and mount it:
# mkfs -F vxfs /dev/vx/rdsk/rootdg/myvset
version 6 layout
204800 sectors, 102400 blocks of size 1024, log size 1024 blocks
largefiles supported
# mount -F vxfs /dev/vx/dsk/rootdg/myvset /mnt1
Use the following fsapadm commands to define two allocation policies called "datapolicy" and "metadatapolicy" to refer to the vol1 and vol2 volumes:
# fsapadm define /mnt1 datapolicy vol1
# fsapadm define /mnt1 metadatapolicy vol2
Assign these policies at the file system level. The data policy must be specified before the metadata policy:
# fsapadm assignfs /mnt1 datapolicy metadatapolicy
# fsvoladm list /mnt1
devid size used avail name
0 51200 1250 49950 vol1
1 51200 16 51184 vol2
The assignment of the policies on a file system-wide basis ensures that any metadata allocated is stored on the device with the policy "metadatapolicy" (vol2) and all user data is be stored on vol1 with the associated "datapolicy" policy.
The effect of creating a number of files is shown in the following script:
i=1
while [ $i -lt 1000 ]
do
dd if=/dev/zero of=/mnt1/$i bs=65536 count=1
i='expr $i + 1'
done
Before the script completes, it runs out of space even though space is still available on the vol2 volume:
# fsvoladm list /mnt1
devid size used avail name
0 51200 51200 0 vol1
1 51200 221 50979 vol2
To allocate user data from the vol1 volume and then use vol2 if space runs out, assign the allocation policy as follows:
# fsapadm define /mnt1 datapolicy vol1 vol2
You must have system administrator privileges to create, remove, change policies, or set file system or Storage Checkpoint level policies. Users can assign a pre-existing policy to their files if the policy allows that. Policies can be inherited for new files.
|