Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active March 31, 2024 08:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CMCDragonkai/f9c9cf19b92bec90da06d8ee2bcf0076 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/f9c9cf19b92bec90da06d8ee2bcf0076 to your computer and use it in GitHub Desktop.
Adding a new disk ZFS RAID-0 #zfs

Adding a new disk ZFS RAID-0

When adding a new disk to ZFS RAID-0, you must ensure that the disk has the same storage size as the other disks.

You will need the gptfdisk package to use sgdisk.

hdd='/dev/disk/by-id/<DISKNAME>'
zpool labelclear -f "$hdd" || true
sgdisk --zap-all "$hdd"
sgdisk -n 1:0:0 -t 1:8300 -c 1:"Main Data" "$hdd"
zpool add rpool "$hdd-part1"

After adding a disk to the pool, you may find disk corruptions.

zpool status -v

You can try to restore the corrupted files or just delete them if they don't matter.

Then you have to try to scrub the pool:

# this will try to repair everything (do this after deletion or restoration)
zpool scrub rpool

# when all errors are finally repaired or dropped, do this to clear the state of the pool
zpool clear rpool
@CMCDragonkai
Copy link
Author

You may need to upgrade the pool afterwards:

zpool upgrade rpool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment