Both sub-commands add & attach are used to configure additional storage for the zpool but are different in the way they function.
'zpool add' simply adds a vdev to a zpool.
In the below example I created a zpool called tpool & then added a vdev to it:
root@1z0822:~# zpool list tpool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tpool 195M 153K 195M 0% 1.00x ONLINE -
root@1z0822:~# zpool add tpool /root/disk2
root@1z0822:~# zpool list tpool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tpool 390M 122K 390M 0% 1.00x ONLINE -
root@1z0822:~#
'zpool add' simply adds a vdev to a zpool.
In the below example I created a zpool called tpool & then added a vdev to it:
root@1z0822:~# zpool list tpool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tpool 195M 153K 195M 0% 1.00x ONLINE -
root@1z0822:~# zpool add tpool /root/disk2
root@1z0822:~# zpool list tpool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tpool 390M 122K 390M 0% 1.00x ONLINE -
root@1z0822:~#
The result was a simple concat operation.
In the second example I attached a vdev to the zpool:
root@1z0822:~# zpool list tpool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tpool 195M 128K 195M 0% 1.00x ONLINE -
root@1z0822:~# zpool attach tpool /root/disk1 /root/disk2
root@1z0822:~# zpool list tpool
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
tpool 195M 126K 195M 0% 1.00x ONLINE -
root@1z0822:~#
root@1z0822:~# zpool status tpool
pool: tpool
state: ONLINE
scan: resilvered 88K in 0h0m with 0 errors on Sat Apr 23 21:30:32 2016
config:
NAME STATE READ WRITE CKSUM
tpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
/root/disk1 ONLINE 0 0 0
/root/disk2 ONLINE 0 0 0
errors: No known data errors
root@1z0822:~#
A zpool attach operation results in the creation of a mirror.
Hope this helps clarify the difference between zpool add/attach.
No comments:
Post a Comment