Solaris 10 新建ZFS pool的簡單測試

測試機上有4顆146G的硬碟,在安裝Solaris 10 時指定了其中一顆來當系統,格式則選擇ZFS。
接下來的目標是把其他3顆合併成一顆的容量來使用。

查詢目前ZFS的狀態,已建立rpool的root pool,使用了一顆硬碟(c4t5000C500091FB283d0s0)
bash-3.2# zpool status
  pool: rpool
 state: ONLINE
 scan: none requested
config:
        NAME                       STATE     READ WRITE CKSUM
        rpool                      ONLINE       0     0     0
          c4t5000C500091FB283d0s0  ONLINE       0     0     0
errors: No known data errors


接著查詢系統內磁碟的訊息,由下可知共有四個磁碟,還有三個尚未使用
bash-3.2# format          
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c4t5000C5000EA49A43d0 <SEAGATE-ST914602SSUN146G-0603-136.73GB>
          /scsi_vhci/disk@g5000c5000ea49a43
       1. c4t5000C5000EA30353d0 <SEAGATE-ST914602SSUN146G-0603-136.73GB>
          /scsi_vhci/disk@g5000c5000ea30353
       2. c4t5000C500091EA2C7d0 <SEAGATE-ST914602SSUN146G-0603-136.73GB>
          /scsi_vhci/disk@g5000c500091ea2c7
       3. c4t5000C500091FB283d0 <SEAGATE-ST914602SSUN146G-0603 cyl 14087 alt 2 hd 24 sec 848>
          /scsi_vhci/disk@g5000c500091fb283
Specify disk (enter its number):

建立一個空的文件夾,作為mount point
bash-3.2# mkdir /test

新建一個pool並加入三個硬碟,加入參數-f,強制硬碟加入
bash-3.2# zpool create -f dpool c4t5000C5000EA30353d0 c4t5000C500091EA2C7d0 c4t5000C5000EA49A43d0
'dpool' successfully created, but with no redundancy; failure of one
device will cause loss of the pool
bash-3.2#

如果要加入已是其他pool的硬碟時,就算有強制的參數-f ,仍會出現錯誤。
bash-3.2# zpool add -f dpool c4t5000C500091FB283d0
invalid vdev specification
the following errors must be manually repaired:
/dev/dsk/c4t5000C500091FB283d0s0 is part of active ZFS pool rpool. Please see zpool(1M).
/dev/dsk/c4t5000C500091FB283d0s2 is part of active ZFS pool rpool. Please see zpool(1M).


查詢新建之後的狀態
bash-3.2# zpool status
  pool: dpool
 state: ONLINE
 scan: none requested
config:
        NAME                     STATE     READ WRITE CKSUM
        dpool                    ONLINE       0     0     0
          c4t5000C5000EA30353d0  ONLINE       0     0     0
          c4t5000C500091EA2C7d0  ONLINE       0     0     0
          c4t5000C5000EA49A43d0  ONLINE       0     0     0
errors: No known data errors

  pool: rpool
 state: ONLINE
 scan: none requested
config:
        NAME                       STATE     READ WRITE CKSUM
        rpool                      ONLINE       0     0     0
          c4t5000C500091FB283d0s0  ONLINE       0     0     0
errors: No known data errors

將dpool指定一個mount point
bash-3.2# zfs set mountpoint="/test" dpool

完成後,就可以像一般操作一樣操作資料夾,總容量為402G。
bash-3.2# df -h
Filesystem             size   used  avail capacity  Mounted on
(略…)
dpool                  402G    31K   402G     1%    /test