Sunday, 21 October 2018

Solaris ZFS : How to Offline / Online / Detach / Replace device in a storage pool By Devan

Solaris ZFS : How to Offline / Online / Detach / Replace device in a storage pool

Taking Devices Offline in a Storage Pool

When hardware is unreliable or not functioning properly, ZFS continues to read or write data to the device, assuming that the condition is only temporary. If the condition is not temporary, you can instruct ZFS to ignore the device by taking it offline. You can take a device offline by using the zpool offline command followed by the pool name and the device name. In the code example in the slide, the c1t0d0 device is taken offline. This device is located in the pool named datapool.
# zpool offline datapool c1t0d0
bringing device c1t0d0 offline
When a device is offline:
  • ZFS does not send it any requests.
  • It remains offline after a system reboot
  • It is not detached from the storage pool
By default, the offline state is persistent; consequently, the device remains offline even after the system is rebooted. If you want to take a device offline temporarily and have it automatically returned to the ONLINE state after the system is rebooted, use the “zpool offline -t” command instead.
When a device is taken offline, it is not detached from the storage pool. This means that you cannot use the device in another pool.
Note: Use “zpool offline -t” to take a device offline temporarily.

Detaching Devices from a Storage Pool

To detach a device from a mirrored storage pool, you can use the zpool detach command. For example, if you want to detach the c2t1d0 device that you just attached to the mirrored pool datapool, you can do so by entering the command “zpool detach datapool c2t1d0” as shown in the code example. You can verify that the device has been detached by running the zpool status command again.
# zpool detach datapool c2t1d0
Note: The device should already be offline. This operation is refused if there are no other valid replicas of the data.

Bringing Devices Online in a Storage Pool

To bring back a device online, use the “zpool online” command followed by the pool name and the device name. Data that was added to a storage pool when a device was offline resilvers to the device after it is brought back online.
# zpool online datapool c1t0d0
bringing device c1t0d0 online
Note: You cannot use device onlining to replace a disk. If you take a device offline, replace the drive, and try to bring it online, it remains in the faulted state.

Replacing Devices in a Storage Pool

There are two reasons why you may want or need to replace a device. You may want to replace a device with a larger device, or you may need to replace a failing or failed device. To replace a device, use the “zpool replace” command followed by the pool name and the device name.
If you are physically replacing a device with another device in the same location in a redundant pool, you need to identify only the replaced device. ZFS recognizes that it is a different disk in the same location. In the following example, you are replacing disk c1t1d0 in the pool named datapool.
# zpool replace datapool c1t1d0
If you are replacing a device in a storage pool with a disk in a different location, you must specify both devices. This is shown in the below example, where you are replacing disk c1t1d0 in the pool named datapool with disk c1t2d0.
# zpool replace hrpool c1t1d0 c1t2d0
Note: For the replacement operation to be successful, the replacement device must be greater than or equal to the minimum size of all the devices in a mirror or RAID-Z configuration.

No comments:

Post a Comment