- 2.1 ZFS Pool Concepts
- 2.2 Creating a Dynamic Stripe
- 2.3 Creating a Pool with Mirrored Devices
- 2.4 Creating a Pool with RAID-Z Devices
- 2.5 Creating a Spare in a Storage Pool
- 2.6 Adding a Spare Vdev to a Second Storage Pool
- 2.7 Replacing Bad Devices Automatically
- 2.8 Locating Disks for Replacement
- 2.9 Example of a Misconfigured Pool
2.3 Creating a Pool with Mirrored Devices
The following command creates a ZFS mirrored pool called mpool with a mirrored vdev. As expected, the new pool mpool is about half the capacity of dstripe. The pool dstripe is a concatenation of two disks of the same capacity, and mpool is a mirror of a disk of the same capacity.
The following command line shows how to use the zpool command with the subcommand create to create a pool with mirrored vdevs. After the create subcommand is the name of the new ZFS pool, mpool. The mirror subcommand will create a mirrored vdev with the disks c5t2d0 and c5t3d0.
# zpool create mpool mirror c5t2d0 c5t3d0
The following output is the creation of a mirrored ZFS pool called mpool. Using the zpool list command, you now can see the capacity of the newly created pool on line 5. Notice it is half the capacity of the dstripe pool.
1 # zpool create mpool mirror c5t2d0 c5t3d0 2 # zpool list 3 NAME SIZE USED AVAIL CAP HEALTH ALTROOT 4 dstripe 234M 75K 234M 0% ONLINE - 5 mpool 117M 73.5K 117M 0% ONLINE - 6 rpool 15.9G 3.21G 12.7G 20% ONLINE - |
Starting at line 20 (in the following part of the listing) is the status information of mpool. The disks c5t2d0 and c5t3d0 are configured as a mirror vdev, and the mirror is part of mpool. This is an important concept in reading the status information of ZFS pools. Notice the indentations on the pool name notations. The first is the name of the ZFS pool. Then at the first indentation of the name are the vdevs that are part of the pool. In the case of a dynamic stripe, this is the physical device. If the pool is created with redundant vdev(s), the first indentation will be mirror, raidz1, or raidz2. Then the next indentation will be the physical devices that comprise the redundant vdev. On lines 13 and 25 are the names dstripe and mpool, respectively. On lines 14 and 15 are the disks that belong to dstripe on the first indentation. On line 25 is the mirror configuration, and the next indented line lists the disks belonging to the mirror configuration. Compare Figures 2.1 and 2.2 for a graphical representation of each pool's configuration.
Figure 2.2 Pool mpool with a mirrored vdev
7 # zpool status 8 pool: dstripe 9 state: ONLINE 10 scrub: none requested 11 config: 12 13 NAME STATE READ WRITE CKSUM 14 dstripe ONLINE 0 0 0 15 c5t0d0 ONLINE 0 0 0 16 c5t1d0 ONLINE 0 0 0 17 18 errors: No known data errors 19 20 pool: mpool 21 state: ONLINE 22 scrub: none requested 23 config: 24 NAME STATE READ WRITE CKSUM 25 mpool ONLINE 0 0 0 26 mirror ONLINE 0 0 0 27 c5t2d0 ONLINE 0 0 0 28 c5t3d0 ONLINE 0 0 0 29 30 errors: No known data errors 31 32 pool: rpool 33 state: ONLINE 34 scrub: none requested 35 config: 36 37 NAME STATE READ WRITE CKSUM 38 rpool ONLINE 0 0 0 39 c3d0s0 ONLINE 0 0 0 40 errors: No known data errors |
Figure 2.2 illustrates the results of creating the ZFS pool mpool with one mirrored vdev.
The following sequence adds a second mirror vdev to the pool, doubling the size of pool mpool. Notice that after the addition of the second mirror vdev, the dstripe and mpool pools are the same capacity. Line 30 is the mirrored vdev with the physical disks c5t4d0 and c5t5d0 indented.
1. # zpool add mpool mirror c5t4d0 c5t5d0 2. # zpool list 3. NAME SIZE USED AVAIL CAP HEALTH ALTROOT 4. dstripe 234M 75K 234M 0% ONLINE - 5. mpool 234M 78K 234M 0% ONLINE - 6. rpool 15.9G 3.21G 12.7G 20% ONLINE - 7. # zpool status 8. pool: dstripe 9. state: ONLINE 10. scrub: none requested 11. config: 12. 13. NAME STATE READ WRITE CKSUM 14. dstripe ONLINE 0 0 0 15. c5t0d0 ONLINE 0 0 0 16. c5t1d0 ONLINE 0 0 0 17. 18. errors: No known data errors 19. 20. pool: mpool 21. state: ONLINE 22. scrub: none requested 23. config: 24. 25. NAME STATE READ WRITE CKSUM 26. mpool ONLINE 0 0 0 27. mirror ONLINE 0 0 0 28. c5t2d0 ONLINE 0 0 0 29. c5t3d0 ONLINE 0 0 0 30. mirror ONLINE 0 0 0 31. c5t4d0 ONLINE 0 0 0 32. c5t5d0 ONLINE 0 0 0 33. 34. errors: No known data errors 35. 36. pool: rpool 37. state: ONLINE 38. scrub: none requested 39. config: 40. NAME STATE READ WRITE CKSUM 41. rpool ONLINE 0 0 0 42. c3d0s0 ONLINE 0 0 0 43. errors: No known data errors |
Figure 2.3 shows the results of adding a second mirrored vdev to ZFS pool mpool.
Figure 2.3 Pool mpool with the added mirror vdev