Project

General

Profile

ZFSな話 » History » Version 1

Tsutomu KIMURA, 10/14/2013 08:53 AM

1 1 Tsutomu KIMURA
h1. ZFSな話
2
3
SunOSでUNIXの世界に入っておきながらいまだにZFSを経験してないのは人として何かがおかしい!! ……………と以前から思っていたわけですよ。で、そんな人間がとりあえず機材を揃えてやってみた、というお話。
4
5
※この項目は(他のペイジ同様)書きかけです。逐次、補足していきます。
6
7
h2. 背景
8
9
もう少し真面目に語りますと、今までML110G6にSATAなディスクを3個ほど接続、VMWare ESXi上で各種サービス用の仮想マシンを動かしていたわけなのですが、ここ数年の夏の猛暑を乗り越えて、もうそろそろ機材交換の時期に来ているのではないかな、というのが発端です。で、どうせやるなら追加発注したML110G7やら、某方面からお借りしている10GbEなNIC、某実験用にまとめ買いした3TBytesのHDD x3があるので、こいつをストレージサーバにしてみようか、と考えた次第です。
10
11
h2. 材料
12
13
h3. 1. ハードウェア
14
15
だいたいこんな構成です;
16
17
* ML110G7(NTT-Xストアで12,000くらいだった)
18
* メモリ: 32GBytes
19
* HDD: Seagate ST3000DM001(3TBytes) x3
20
* SSD: Intel SSDSC2CT180A4(180GBytes) x1
21
22
h3. 2. OS
23
24
OpenIndiana 151a8
25
26
h2. ZFS
27
28
なにしろ初挑戦なのであっちこっちのWebペイジを手繰りながらやってます。なので、(いつものことですが)正しさは保証できません…。
29
30
h3. 疑問1. ZILとL2ARCは同一SSD上で共存できるか?
31
32
答え: 可能。そういう風にスライスを切ってやればよろしい( http://constantin.glez.de/blog/2011/02/frequently-asked-questions-about-flash-memory-ssds-and-zfs#both )。うーん。zpoolコマンドの指定の仕方を見ていれば、そりゃそうだろうなぁ、とは思った次第です。
33
34
んで実際には以下の様にしました。
35
36
<pre>
37
root@openindiana:/home/yukikaze# format
38
Searching for disks...done
39
40
41
AVAILABLE DISK SELECTIONS:
42
       0. c4t0d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
43
          /pci@0,0/pci103c,330d@1f,2/disk@0,0
44
       1. c4t1d0 <ATA-ST3000DM001-9YN1-CC4B-2.73TB>
45
          /pci@0,0/pci103c,330d@1f,2/disk@1,0
46
       2. c4t2d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
47
          /pci@0,0/pci103c,330d@1f,2/disk@2,0
48
       3. c4t4d0 <ATA-INTEL SSDSC2CT18-335t-167.68GB>
49
          /pci@0,0/pci103c,330d@1f,2/disk@4,0
50
Specify disk (enter its number): 3
51
selecting c4t4d0
52
[disk formatted]
53
54
55
FORMAT MENU:
56
        disk       - select a disk
57
        type       - select (define) a disk type
58
        partition  - select (define) a partition table
59
        current    - describe the current disk
60
        format     - format and analyze the disk
61
        fdisk      - run the fdisk program
62
        repair     - repair a defective sector
63
        label      - write label to the disk
64
        analyze    - surface analysis
65
        defect     - defect list management
66
        backup     - search for backup labels
67
        verify     - read and display labels
68
        inquiry    - show vendor, product and revision
69
        volname    - set 8-character volume name
70
        !<cmd>     - execute <cmd>, then return
71
        quit
72
format> p
73
74
75
PARTITION MENU:
76
        0      - change `0' partition
77
        1      - change `1' partition
78
        2      - change `2' partition
79
        3      - change `3' partition
80
        4      - change `4' partition
81
        5      - change `5' partition
82
        6      - change `6' partition
83
        expand - expand label to use whole disk
84
        select - select a predefined table
85
        modify - modify a predefined partition table
86
        name   - name the current table
87
        print  - display the current table
88
        label  - write partition map and label to the disk
89
        !<cmd> - execute <cmd>, then return
90
        quit
91
partition> 0
92
Part      Tag    Flag     First Sector         Size         Last Sector
93
  0        usr    wm               256      167.67GB          351635470    
94
95
Enter partition id tag[usr]: 
96
Enter partition permission flags[wm]: ^C
97
partition> disk
98
`disk' is not expected.
99
partition> exit
100
`exit' is not expected.
101
partition> quit
102
103
104
FORMAT MENU:
105
        disk       - select a disk
106
        type       - select (define) a disk type
107
        partition  - select (define) a partition table
108
        current    - describe the current disk
109
        format     - format and analyze the disk
110
        fdisk      - run the fdisk program
111
        repair     - repair a defective sector
112
        label      - write label to the disk
113
        analyze    - surface analysis
114
        defect     - defect list management
115
        backup     - search for backup labels
116
        verify     - read and display labels
117
        inquiry    - show vendor, product and revision
118
        volname    - set 8-character volume name
119
        !<cmd>     - execute <cmd>, then return
120
        quit
121
format> disk
122
123
124
AVAILABLE DISK SELECTIONS:
125
       0. c4t0d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
126
          /pci@0,0/pci103c,330d@1f,2/disk@0,0
127
       1. c4t1d0 <ATA-ST3000DM001-9YN1-CC4B-2.73TB>
128
          /pci@0,0/pci103c,330d@1f,2/disk@1,0
129
       2. c4t2d0 <ATA-ST3000DM001-9YN1-CC4H-2.73TB>
130
          /pci@0,0/pci103c,330d@1f,2/disk@2,0
131
       3. c4t4d0 <ATA-INTEL SSDSC2CT18-335t-167.68GB>
132
          /pci@0,0/pci103c,330d@1f,2/disk@4,0
133
Specify disk (enter its number)[3]: 3
134
selecting c4t4d0
135
[disk formatted]
136
format> p
137
138
139
PARTITION MENU:
140
        0      - change `0' partition
141
        1      - change `1' partition
142
        2      - change `2' partition
143
        3      - change `3' partition
144
        4      - change `4' partition
145
        5      - change `5' partition
146
        6      - change `6' partition
147
        expand - expand label to use whole disk
148
        select - select a predefined table
149
        modify - modify a predefined partition table
150
        name   - name the current table
151
        print  - display the current table
152
        label  - write partition map and label to the disk
153
        !<cmd> - execute <cmd>, then return
154
        quit
155
partition> l
156
Ready to label disk, continue? no
157
partition> p
158
Current partition table (original):
159
Total disk sectors available: 351635437 + 16384 (reserved sectors)
160
161
Part      Tag    Flag     First Sector         Size         Last Sector
162
  0        usr    wm               256      167.67GB          351635470    
163
  1 unassigned    wm                 0           0               0    
164
  2 unassigned    wm                 0           0               0    
165
  3 unassigned    wm                 0           0               0    
166
  4 unassigned    wm                 0           0               0    
167
  5 unassigned    wm                 0           0               0    
168
  6 unassigned    wm                 0           0               0    
169
  8   reserved    wm         351635471        8.00MB          351651854    
170
171
partition> ?
172
Expecting one of the following: (abbreviations ok):
173
        0      - change `0' partition
174
        1      - change `1' partition
175
        2      - change `2' partition
176
        3      - change `3' partition
177
        4      - change `4' partition
178
        5      - change `5' partition
179
        6      - change `6' partition
180
        expand - expand label to use whole disk
181
        select - select a predefined table
182
        modify - modify a predefined partition table
183
        name   - name the current table
184
        print  - display the current table
185
        label  - write partition map and label to the disk
186
        !<cmd> - execute <cmd>, then return
187
        quit
188
189
partition> 0
190
Part      Tag    Flag     First Sector         Size         Last Sector
191
  0        usr    wm               256      167.67GB          351635470    
192
193
Enter partition id tag[usr]: 
194
Enter partition permission flags[wm]: 
195
Enter new starting Sector[256]: 
196
Enter partition size[351635215b, 351635470e, 171696mb, 167gb, 0tb]: 16g
197
partition> p
198
Current partition table (unnamed):
199
Total disk sectors available: 351635437 + 16384 (reserved sectors)
200
201
Part      Tag    Flag     First Sector         Size         Last Sector
202
  0        usr    wm               256       16.00GB          33554687    
203
  1 unassigned    wm                 0           0               0    
204
  2 unassigned    wm                 0           0               0    
205
  3 unassigned    wm                 0           0               0    
206
  4 unassigned    wm                 0           0               0    
207
  5 unassigned    wm                 0           0               0    
208
  6 unassigned    wm                 0           0               0    
209
  8   reserved    wm         351635471        8.00MB          351651854    
210
211
partition> 1
212
Part      Tag    Flag     First Sector         Size         Last Sector
213
  1 unassigned    wm                 0           0               0    
214
215
Enter partition id tag[usr]: 
216
Enter partition permission flags[wm]: 
217
Enter new starting Sector[33554688]: 
218
Enter partition size[0b, 33554687e, 0mb, 0gb, 0tb]: 64gb
219
partition> p
220
Current partition table (unnamed):
221
Total disk sectors available: 351635437 + 16384 (reserved sectors)
222
223
Part      Tag    Flag     First Sector         Size         Last Sector
224
  0        usr    wm               256       16.00GB          33554687    
225
  1        usr    wm          33554688       64.00GB          167772415    
226
  2 unassigned    wm                 0           0               0    
227
  3 unassigned    wm                 0           0               0    
228
  4 unassigned    wm                 0           0               0    
229
  5 unassigned    wm                 0           0               0    
230
  6 unassigned    wm                 0           0               0    
231
  8   reserved    wm         351635471        8.00MB          351651854    
232
233
partition> ?
234
Expecting one of the following: (abbreviations ok):
235
        0      - change `0' partition
236
        1      - change `1' partition
237
        2      - change `2' partition
238
        3      - change `3' partition
239
        4      - change `4' partition
240
        5      - change `5' partition
241
        6      - change `6' partition
242
        expand - expand label to use whole disk
243
        select - select a predefined table
244
        modify - modify a predefined partition table
245
        name   - name the current table
246
        print  - display the current table
247
        label  - write partition map and label to the disk
248
        !<cmd> - execute <cmd>, then return
249
        quit
250
251
partition> label
252
Ready to label disk, continue? yes
253
254
partition> p
255
Current partition table (unnamed):
256
Total disk sectors available: 351635437 + 16384 (reserved sectors)
257
258
Part      Tag    Flag     First Sector         Size         Last Sector
259
  0        usr    wm               256       16.00GB          33554687    
260
  1        usr    wm          33554688       64.00GB          167772415    
261
  2 unassigned    wm                 0           0               0    
262
  3 unassigned    wm                 0           0               0    
263
  4 unassigned    wm                 0           0               0    
264
  5 unassigned    wm                 0           0               0    
265
  6 unassigned    wm                 0           0               0    
266
  8   reserved    wm         351635471        8.00MB          351651854    
267
268
partition> quit
269
270
271
FORMAT MENU:
272
        disk       - select a disk
273
        type       - select (define) a disk type
274
        partition  - select (define) a partition table
275
        current    - describe the current disk
276
        format     - format and analyze the disk
277
        fdisk      - run the fdisk program
278
        repair     - repair a defective sector
279
        label      - write label to the disk
280
        analyze    - surface analysis
281
        defect     - defect list management
282
        backup     - search for backup labels
283
        verify     - read and display labels
284
        inquiry    - show vendor, product and revision
285
        volname    - set 8-character volume name
286
        !<cmd>     - execute <cmd>, then return
287
        quit
288
format> quit
289
root@openindiana:/home/yukikaze#
290
</pre>
291
292
まあ、若干余計なゴミが残っていますが。
293
294
h3. 疑問2. プール? ってのはどんな風にしてつくればいいのん?
295
296
こちらは簡単。以下の通り。
297
298
<pre>
299
root@openindiana:/home/yukikaze# zpool create tank raidz c4t0d0 c4t1d0 c4t2d0 log c4t4d0s0 cache c4t4d0s1
300
root@openindiana:/home/yukikaze# zpool status
301
  pool: rpool1
302
 state: ONLINE
303
  scan: none requested
304
config:
305
306
        NAME        STATE     READ WRITE CKSUM
307
        rpool1      ONLINE       0     0     0
308
          c3t0d0s0  ONLINE       0     0     0
309
310
errors: No known data errors
311
312
  pool: tank
313
 state: ONLINE
314
  scan: none requested
315
config:
316
317
        NAME        STATE     READ WRITE CKSUM
318
        tank        ONLINE       0     0     0
319
          raidz1-0  ONLINE       0     0     0
320
            c4t0d0  ONLINE       0     0     0
321
            c4t1d0  ONLINE       0     0     0
322
            c4t2d0  ONLINE       0     0     0
323
        logs
324
          c4t4d0s0  ONLINE       0     0     0
325
        cache
326
          c4t4d0s1  ONLINE       0     0     0
327
328
errors: No known data errors
329
root@openindiana:/home/yukikaze# df -h
330
Filesystem            Size  Used Avail Use% Mounted on
331
rpool1/ROOT/openindiana
332
                      4.0G  1.6G  2.4G  41% /
333
swap                   29G  352K   29G   1% /etc/svc/volatile
334
/usr/lib/libc/libc_hwcap1.so.1
335
                      4.0G  1.6G  2.4G  41% /lib/libc.so.1
336
swap                   29G  8.0K   29G   1% /tmp
337
swap                   29G   44K   29G   1% /var/run
338
rpool1/export         2.4G   32K  2.4G   1% /export
339
rpool1/export/home    2.4G   32K  2.4G   1% /export/home
340
rpool1/export/home/yukikaze
341
                      2.4G   36K  2.4G   1% /export/home/yukikaze
342
rpool1                2.4G   46K  2.4G   1% /rpool1
343
/export/home/yukikaze
344
                      2.4G   36K  2.4G   1% /home/yukikaze
345
tank                  5.4T  192K  5.4T   1% /tank
346
root@openindiana:/home/yukikaze# ls -al /tank
347
total 13
348
drwxr-xr-x  2 root root  2 2013-10-14 08:17 .
349
drwxr-xr-x 25 root root 27 2013-10-14 08:17 ..
350
root@openindiana:/home/yukikaze#
351
</pre>
352
353
logでZIL用の領域を指定、cacheでL2ARC用の領域を指定……で、いいらしいですよ?