How to Replace a Disk in a ZFS Root Pool
This procedure uses the zpool attach|detach
commands to replace the disk.
Example 6-3 Replacing a Disk in a ZFS Root Pool (SPARC or x86/EFI (GPT)
This example replaces c2t0d0
in the root pool named rpool
by using the zpool attach|detach
commands. It assumes that the replacement disk c2t1d0
is already physically connected to the system.
$ zpool attach rpool c2t0d0 c2t1d0 Make sure to wait until resilver is done before rebooting. $ zpool status rpool pool: rpool state: ONLINE scan: resilvered 11.7G in 0h5m with 0 errors on Fri Jul 20 13:45:37 2012 config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c2t0d0 ONLINE 0 0 0 c2t1d0 ONLINE 0 0 0 errors: No known data errors
After completing the boot test from the new disk c2t1d0
, you would detach c2t0d0
and, if necessary, enable the autoexpand
property.
$ zpool detach rpool c2t0d0 $ zpool list rpool NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 29.8G 152K 29.7G 0% 1.00x ONLINE - $ zpool set autoexpand=on rpool $ zpool list rpool NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 279G 146K 279G 0% 1.00x ONLINE -
You would complete the operation by setting the system to automatically boot from the new disk.
Example 6-4 Replacing SATA Disks in a Root Pool (SPARC or x86/EFI (GPT))
This example replaces c1t0d0
by using the zpool replace
command.
Systems with SATA disks require that before replacing a failed disk with the zpool replace
command, you take the disk offline and unconfigure it. As a best practice, scrub and clear the root pool first before replacing the disk.
Suppose that you are replacing c1t0d0
on the system. You would issue the following commands:
$ zpool scrub rpool $ zpool clear rpool $ zpool offline rpool c1t0d0 $ cfgadm -c unconfigure c1::dsk/c1t0d0
At this point, you would physically remove the failed disk c1t0d0
and insert the replacement disk on the same slot. Thus, the new disk is still c1t0d0
. On some hardware, you do not have to bring the disk online or reconfigure the replacement disk after it is inserted.
$ cfgadm -c configure c1::dsk/c1t0d0 $ zpool online rpool c1t0d0 $ zpool replace rpool c1t0d0 $ zpool status rpool
After resilvering is completed, you would install the boot blocks.
$ bootadm install-bootloader
Example 6-5 Replacing a Disk in a ZFS Root Pool (SPARC or x86/VTOC)
This example uses the zpool attach|detach
commands to replace c2t0d0s0
in the root pool named rpool
. It assumes that the replacement disk c2t1d0s0
is already physically connected to the system.
$ zpool attach rpool c2t0d0s0 c2t1d0s0 Make sure to wait until resilver is done before rebooting. $ zpool status rpool pool: rpool state: ONLINE scan: resilvered 11.7G in 0h5m with 0 errors on Fri Jul 20 13:45:37 2012 config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c2t0d0s0 ONLINE 0 0 0 c2t1d0s0 ONLINE 0 0 0 errors: No known data errors
You would test booting from the new disk c2t1d0s0
. You would also test booting from the old disk c2t0d0s0
in case c2t1d0s0
fails.
ok boot /pci@1f,700000/scsi@2/disk@1,0 ok boot /pci@1f,700000/scsi@2/disk@0,0
After completing the boot tests, you would detach c2t0d0s0
and, if necessary, enable the autoexpand
property.
$ zpool detach rpool c2t0d0s0 $ zpool list rpool NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 29.8G 152K 29.7G 0% 1.00x ONLINE - $ zpool set autoexpand=on rpool $ zpool list rpool NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT rpool 279G 146K 279G 0% 1.00x ONLINE -
You would complete the operation by setting the system to automatically boot from the new disk.
Example 6-6 Replacing SATA Disks in a Root Pool (SPARC or x86 (VTOC))
This example replaces c1t0d0
by using the zpool replace
command.
Systems with SATA disks require that before replacing a failed disk with the zpool replace
command, you take the disk offline and unconfigure it. As a best practice, scrub and clear the root pool first before replacing the disk.
Suppose that you are replacing c1t0d0
on the system. You would issue the following commands:
$ zpool scrub rpool $ zpool clear rpool $ zpool offline rpool c1t0d0s0 $ cfgadm -c unconfigure c1::dsk/c1t0d0
At this point, you would physically remove the failed disk c1t0d0
and insert the replacement disk on the same slot. Thus the new disk is still c1t0d0
. On some hardware, you do not have to bring the disk online or reconfigure the replacement disk after it is inserted.
$ cfgadm -c configure c1::dsk/c1t0d0
After confirming that the replacement disk c1t0d0s0
has an SMI label and a slice 0, you would issue the zpool replace
command and proceed with the replacement process.
$ zpool replace rpool c1t0d0s0 $ zpool online rpool c1t0d0s0 $ zpool status rpool
After resilvering is completed, you install the boot blocks.
$ bootadm install-bootloader