Adding space to a dbspace used to involve adding a new chunk each time. If your Informix instance uses cooked files for storage, then the underlying file on the filesystem can be expanded to a larger size, preventing the need to add a new chunk.
Extendable chunks are often considered part of automatic space management, a feature where Informix will automatically add additional space when needed. The same mechanism can be used to manually extend an existing chunk when needed, even if you have not configured automatic space management.
The process to perform this manually is simple:
- Mark the chunk as extendable
- Extend the chunk by a specified size
- Mark the chunk as non-extendable
All these steps can be performed using the Informix admin tasks.
Identify the chunk to extend and obtain the chunk number
Either query the sysmaster:syschunks table for this, or simply use onstat -d, for example:
onstat -d
IBM Informix Dynamic Server Version 14.10.FC3DE -- On-Line -- Up 00:04:10 -- 273228 Kbytes
Dbspaces
address number flags fchunk nchunks pgsize flags owner name
4486d028 1 0x1 1 1 4096 N BA informix rootdbs
4499cd58 2 0x1 2 1 4096 N BA informix physdbs
4486dc40 3 0x1 3 1 4096 N BA informix logdbs
458d5028 4 0x2001 4 1 4096 N TBA informix tmp1dbs
458d5268 5 0x1 5 1 4096 N BA informix datadbs
458d54a8 6 0x1 6 1 4096 N BA informix datadbs2
6 active, 2047 maximum
Chunks
address chunk/dbs offset size free bpages flags pathname
4486d268 1 1 0 50000 38667 PO-B-- /informix_chunks/rootdbs.1
458d6028 2 2 0 25000 0 PO-B-- /informix_chunks/physdbs.1
458d7028 3 3 0 25055 2 PO-B-- /informix_chunks/logdbs.1
458d8028 4 4 0 26250 26197 PO-B-- /informix_chunks/tmp1dbs.1
458d9028 5 5 0 50856 1416 PO-B-- /informix_chunks/datadbs.1
458da028 6 6 0 262144 189493 PO-B-- /informix_chunks/datadbs2.1
6 active, 32766 maximum
A chunk in the datadbs dbspace only has 1,416 pages free. The chunk number is 5.
We can see that the actual file size for this chunk 199 MB.
ls -lh /informix_chunks/datadbs.1
-rw-rw---- 1 informix informix 199M Oct 5 17:04 /informix_chunks/datadbs.1
Mark the chunk as extendable
dbaccess sysadmin <<!
execute function task ("modify chunk extendable", 5);
!
Database selected.
(expression) Chunk 5 is now extendable.
1 row(s) retrieved.
Database closed.
onstat -d will now show that the chunk has been marked as extendable.
onstat -d | grep datadbs.1
458d9028 5 5 0 50856 1416 PO-BE- /informix_chunks/datadbs.1
Extend the chunk
In this example we will extend this chunk by 10 MB (10,240 KB).
dbaccess sysadmin <<!
execute function task ("modify chunk extend", 5, 10240);
!
Database selected.
(expression) Chunk 5 has been extended 10240Kb.
1 row(s) retrieved.
Database closed.
The Informix log records that the chunk has been extended:
17:07:17 Chunk 5 in space 'datadbs' has been extended by 10240 kb.
We can see that the actual file size for this chunk is now 209 MB .
ls -lh /informix_chunks/datadbs.1
-rw-rw---- 1 informix informix 209M Oct 5 17:07 /informix_chunks/datadbs.1
onstat -d shows that the free space in the chunk has grown by 2560 pages (10 MB):
onstat -d | grep datadbs.1
458d9028 5 5 0 53416 3976 PO-BE- /informix_chunks/datadbs.1
Mark the chunk as non-extendable
If you do not want to use automatic space management going forward, set the chunk to not extendable.
dbaccess sysadmin <<!
execute function task ("modify chunk extendable off", 5);
!
Database selected.
(expression) Chunk 5 is no longer extendable.
1 row(s) retrieved.
Database closed.
onstat -d | grep datadbs.1
458d9028 5 5 0 53416 3976 PO-B-- /informix_chunks/datadbs.1
This process can be used for a chunk that is in an HDR or RSS environment, but cannot be used against a mirrored dbspace or temporary dbspace. It can only be used for cooked files but not raw chunks.
Using this method, adding space when dbspaces are getting full is simpler and faster, and less prone to mistakes than adding a new chunk with onspaces.