Skip to content

Instantly share code, notes, and snippets.

@bahamat
Created April 5, 2020 05:26
Show Gist options
  • Save bahamat/c359b90284a7b3044a127bfdde3583b8 to your computer and use it in GitHub Desktop.
Save bahamat/c359b90284a7b3044a127bfdde3583b8 to your computer and use it in GitHub Desktop.
Convert a zpool from mirror/stripe (raid 10) to 3-way mirror
# zpool create tank mirror /var/tmp/f1 /var/tmp/f2 mirror /var/tmp/f3 /var/tmp/f4
# zpool list tank
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
tank 1.88G 1.36M 1.87G - - 0% 0% 1.00x ONLINE -
# zpool status tank
pool: tank
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/var/tmp/f1 ONLINE 0 0 0
/var/tmp/f2 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
/var/tmp/f3 ONLINE 0 0 0
/var/tmp/f4 ONLINE 0 0 0
errors: No known data errors
# zpool remove tank mirror-1
# zpool list tank
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
tank 960M 1.55M 958M - - 0% 0% 1.00x ONLINE -
# zpool status tank
pool: tank
state: ONLINE
scan: none requested
remove: Removal of vdev 1 copied 498K in 0h0m, completed on Sun Apr 5 05:23:58 2020
192 memory used for removed device mappings
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/var/tmp/f1 ONLINE 0 0 0
/var/tmp/f2 ONLINE 0 0 0
errors: No known data errors
# zpool attach tank /var/tmp/f2 /var/tmp/f3
# zpool list tank
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
tank 960M 639K 959M - - 0% 0% 1.00x ONLINE -
# zpool status tank
pool: tank
state: ONLINE
scan: resilvered 1.37M in 0 days 00:00:00 with 0 errors on Sun Apr 5 05:24:16 2020
remove: Removal of vdev 1 copied 498K in 0h0m, completed on Sun Apr 5 05:23:58 2020
192 memory used for removed device mappings
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/var/tmp/f1 ONLINE 0 0 0
/var/tmp/f2 ONLINE 0 0 0
/var/tmp/f3 ONLINE 0 0 0
errors: No known data errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment