3. manage spaces

This section describes using the new, extend, and drop functions of the space service to manage storage spaces.

chunks

To create or extend storage spaces you have to define chunks. infx offers several ways to manage the chunk files, which are described in the next section,  4. manage chunks,

If your version of Informix supports it, you can assign these chunks to the storage pool.

simple space management

For this section of the guide, we will use the default infx instance, and create chunks as cooked files directly in the chunks directory. 

infx also has options to move the chunks to separate file systems or raw devices.

To use the Informix storage pool with the space service, specify chunk=pool, instead of using a chunk or the new/same keywords.

create storage spaces

Use the new function of the space service to create storage spaces.

Example, create a 100mb data storage space called dat01, on a new chunk file. The space will have the default page size.

infx space func=new dbtype=data space=dat01 size=100 chunk=new

infx automatically created the new chunk file /infx/inst/infx01/chks/dat01.000, set permissions, and created the new storage space.

If the instance is a primary server, infx also creates new chunk files on the secondary servers.


infx01@bobii:/home/informix>onstat -d

IBM Informix Dynamic Server Version 11.50.FC7DE -- On-Line -- Up 00:53:47 -- 186936 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
4bb89028         1        0x60001    1        1        2048     N  B     informix root
4d262e90         2        0x60001    2        1        2048     N  B     informix dat01
 2 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free  bpages    flags pathname
4bb8911c0        1      1      0          50000      3403            PO-B- /infx/inst/infx01/chks/root.001
4d258328         2      2      0          50000      49947           PO-B- /infx/inst/infx01/chks/dat01.000
 2 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.

Expanded chunk capacity mode: always

extending storage spaces

Use the extend function of the space service to increase the size of an existing storage space.

Example, add 50mb to the dat01 storage space, on a new chunk file

infx space func=extend chunk=new size=50

infx automatically created the new chunk file /infx/inst/infx01/chks/dat01.001, set permissions and extended the storage space.

infx01@bobii:/home/informix>onstat -d

IBM Informix Dynamic Server Version 11.50.FC7DE -- On-Line -- Up 00:55:32 -- 186936 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
4bb89028         1        0x60001    1        1        2048     N  B     informix root
4d262e90         2        0x60001    2        2        2048     N  B     informix dat01
 2 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size       free   bpages   flags pathname
4bb891c0         1      1      0          50000      3403            PO-B- /infx/inst/infx01/chks/root.001
4d258328         2      2      0          50000      49947           PO-B- /infx/inst/infx01/chks/dat01.000
4d258b48         3      2      0          25000      24997           PO-B- /infx/inst/infx01/chks/dat01.001
 3 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.

Expanded chunk capacity mode: always

You can also extend the storage space by adding to the existing chunk.

Example, add 50mb to the dat01 storage space, re-using the existing chunk file.

infx space func=extend chunk=same size=50

infx extended the storage space, using the last chunk that was allocated to it i.e. data01.001. It automatically calculated the required offset and added the chunk to the storage space.

infx01@bobii:/home/informix>onstat -d

IBM Informix Dynamic Server Version 11.50.FC7DE -- On-Line -- Up 01:04:20 -- 186936 Kbytes

Dbspaces
address          number   flags      fchunk   nchunks  pgsize   flags    owner    name
4bb89028         1        0x60001    1        1        2048     N  B     informix root
4d262e90         2        0x60001    2        3        2048     N  B     informix dat01
 2 active, 2047 maximum

Chunks
address          chunk/dbs     offset     size      free  bpages     flags pathname
4bb891c0         1      1      0          50000     3403             PO-B- /infx/inst/infx01/chks/root.001
4d258328         2      2      0          50000     49947            PO-B- /infx/inst/infx01/chks/dat01.000
4d258b48         3      2      0          25000     24997            PO-B- /infx/inst/infx01/chks/dat01.001
4d258d38         4      2      25000      25000     24997            PO-B- /infx/inst/infx01/chks/dat01.001
 4 active, 32766 maximum

NOTE: The values in the "size" and "free" columns for DBspace chunks are
      displayed in terms of "pgsize" of the DBspace to which they belong.

Expanded chunk capacity mode: always

same or new, whats the difference?

In most cases, you would extend storage spaces onto new chunk files. Provided you don't end up with hundreds and hundreds of chunks, there is no particular downside to having multiple chunks.

Here is an example where using same makes more sense.

Suppose I have three separate file systems for my storage spaces, and these represent different tiers of storage. For example, tier1 being fastest and tier3 being slowest.

When I create storage spaces, I specify which file system I want the data to be stored on.

For example:

infx space func=new type=data space=fastdbs chunk=/tier1/infx01/fastdbs
infx space func=new type=data space=meddbs chunk=/tier2/infx01/meddbs
infx space func=new type=data space=slowdbs chunk=/tier3/infx01/slowdbs

This will create the following chunks and links:

 name chunk target
 fastdbs /infx/inst/infx01/chks/fastdbs /tier1/infx01/fastdbs
 meddbs /infx/inst/infx01/chks/meddbs /tier2/infx01/meddbs
 slowdbs /infx/inst/infx01/chks/slowdbs /tier3/infx01/slowdbs

Now, when you extend the space using the same keyword, the chunk files grow within their file systems. 

Check your platform and file system documentation to determine the maximum allowable chunk size.

drop storage space

Use the drop function of the space service to remove a storage space that is no longer in use. You cannot drop a storage space if it is still in use.

Remove the dat01 storage space, if it is no longer in use.

infx inst func=drop space=dat01

Remove only one chunk of the storage space, if the chunk is no longer in use. Remove the chunk on dat01.001 with an offset of 50mb.

infx inst func=drop space=dat01 chunk=dat01.001 offset=50

mirroring

To create a mirrored storage space, or to extend a mirrored storage space, you must pass a mirror chunk name to the space service. infx automatically names mirror chunks the same way that it names primary chunks, with an "m" added at the beginning.

space dat01 => mirror chunk /infx/inst/infx01/chks/mdat01.000

The mchunk parameter behaves exactly like the chunk parameter. It supports the new and same keywords, as well as executing the INFXCHUNK script to create new chunks. This script will receive the mirror chunk name as its parameter.

Create a mirrored storage space.

infx space func=new space=new01 chunk=new mchunk=new size=100

This command will create new chunks, new01.000 and mnew01.000.

The infx space service also supports turning mirroring on and off, as well as changing chunk status See the space mirroring reference for more details.