ZFS: zpool replace returns error: cannot replace, devices have different sector alignment

Trying to replace a failed SSD in a zpool we encountered the following error:

 

cannot replace 4233944908106055 with ata-INTEL_SSDSC2BW240A4_CVD02KY2403GN: devices have different sector alignment

 

The pool was aligned to 4k sectors – e.g. ashift=12 – whereas the new SSD was aligned to 512b sectors. There’s a quick and easy fix to this – no need to use partitioning tools:

 

 

zpool replace [pool] [old-device] [new-device] -o ashift=12

 

Now check the pool status to verify that the command was successful:

 

zpool status

 

You should see something along the lines of:

 

423375696055                         UNAVAIL      0  0  0

ata-INTEL_SSDSC2BW240A4_CVDAKY2403GN  ONLINE       0  0  0  (resilvering)

 

All done.