Solaris ZFS : How to Create and Manage Mirrored Storage Pools
Creating a Mirrored Storage Pool
To create a mirrored storage pool, you use the zpool create command followed by the pool name, the mirror keyword, and the storage devices that will compose the mirror. Multiple mirrors can be specified by repeating the mirror keyword on the command line.
# zpool create datapool c1t0d0 c2t0d0 mirror c3t0d0 c4t0d0
The command shown in the example creates a pool called datapool with two 2-way mirrors. The first mirror contains the devices c1t0d0 and c2t0d0, and the second mirror contains the devices c3t0d0 and c4t0d0. Data is dynamically striped across both mirrors, with data being redundant between each disk within a mirror.
Adding Log Devices to a Storage Pool
You can specify a separate log device when a pool is created or add it after the pool is created. You can also remove a log device from a pool. The keyword log is used to designate a device as the log device.
# zpool create datapool mirror c1t1d0 c1t2d0 log mirror c1t5d0 c1t8d0
In the example shown above, a mirrored storage pool called datapool is created that consists of two virtual devices. The first virtual device contains the disks c1t1d0 and c1t2d0. The second virtual device, which is the log device, contains the disks c1t5d0 and c1t8d0.
A log device:
- Can be added as part of, or after, pool creation
- Can be removed
- Is designated by the keyword log
Adding Cache Devices to a Storage Pool
You can create a storage pool with one or more cache devices to cache storage pool data. You can remove cache devices from the pool after the pool is created. However, cache devices cannot be mirrored or be part of a RAID-Z configuration. The keyword cache is used to designate a cache device.
# zpool create appool mirror c0t2d0 c0t4d0 cache c0t0d0
In the example shown above, a mirrored pool called datapool is created that consists of two disks: c0t2d0 and c0t4d0. By using the keyword cache, you have designated the device c0t0d0 in the pool for the cache.
After you have created a pool, there are several tasks that you can perform to manage the physical devices within the pool, such as adding top-level virtual devices, attaching and detaching devices, taking a device offline, bringing a device online, and designating hot spares.
Adding Devices to a Storage Pool
To add a new virtual device to a pool, use the ‘zpool add‘ command. By adding a new top-level virtual device, space is dynamically added to the pool. This space is immediately available to all the data sets within the pool.
# zpool add appool mirror c2t1d0 c2t2d0
# zpool add appool mirror c2t1d0 c2t2d0
In the example shown above, you are adding a mirrored device to an existing pool called appool. The mirror consists of two disks: c2t1d0 and c2t2d0.
Use ‘zpool status‘ to determine the disks that are currently configured for a storage pool. Then, before adding a device to the pool, you must execute the format command to identify any additional disks configured in the system.
Attaching Devices to a Storage Pool
You can use the ‘zpool attach‘ command to attach a new device to an existing mirrored or non-mirrored virtual device (vdev). With this command, you can transform a two-way mirrored configuration into a three-way mirrored configuration, for example, or convert a non-redundant storage pool into a redundant storage pool.
# zpool attach appool c2t4d0 c2t5d0
In the above example, a new device, c2t4d0, is being attached to an existing device, c2t5d0, to create either a mirrored pool or a three-way mirror in an already mirrored pool.
You can run the zpool status command to verify that the device is attached successfully. In the example in the slide, you can see that the c2t5d0 device has been attached to the mirrored pool named appool. You can also see that the new device has already been resilvered. In ZFS, the new device begins to resilver immediately.
# zpool status appool
pool: appool
state: ONLINE
scan: resilvered 29.5K in 1s with 0 errors on Sat Jan 13 22:48:42 2018
config:
NAME STATE READ WRITE CKSUM
appool ONLINE 0 0 0
c2t1d0 ONLINE 0 0 0
c2t2d0 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
c2t3d0 ONLINE 0 0 0
c2t4d0 ONLINE 0 0 0
c2t5d0 ONLINE 0 0 0 73.5K resilvered ### new attached device
errors: No known data errors
No comments:
Post a Comment