Summary: When a dbspace runs low on capacity, GBase Database(GBase 8s) provides two expansion approaches: adding a new chunk or extending an existing chunk. This tutorial explains both methods, their commands, prerequisites, differences, and post-expansion verification steps to help DBAs expand database storage safely.

1. Two Ways to Expand a Dbspace

When database storage approaches its capacity limit, adding more disk space is not the only consideration. DBAs also need to decide how that capacity should be incorporated into the existing storage structure.

In GBase Database(GBase 8s), there are two approaches:

  • Add a new chunk: Attach another chunk file to an existing dbspace.
  • Extend an existing chunk: Increase the capacity of an existing chunk.

Both approaches can expand an existing dbspace, but they use different commands and have different prerequisites.

2. Route One: Add a New Chunk

Adding a new chunk is a straightforward way to increase dbspace capacity.

First, prepare a new chunk file:

touch /data/gbase/datachk01_2 chown gbasedbt:gbasedbt /data/gbase/datachk01_2 chmod 660 /data/gbase/datachk01_2 

Then attach it to the existing dbspace:

onspaces -a datadbs01 \ -p /data/gbase/datachk01_2 \ -o 0 -s 512000 

The important parameters are:

Parameter Meaning
-a Add a chunk
datadbs01 Target dbspace
-p New chunk file path
-o Offset
-s Chunk size in KB

One important rule: the page size of a new chunk must match the page size of its target dbspace.

For example, a dbspace created with a 16KB page size requires compatible 16KB chunk storage. You cannot use a different page size when adding a chunk.

Using the SQL Administration API

GBase Database also supports adding a chunk through the SQL Administration API:

EXECUTE FUNCTION task( 'add chunk', 'datadbs01', '/data/gbase/datachk01_3', '512000', '0' ); 

Both methods add a chunk to the existing dbspace.

Verify the New Chunk

After execution, run:

onstat -d 

Check the following:

  • The nchunks value in the Dbspaces section should increase from 1 to 2.
  • The Chunks section should contain the new physical file path.
  • The available free pages should reflect the additional capacity.

Do not stop at a successful command response. Confirm that the new chunk is actually registered and available.

3. Route Two: Extend an Existing Chunk

The second approach is to extend an existing chunk rather than attach another one.

In GBase Database(GBase 8s), this operation uses the SQL Administration API.

First, mark the target chunk as extendable:

EXECUTE FUNCTION task( 'modify chunk extendable on', 4 ); 

Then specify the additional capacity:

EXECUTE FUNCTION task( 'modify chunk extend', 4, 512000 ); 

There are two important details here.

First: The argument is a chunk number, not a dbspace name.

Find the chunk number in the Chunks section of onstat -d. Use the actual chunk identifier shown in your instance rather than assuming that it matches the dbspace number.

Second: Check the underlying file system before extending.

The file system containing the chunk file must have enough available capacity. Otherwise, the extension cannot be completed successfully.

Unlike adding a new chunk, this approach does not create another chunk entry. It increases the capacity of an existing chunk.

4. Preconditions Before Expanding Storage

Regardless of which method you choose, check three things before executing the expansion command.

1. File system capacity

Confirm that the target file system has enough available space for the requested expansion.

2. Correct chunk identification

For an existing chunk extension, verify the chunk number through onstat -d. An incorrect chunk number means you may target the wrong storage resource.

3. Page size compatibility

When adding a new chunk, confirm that its page size matches the target dbspace.

Also check file ownership, permissions, and whether the target chunk path is already in use.

These checks are inexpensive compared with troubleshooting a failed storage change.

5. Add a Chunk vs. Extend a Chunk: Which Is Better?

The two approaches solve the same capacity problem, but their operational characteristics differ.

Comparison Add a chunk Extend a chunk
Main command onspaces -a SQL Administration API
Storage operation Attach a new chunk Increase existing chunk capacity
Chunk count Increases Remains unchanged
File system requirement Space for a new chunk file Space for extending the existing chunk
Storage layout Can use another disk or file system Retains the existing chunk location
Operational consideration More chunk entries to manage Depends on existing chunk extendability

My default preference is adding a new chunk, particularly in production environments.

It provides flexibility in storage allocation and can distribute capacity across different disks or file systems.

Extending an existing chunk is useful when the underlying file system has sufficient capacity and maintaining a stable chunk count is a priority.

However, neither approach should be treated as automatically risk-free or universally reversible. Check the supported rollback and recovery procedures for your GBase Database version before making production changes.

6. Verify Expansion After Execution

A successful expansion command is not the end of the operation.

There are three follow-up checks worth including in every GBase Database storage expansion runbook.

Check 1: Confirm capacity changes

onstat -d 

Verify the chunk count and available pages in the target dbspace.

Check 2: Confirm chunk status

Inspect the Chunks section and check the flags column.

Investigate any abnormal status, especially a chunk marked with PD.

Check 3: Update the storage inventory

Record:

  • Dbspace name
  • Chunk number
  • Physical file path
  • Chunk size
  • Page size
  • Expansion date

This keeps the storage inventory consistent with the actual database configuration.

Without these checks, administrators may believe a dbspace has been expanded even though the expected capacity is not available.

Conclusion: Choose the Expansion Method Before Running the Command

GBase Database(GBase 8s) provides two practical ways to expand dbspace capacity:

  • Add a chunk when you want more flexibility in physical storage allocation.
  • Extend an existing chunk when you want to retain the current chunk structure and the underlying file system supports it.

The commands are not particularly complicated. The real work is checking prerequisites, selecting the right target, understanding the operational impact, and verifying the result.

A reliable storage expansion procedure should always follow this sequence:

Check capacity → Select expansion method → Execute → Verify chunk status → Update inventory

Online storage expansion is not complete when the command returns successfully. It is complete when the additional capacity is confirmed and the storage records reflect the actual state.

How does your team usually expand GBase Database dbspaces: adding new chunks or extending existing ones?

Keywords: GBase Database, GBase Database 8s, dbspace expansion, online storage expansion, add chunk, extend chunk, onspaces, SQL Administration API, onstat -d, database storage management