Project

General

Profile

ZFSな話

SunOSでUNIXの世界に入っておきながらいまだにZFSを経験してないのは人として何かがおかしい!! ……………と以前から思っていたわけですよ。で、そんな人間がとりあえず機材を揃えてやってみた、というお話。

※この項目は(他のペイジ同様)書きかけです。逐次、補足していきます。

背景

もう少し真面目に語りますと、今までML110G6にSATAなディスクを3個ほど接続、VMWare ESXi上で各種サービス用の仮想マシンを動かしていたわけなのですが、ここ数年の夏の猛暑を乗り越えて、もうそろそろ機材交換の時期に来ているのではないかな、というのが発端です。で、どうせやるなら追加発注したML110G7やら、某方面からお借りしている10GbEなNIC、某実験用にまとめ買いした3TBytesのHDD x3があるので、こいつをストレージサーバにしてみようか、と考えた次第です。

材料

1. ハードウェア

だいたいこんな構成です;

  • ML110G7
  • メモリ: 32GBytes
  • HDD: Seagate ST3000DM001 x3
  • SSD: Intel SSDSC2CT180A4 x1

2. OS

OpenIndiana 151a8

ZFS

なにしろ初挑戦なのであっちこっちのWebペイジを手繰りながらやってます。なので、(いつものことですが)正しさは保証できません…。

疑問1. ZILとL2ARCは同一SSD上で共存できるか?

答え: 可能。そういう風にスライスを切ってやればよろしい( http://constantin.glez.de/blog/2011/02/frequently-asked-questions-about-flash-memory-ssds-and-zfs#both )。うーん。zpoolコマンドの指定の仕方を見ていれば、そりゃそうだろうなぁ、とは思った次第です。

んで実際には以下の様にしました。

root@openindiana:/home/yukikaze# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c4t0d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
          /pci@0,0/pci103c,330d@1f,2/disk@0,0
       1. c4t1d0 <ATA-ST3000DM001-9YN1-CC4B-2.73TB>
          /pci@0,0/pci103c,330d@1f,2/disk@1,0
       2. c4t2d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
          /pci@0,0/pci103c,330d@1f,2/disk@2,0
       3. c4t4d0 <ATA-INTEL SSDSC2CT18-335t-167.68GB>
          /pci@0,0/pci103c,330d@1f,2/disk@4,0
Specify disk (enter its number): 3
selecting c4t4d0
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        expand - expand label to use whole disk
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> 0
Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256      167.67GB          351635470    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: ^C
partition> disk
`disk' is not expected.
partition> exit
`exit' is not expected.
partition> quit

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> disk

AVAILABLE DISK SELECTIONS:
       0. c4t0d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
          /pci@0,0/pci103c,330d@1f,2/disk@0,0
       1. c4t1d0 <ATA-ST3000DM001-9YN1-CC4B-2.73TB>
          /pci@0,0/pci103c,330d@1f,2/disk@1,0
       2. c4t2d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
          /pci@0,0/pci103c,330d@1f,2/disk@2,0
       3. c4t4d0 <ATA-INTEL SSDSC2CT18-335t-167.68GB>
          /pci@0,0/pci103c,330d@1f,2/disk@4,0
Specify disk (enter its number)[3]: 3
selecting c4t4d0
[disk formatted]
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        expand - expand label to use whole disk
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> l
Ready to label disk, continue? no
partition> p
Current partition table (original):
Total disk sectors available: 351635437 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256      167.67GB          351635470    
  1 unassigned    wm                 0           0               0    
  2 unassigned    wm                 0           0               0    
  3 unassigned    wm                 0           0               0    
  4 unassigned    wm                 0           0               0    
  5 unassigned    wm                 0           0               0    
  6 unassigned    wm                 0           0               0    
  8   reserved    wm         351635471        8.00MB          351651854    

partition> ?
Expecting one of the following: (abbreviations ok):
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        expand - expand label to use whole disk
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit

partition> 0
Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256      167.67GB          351635470    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: 
Enter new starting Sector[256]: 
Enter partition size[351635215b, 351635470e, 171696mb, 167gb, 0tb]: 16g
partition> p
Current partition table (unnamed):
Total disk sectors available: 351635437 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256       16.00GB          33554687    
  1 unassigned    wm                 0           0               0    
  2 unassigned    wm                 0           0               0    
  3 unassigned    wm                 0           0               0    
  4 unassigned    wm                 0           0               0    
  5 unassigned    wm                 0           0               0    
  6 unassigned    wm                 0           0               0    
  8   reserved    wm         351635471        8.00MB          351651854    

partition> 1
Part      Tag    Flag     First Sector         Size         Last Sector
  1 unassigned    wm                 0           0               0    

Enter partition id tag[usr]: 
Enter partition permission flags[wm]: 
Enter new starting Sector[33554688]: 
Enter partition size[0b, 33554687e, 0mb, 0gb, 0tb]: 64gb
partition> p
Current partition table (unnamed):
Total disk sectors available: 351635437 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256       16.00GB          33554687    
  1        usr    wm          33554688       64.00GB          167772415    
  2 unassigned    wm                 0           0               0    
  3 unassigned    wm                 0           0               0    
  4 unassigned    wm                 0           0               0    
  5 unassigned    wm                 0           0               0    
  6 unassigned    wm                 0           0               0    
  8   reserved    wm         351635471        8.00MB          351651854    

partition> ?
Expecting one of the following: (abbreviations ok):
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        expand - expand label to use whole disk
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit

partition> label
Ready to label disk, continue? yes

partition> p
Current partition table (unnamed):
Total disk sectors available: 351635437 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm               256       16.00GB          33554687    
  1        usr    wm          33554688       64.00GB          167772415    
  2 unassigned    wm                 0           0               0    
  3 unassigned    wm                 0           0               0    
  4 unassigned    wm                 0           0               0    
  5 unassigned    wm                 0           0               0    
  6 unassigned    wm                 0           0               0    
  8   reserved    wm         351635471        8.00MB          351651854    

partition> quit

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> quit
root@openindiana:/home/yukikaze#

まあ、若干余計なゴミが残っていますが。

疑問2. プール? ってのはどんな風にしてつくればいいのん?

こちらは簡単。以下の通り。

root@openindiana:/home/yukikaze# zpool create tank raidz c4t0d0 c4t1d0 c4t2d0 log c4t4d0s0 cache c4t4d0s1
root@openindiana:/home/yukikaze# zpool status
  pool: rpool1
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        rpool1      ONLINE       0     0     0
          c3t0d0s0  ONLINE       0     0     0

errors: No known data errors

  pool: tank
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        tank        ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c4t0d0  ONLINE       0     0     0
            c4t1d0  ONLINE       0     0     0
            c4t2d0  ONLINE       0     0     0
        logs
          c4t4d0s0  ONLINE       0     0     0
        cache
          c4t4d0s1  ONLINE       0     0     0

errors: No known data errors
root@openindiana:/home/yukikaze# df -h
Filesystem            Size  Used Avail Use% Mounted on
rpool1/ROOT/openindiana
                      4.0G  1.6G  2.4G  41% /
swap                   29G  352K   29G   1% /etc/svc/volatile
/usr/lib/libc/libc_hwcap1.so.1
                      4.0G  1.6G  2.4G  41% /lib/libc.so.1
swap                   29G  8.0K   29G   1% /tmp
swap                   29G   44K   29G   1% /var/run
rpool1/export         2.4G   32K  2.4G   1% /export
rpool1/export/home    2.4G   32K  2.4G   1% /export/home
rpool1/export/home/yukikaze
                      2.4G   36K  2.4G   1% /export/home/yukikaze
rpool1                2.4G   46K  2.4G   1% /rpool1
/export/home/yukikaze
                      2.4G   36K  2.4G   1% /home/yukikaze
tank                  5.4T  192K  5.4T   1% /tank
root@openindiana:/home/yukikaze# ls -al /tank
total 13
drwxr-xr-x  2 root root  2 2013-10-14 08:17 .
drwxr-xr-x 25 root root 27 2013-10-14 08:17 ..
root@openindiana:/home/yukikaze#

logでZIL用の領域を指定、cacheでL2ARC用の領域を指定……で、いいらしいですよ?