Skip to content

Instantly share code, notes, and snippets.

@AasSuhendar
Forked from CMCDragonkai/new_disk_zfs_raid_0.md
Created September 15, 2022 02:29
Show Gist options
  • Save AasSuhendar/c5695f6652237ca1f60574ffcc418ae5 to your computer and use it in GitHub Desktop.
Save AasSuhendar/c5695f6652237ca1f60574ffcc418ae5 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment