In this blog post we are going to create a Mirrored file system using ZFS.
We are going to use 5 Disks, 4 for data and 1 as a hot spare.
The disks will be 200GB with a combined size of 1TB, but acutal usable space will only be 400GB.
This file system has the ability to support 2 disks failing and to have one disk replaced automatically by ZFS its self.
zpool create mypool mirror disk01 disk02 zpool addmypool mirror disk03 disk04 zpool add mypool spare drive05 zpool set autoreplace=on mypool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT mypool 390M 120K 390M 0% 1.00x ONLINE -
pool: mypool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM mypool ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 /zdisk/disk1.img ONLINE 0 0 0 /zdisk/disk2.img ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 /zdisk/disk3.img ONLINE 0 0 0 /zdisk/disk4.img ONLINE 0 0 0 spares /zdisk/disk5.img AVAIL errors: No known data errors
You can now access the new file system under “/mypool” and begin adding files there in the knowledge that should 1 disk fail, ZFS will auto replace it with the spare, giving you time to replace the drive.