Allocating data

The following script creates a large number of files to demonstrate the benefit of allocating data:

 	while [ $i -lt 1000 ]
 	   	dd if=/dev/zero of=/mnt1/$i bs=65536 count=1
 	   	i='expr $i + 1'

Before the script completes, vol1 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

One possible solution is to define and assign an allocation policy that allocates user data to the least full volume.

You must have system administrator privileges to create, remove, or change policies, or to 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. A file will inherit the allocation policy of the directory in which it resides if you run the fsapadm assignfile -f inherit command on the directory.

The following example defines an allocation policy that allocates data to the least full volume.

Allocating data from vol1 to vol2

  1. Define an allocation policy, lf_12, that allocates user data to the least full volume between vol1 and vol2:

      # fsapadm define -o least-full /mnt1 lf_12 vol1 vol2
  2. Assign the allocation policy lf_12 as the data allocation policy to the file system mounted at /mnt1:

      # fsapadm assignfs /mnt1 lf_12 ''

    Metadata allocations use the default policy, as indicated by the empty string (''). The default policy is as-given allocations from all metadata-eligible volumes.