User Tools

Site Tools


computing:storage:zfs_replace_drive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
computing:storage:zfs_replace_drive [2021/03/29 14:21]
gcooper old revision restored (2021/03/29 10:00)
computing:storage:zfs_replace_drive [2023/07/05 11:39] (current)
gcooper
Line 1: Line 1:
 ====== ZFS Failed Disk Replacement ====== ====== ZFS Failed Disk Replacement ======
 +
 +**Hot Spares**: https://docs.oracle.com/cd/E19120-01/open.solaris/817-2271/gcvcw/index.html
 +
 +**Hot Spares**: https://docs.oracle.com/cd/E53394_01/html/E54801/gpegp.html
  
 https://docs.joyent.com/private-cloud/troubleshooting/disk-replacement https://docs.joyent.com/private-cloud/troubleshooting/disk-replacement
Line 9: Line 13:
 <note important>Identify the problem drive and location **exactly** before replacing!</note> <note important>Identify the problem drive and location **exactly** before replacing!</note>
  
-<note tip>**Power the server off** when manipulating disk drives, if at all possible.</note>+<note tip>**Power the server off when manipulating disk drives**, if at all possible.  This can go a long way towards eliminating self inflicted wounds!</note>
  
 <note tip>The normal replacement procedure involves fixing the pool first, then removing the failed drive. Replace in-place if you must.</note> <note tip>The normal replacement procedure involves fixing the pool first, then removing the failed drive. Replace in-place if you must.</note>
 +
 +===== Napp-IT =====
  
 Replace with spare: Replace with spare:
Line 19: Line 25:
 Replace in-place drive: Replace in-place drive:
  
-**Degraded -> Offline -> Remove -> Pull bad drive -> Install New Drive -> Initialize -> Add to VDEV**+**Degraded -> Offline -> Remove -> Pull Bad Drive -> Install New Drive -> Initialize -> Add to VDEV**
  
 Wait for the **resilvering** to finish then run a **scrub** job. Wait for the **resilvering** to finish then run a **scrub** job.
 +
 +===== CLI =====
 +
 +==== Replace a Failed Drive ====
 +
 +https://www.thegeekdiary.com/solaris-zfs-how-to-offline-online-detach-replace-device-in-a-storage-pool/
 +
 +<note tip>Use ''zpool replace'' to replace a failed drive.  It is safest to replace a failed drive with another existent drive **in another slot**.</note>
 +
 +<file>
 +zpool replace <poolname> <faileddisk> <newdisk>
 +</file>
 +
 +<note tip>To replace a failed drive by replacing it **in-place**, it is best to shut down the server, remove and replace the failed drive, then use ''zpool replace'' specifying only the drive being replaced.</note>
 +
 +<file>
 +zpool replace <poolname> <disk>
 +</file>
 +
 +<note tip>After initializing a new replacement drive in-place using Napp-IT on OmniOS, this is the command that Napp-IT uses when replacing a drive.
 +</note>
 +
 +<file>
 +zpool replace -f "poolname" c0t5000C500418A83B3d0 c0t5000C500836A90C7d0
 +</file>
 +
 +<note tip>''zpool detach'' will remove a drive from a VDEV, turning a mirrored VDEV into a single drive VDEV.  Use ''zpool attach'' to recreate the mirror.  In general, **do not use these commands to replace a failed drive**.</note>
 +
 +==== Replace Old Drives With New or Bigger ====
 +
 +https://www.thegeekdiary.com/solaris-zfs-how-to-offline-online-detach-replace-device-in-a-storage-pool/
 +
 +<note tip>It is safest to ''zpool attach'' an additional mirror to a mirrored VDEV (which adds redundancy) then remove the drive being upgraded afterwards.</note>
 +
 +<file>
 +zpool attach <poolname> <existingvdevmember> <newdrive>
 +# Wait for it to resilver, which adds redundancy, then
 +zpool detach <poolname> <drivebeingreplaced>
 +</file>
 +
 +==== Spares ====
 +
 +Usually a spare can replace a faulted disk but **remains a spare**.  The idea behind this is that you replace the faulted disk, then replace the spare with the new and the spare remains a spare.
 +
 +If you want to remove the spare property, first remove then replace.
 +
 +===== Pool Expansion =====
 +
 +https://tomasz.korwel.net/2014/01/03/growing-zfs-pool/
 +
 +https://docs.oracle.com/cd/E36784_01/html/E36835/gazgm.html
 +
 +==== CLI ====
 +
 +<note tip>You can expand a ZFS pool by replacing redundant drives on replacing them **one at a time**.  **Be sure to wait for the resilvering to finish before replacing the next drive!**</note>
 +
 +<note tip>Shut down the server to physically replace drives. If you have hotswap capability, you can use ''zpool offline <poolname> <disk>'' to tell ZFS to ignore the device being replaced.</note>
 +
 +<file>
 +# Set the autoexpand property so the new disk space is recognized
 +zpool set autoexpand=on <poolname>
 +# Verify everything is online before replacing a disk
 +zpool status
 +# Take the old, smaller disk offline before removing it
 +zpool offline <poolname> <olddisk>
 +##### Physically replace the disk with the new larger disk #####
 +zpool online <poolname> <samediskname>
 +# Optionally kick off the autoexpand of each new larger device
 +zpool online -e <poolname> <device>
 +</file>
computing/storage/zfs_replace_drive.1617049314.txt.gz · Last modified: 2021/03/29 14:21 by gcooper