types of chunk files
The chunk files used for storage spaces can be:
- files created directly in the instance chunk directory
- links in the chunk directory referencing files outside the directory
- links in the chunk directory to raw devices
All onspaces commands reference the chunks directory. This provides flexibility later if you have to change chunk devices or locations.
You must have all chunks in the instance chunk directory to use automatic chunk management
|
storage pool
When you add a chunk, you can also specify that it be allocated to the storage pool. Alternatively, you can allocate the chunk directory itself to the storage pool, and have Informix manage the chunks. Specify the chunk=pool parameter to the space service, to create spaces and chunks from the pool.
When using raw devices, infx keeps track of the links in each instance chunk directory. It will check that no other instance is using the raw device before allocating it to this instance. The instance link to the raw device is added to the storage pool, not the raw device directly.
You don't allocate the raw device directly to the storage pool, instead add the link from the chunk directory e.g. infx01.000, infx01.001 |
chunk directory
You can control where the instance chunk files reside with either the INFXCHKDIR config setting, or by replacing the chks directory with a link.
Example link:
/infx/inst/infx01/chks -> /data/infx01
All the chunk files for the infx01 instance will be under the /data file system. onspaces commands still reference /infx/inst/infx01/chks.
Example config.ini
Chunk files for this instance reside in /data01/infx01. onspaces commands will reference /data01/infx01.
When you specify a chunk name with no path, infx creates the file in the chunk directory.
When you specify a full chunk path name, infx creates a link in the chunk directory to the file. The chunk link has the same name as the file.
When you specify a raw device as the chunk name, infx creates a link in the chunk directory to the device. The link name will be the instance name, followed by a sequence number. For example, infx01.000. The sequence number is incremented until the next available number is found.
Examples:
| param | resulting chunk |
| chunk=dat01.001 | /infx/inst/infx01/chks/dat01.001 |
| chunk=/data01/infx01/dat01.001 | /infx/nst/infx01/chks/dat01.001 -> /data01/infx01/dat01.001 |
| chunk=/dev/rdsk1 | /infx/inst/infx01/chks/infx01.001 -> /dev/rdsk1 |
You can use the newchunk function to create chunk files ahead of time.
Create chunk file dat01.001 in the instance chunk directory.
infx space func=newchunk chunk=dat01.001
Create a chunk link to the file /data01/infx01/dat01.001
infx space func=newchunk chunk=/data01/infx01/dat01.001
chunk offsets
When you use a chunk for a storage space, infx automatically calculates the offset to use into the file or device. This is always after any chunks already on the device. You manually specify an offset to re-use another part of the file.
Don't share files or devices between instances, instead use different files or partitions of the device. This way infx can automatically manage the offset for you.
|
automatic chunks
You can define what action infx should take when you need a new chunk file. This is controlled with the INFXCHUNK setting in config.ini, which sets the chunk creation script.
By default, a new chunk file is created in the chunk directory. You can override this by using your own script. infx will call the script and pass it the chunk name and its size in megabytes. That script could then create a link to a raw device, or link to a file in a different file system.
You could also set INFXCHUNK to /bin/false and have the space service fail when the chunk does not exist.
When you use the new keyword as the chunk parameter, infx will automatically generate a new chunk name. The name will be the storage space name, followed by a sequence number, starting from 000. If that file already exists, infx increments the sequence number until a new unique name is found.
Example:
space dat01 => chunk /infx/inst/infx01/chks/dat01.000
reusing the existing chunk
When you use the
same keyword as the chunk parameter, infx re-uses the last chunk added to the storage space. The offset is calculated to be after any existing chunks on the file or device.
manually specify an offset
You can also manually specify an offset on the command line. The size parameter supports a format of size:offset.