You might need to replace a disk in the root pool for the following reasons:
The root pool is too small and you want to replace it with a larger disk
The root pool disk is failing. In a non-redundant pool, if the disk is failing and the system no longer boots, boot from another source such as a CD or the network. Then, replace the root pool disk.
You can replace disks by using one of two methods:
Using the zpool replace command.
This method involves scrubbing and clearing the root pool of dirty time logs (DTLs), then replacing the disk. After the new disk is installed, you apply the boot blocks manually.
Using the zpool detach|attach commands.
This method involves attaching the new disk and verifying that it is working properly, then detaching the faulty disk.
If you are replacing root pool disks that have the SMI (VTOC) label, ensure that you fulfill the following requirements:
SPARC: Confirm that the disk has an SMI (VTOC) disk label and a slice 0 that contains the bulk of the disk space. If you need to relabel the disk and create a slice 0, see How to Replace a ZFS Root Pool (VTOC) in Managing Devices in Oracle Solaris 11.3.
x86: Confirm that the disk has an fdisk partition, an SMI disk label, and a slice 0. If you need to repartition the disk and create a slice 0, see Modifying Slices or Partitions in Managing Devices in Oracle Solaris 11.3.
This procedure uses the zpool attach|detach commands to replace the disk.
# zpool attach root-pool current-disk new-disk
Where current-disk becomes old-disk to be detached at the end of this procedure.
The correct disk labeling and the boot blocks are applied automatically.
If resilvering has been completed, the output includes a message similar to the following:
scan: resilvered 11.6G in 0h5m with 0 errors on Fri Jul 20 13:57:25 2014
# zpool detach root-pool old-disk
Where old-disk is the current-disk of Step 2.
# zpool set autoexpand=on root-pool
SPARC: Use either the eeprom command or the setenv command from the boot PROM.
x86: Reconfigure the system BIOS.
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 19 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-bootloaderExample 20 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 21 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