ZFS Device autoreplace and autoexpand

After Oracle Solaris 10 9/10 Release: ZFS has been enhanced to recognize these events and adjusts the pool based on the new size of the disk, depending on the setting of the autoexpand property. You can use the autoexpand pool property to enable or disable automatic pool expansion when a larger disk replaces a smaller disk.

These features enable you to increase the pool sizewithout having to export and import pool or reboot the system.

By default, autoexpand and autoreplace are set off, to enable them, set then to on or create them with the option on

Set autoreplace and autoexpand to on

zpool set autoreplace=on test
zpool set autoexpand=on test

Or, create the pool with autoreplace property enabled

zpool create -o autoexpand=on -o autoreplace=on test c5t7d0 ...

Check the parameters setting

# zpool get autoreplace test
NAME       PROPERTY     VALUE    SOURCE
test       autoreplace  on       local
# zpool get autoexpand test
NAME       PROPERTY    VALUE   SOURCE
test       autoexpand  off     default

After you set autoreplace on, you don't have to issue zpool replace command after disk replacement, but for some situation, for example, solaris detected disk faulty, but ZFS is not awared, then follow the instruction replace failed disk in ZFS on Sun fire x4540

Expand pool size

The pool size also be expanded by using the zpool online -e command.

# zpool online -e test c5t7d0

Or, you can reset the autoexpand property after the larger disk is attached or made available by using the zpool replace feature. For example, the following pool is created with one 8-GB disk (c0t0d0). The 8-GB disk is replaced with a 16-GB disk (c1t13d0), but the pool size is not expanded until the autoexpand property is enabled.

# zpool create pool c0t0d0
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
pool 8.44G 76.5K 8.44G 0% ONLINE -

# zpool replace pool c0t0d0 c1t13d0
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
pool 8.44G 91.5K 8.44G 0% ONLINE -

# zpool set autoexpand=on pool
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
pool 16.8G 91.5K 16.8G 0% ONLINE -

Another way to expand the LUN

Expand lun without enabling the autoexpand property, is to use the zpool online -e command even though the device is already online

# zpool create tank c0t0d0
# zpool list tank
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
tank 8.44G 76.5K 8.44G 0% ONLINE -
 
# zpool replace tank c0t0d0 c1t13d0
# zpool list tank
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
tank 8.44G 91.5K 8.44G 0% ONLINE -

# zpool online -e tank c1t13d0
# zpool list tank
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
tank 16.8G 90K 16.8G 0% ONLINE -

Additional device replacement enhancements in this release include the following features:

    In previous releases, ZFS was not able to replace an existing disk with another disk or attach a disk if the replacement disk was a slightly different size. In this release, you can replace an existing disk with another disk or attach a new disk that is nominally the same size provided that the pool is not already full.

    You do not need to reboot the system or export and import a pool to expand the pool size. As described above, you can enable the autoexpand property or use the zpool online -e command to expand the pool size.