User Tools

Site Tools


zfs:replace_a_disk

ZFS - Replace a Disk

  • Offline the disk, if necessary, with the zpool offline command.
  • Remove the disk to be replaced.
  • Insert the replacement disk.
  • Run the zpool replace command.
  • Bring the disk online with the zpool online command.

Check the Pool Status

zpool status Pool1

returns:

  pool: Pool1
 state: DEGRADED
status: One or more devices has experienced an unrecoverable error.  An
    attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
    using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://illumos.org/msg/ZFS-8000-9P
  scan: scrub repaired 0B in 21:37:28 with 0 errors on Sun Nov 15 21:37:28 2020
config:
 
	NAME                                            STATE     READ WRITE CKSUM
	Pool1                                           ONLINE       0     0     0
	  raidz1-0                                      ONLINE       0     0     0
	    gptid/2d35e96c-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0
	    gptid/2d41dcbd-b611-11ea-be33-00d861fcb7d8  DEGRADED     0     0    40  too many errors
	    gptid/2ddb5cb2-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0
 
errors: No known data errors

NOTE: This shows that Pool1 is in a degraded state.

It tells me that the device gptid/2d41dcbd-b611-11ea-be33-00d861fcb7d8 is the culprit.


Determine Drive Identifier

glabel status | grep 2d41

returns:

ptid/2d41dcbd-b611-11ea-be33-00d861fcb7d8     N/A  ada3p2

NOTE: This shows the device that is degraded and has too many errors is /dev/ada3.


Determine current Disks

ls -1 /dev/gptid/

returns:

2d35e96c-b611-11ea-be33-00d861fcb7d8
2d41dcbd-b611-11ea-be33-00d861fcb7d8
2dcf9d03-b611-11ea-be33-00d861fcb7d8
2ddb5cb2-b611-11ea-be33-00d861fcb7d8
b649914a-acc6-11ea-8ed5-00d861fcb7d8
b64bffb3-acc6-11ea-8ed5-00d861fcb7d8

Offline the Disk

Take the Broken Disk offline:

zpool offline Pool1 /dev/gptid/2d41dcbd-b611-11ea-be33-00d861fcb7d8

Replace the Physical Disk

Replace the physical disk, and check the status again, it should show the disk as offline now.

zpool status Pool1

returns:

  pool: Pool1
 state: DEGRADED
status: One or more devices has experienced an unrecoverable error.  An
    attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
    using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://illumos.org/msg/ZFS-8000-9P
  scan: scrub repaired 0B in 21:37:28 with 0 errors on Sun Nov 15 21:37:28 2020
config:
 
	NAME                                            STATE     READ WRITE CKSUM
	Pool1                                           ONLINE       0     0     0
	  raidz1-0                                      ONLINE       0     0     0
	    gptid/2d35e96c-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0
	    gptid/2d41dcbd-b611-11ea-be33-00d861fcb7d8  OFFLINE      0     0    40  too many errors
 	    gptid/2ddb5cb2-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0
 
errors: No known data errors

Determine current Disks Again

This should not contain details of the newly installed disk.

ls -1 /dev/gptid/

returns:

1d41dcbd-b611-11ea-be33-00d861fcb7d8
2d35e96c-b611-11ea-be33-00d861fcb7d8
2dcf9d03-b611-11ea-be33-00d861fcb7d8
2ddb5cb2-b611-11ea-be33-00d861fcb7d8
b649914a-acc6-11ea-8ed5-00d861fcb7d8
b64bffb3-acc6-11ea-8ed5-00d861fcb7d8

NOTE: Notice that 1d41dcbd-b611-11ea-be33-00d861fcb7d8 is newly there compared to when this was originally checked earlier.

Also, the old disk 2d41dcbd-b611-11ea-be33-00d861fcb7d8 is probably gone too.


Do the Replacement

zpool replace POOLNAME OLDDRIVE NEWDRIVE
 
zpool replace Pool1 /dev/gptid/2d41dcbd-b611-11ea-be33-00d861fcb7d8 /dev/gptid/1d41dcbd-b611-11ea-be33-00d861fcb7d8

Check the Status

It should now be rebuilding / resilvering.

zpool status Pool1

returns:

  pool: Pool1
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
    continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Wed Aug 10 12:12:12 2016
        241.4G scanned out of 8.55T at 432M/s, 6h12m to go
        85.21G resilvered, 10.69% done
config:
 
	NAME                                            STATE     READ WRITE CKSUM
	Pool1                                           ONLINE       0     0     0
	  raidz1-0                                      ONLINE       0     0     0
	    gptid/2d35e96c-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0
            gptid/1d41dcbd-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0  (resilvering)
  	    gptid/2ddb5cb2-b611-11ea-be33-00d861fcb7d8  ONLINE       0     0     0
 
errors: No known data errors

NOTE: Once the resilver is complete the status should be back to normal.

zfs/replace_a_disk.txt · Last modified: 2020/11/26 11:44 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki