Solaris 11: Criando um pool com espelhamento no ZFS
O ZFS foi criado com foco na simplicidade. Ele é ao mesmo tempo um sistema de arquivos (como o ext4) e um gerenciador de volumes (como o LVM).
Na instalação padrão do Solaris 11, onde o sistema de arquivos root (/) é montado em ZFS, só tenho o pool rpool (de “root pool”), onde os sistemas de arquivos estão montados.
ricardo@solaris:~$ sudo zpool status
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c3t0d0s0 ONLINE 0 0 0
errors: No known data errors
ricardo@solaris:~$ df -h
Filesystem Size Used Available Capacity Mounted on
rpool/ROOT/solaris 98G 3.2G 77G 5% /
/devices 0K 0K 0K 0% /devices
/dev 0K 0K 0K 0% /dev
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 9.5G 1.4M 9.5G 1% /system/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
81G 3.2G 77G 5% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
rpool/ROOT/solaris/var
98G 182M 77G 1% /var
swap 9.5G 12K 9.5G 1% /tmp
rpool/export 98G 32K 77G 1% /export
rpool/export/home 98G 32K 77G 1% /export/home
rpool/export/home/ricardo
98G 12M 77G 1% /export/home/ricardo
rpool 98G 39K 77G 1% /rpool
/export/home/ricardo 77G 12M 77G 1% /home/ricardo
ricardo@solaris:~$
Pelo comando cfgadm, verifico se tenho mais discos disponíveis, além do utilizado no rpool.
ricardo@solaris:~$ sudo cfgadm -s "select=type(disk)"
Ap_Id Type Receptacle Occupant Condition
sata6/0::dsk/c3t0d0 disk connected configured ok
sata6/2::dsk/c3t2d0 disk connected configured ok
sata6/3::dsk/c3t3d0 disk connected configured ok
Crio então um pool chamado test, utilizando os dois discos disponíveis, com espelhamento entre eles.
ricardo@solaris:~$ sudo zpool create test mirror c3t2d0 c3t3d0
ricardo@solaris:~$ sudo zpool status
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c3t0d0s0 ONLINE 0 0 0
errors: No known data errors
pool: test
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
test ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c3t2d0 ONLINE 0 0 0
c3t3d0 ONLINE 0 0 0
errors: No known data errors
Neste momento o sistema de arquivos já está montado e pronto para uso.
ricardo@solaris:~$ ls -lh /test/
total 0
ricardo@solaris:~$ sudo mkfile 1g /test/ArquivoTeste
ricardo@solaris:~$ ls -lh /test/
total 1963283
-rw------T 1 root root 1.0G May 3 08:22 ArquivoTeste
ricardo@solaris:~$ sudo zpool status
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c3t0d0s0 ONLINE 0 0 0
errors: No known data errors
pool: test
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
test ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c3t2d0 ONLINE 0 0 0
c3t3d0 ONLINE 0 0 0
errors: No known data errors
ricardo@solaris:~$ df -h
Filesystem Size Used Available Capacity Mounted on
rpool/ROOT/solaris 98G 3.2G 77G 5% /
/devices 0K 0K 0K 0% /devices
/dev 0K 0K 0K 0% /dev
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 9.5G 1.4M 9.5G 1% /system/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
81G 3.2G 77G 5% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
rpool/ROOT/solaris/var
98G 182M 77G 1% /var
swap 9.5G 12K 9.5G 1% /tmp
rpool/export 98G 32K 77G 1% /export
rpool/export/home 98G 32K 77G 1% /export/home
rpool/export/home/ricardo
98G 12M 77G 1% /export/home/ricardo
rpool 98G 39K 77G 1% /rpool
/export/home/ricardo 77G 12M 77G 1% /home/ricardo
test 9.8G 1.0G 8.8G 11% /test
ricardo@solaris:~$