File: virt-alignment-scan.pod

package info (click to toggle)
libguestfs 1%3A1.18.1-1%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,156 kB
  • sloc: ansic: 282,408; ml: 22,707; sh: 16,121; perl: 5,946; java: 5,047; cs: 4,329; makefile: 3,191; haskell: 2,564; erlang: 1,510; python: 1,502; xml: 509; ruby: 217; pascal: 142; cpp: 11
file content (377 lines) | stat: -rw-r--r-- 14,220 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
=encoding utf8

=head1 名前

virt-alignment-scan - 仮想マシンのパーティション配置の確認

=head1 書式

 virt-alignment-scan [--options] -d domname

 virt-alignment-scan [--options] -a disk.img [-a disk.img ...]

 virt-alignment-scan [--options]

=head1 説明

When older operating systems install themselves, the partitioning tools
place partitions at a sector misaligned with the underlying storage
(commonly the first partition starts on sector C<63>).  Misaligned
partitions can result in an operating system issuing more I/O than should be
necessary.

virt-alignment-scan ツールは、仮想マシンおよびディスクイメージにあるパーティションの配置を確認します。配置に問題があれば警告します。

現在、配置の問題を修正するための仮想化ツールはありません。ゲストオペレーティングシステムを再インストールすることだけができます。以下の NetApp
のドキュメントが、問題と取り得る解決策をまとめています:
L<http://media.netapp.com/documents/tr-3747.pdf>

=head1 出力

このツールをディスクイメージにおいて直接実行するには、I<-a> オプションを使用します:

 $ virt-alignment-scan -a winxp.img
 /dev/sda1        32256          512    bad (alignment < 4K)

 $ virt-alignment-scan -a fedora16.img
 /dev/sda1      1048576         1024K   ok
 /dev/sda2      2097152         2048K   ok
 /dev/sda3    526385152         2048K   ok

libvirt が把握している仮想マシンにおいてツールを実行するには、I<-d> オプションおよびおそらく I<-c> オプションを使用します:

 # virt-alignment-scan -d RHEL5
 /dev/sda1        32256          512    bad (alignment < 4K)
 /dev/sda2    106928640          512    bad (alignment < 4K)

 $ virt-alignment-scan -c qemu:///system -d Win7TwoDisks
 /dev/sda1      1048576         1024K   ok
 /dev/sda2    105906176         1024K   ok
 /dev/sdb1        65536           64K   ok

Run virt-alignment-scan without any I<-a> or I<-d> options to scan all
libvirt domains.

 # virt-alignment-scan
 F16x64:/dev/sda1      1048576         1024K   ok
 F16x64:/dev/sda2      2097152         2048K   ok
 F16x64:/dev/sda3    526385152         2048K   ok

The output consists of 4 or more whitespace-separated columns.  Only the
first 4 columns are significant if you want to parse this from a program.
The columns are:

=over 4

=item 1 列目

The device and partition name (eg. C</dev/sda1> meaning the first partition
on the first block device).

When listing all libvirt domains (no I<-a> or I<-d> option given) this
column is prefixed by the libvirt name or UUID (if I<--uuid> is given).  eg:
C<WinXP:/dev/sda1>

=item 2 列目

パーティションの開始位置(バイト単位)

=item 3 列目

バイトまたはキロバイト単位のアライメント(例: C<512>, C<4K>)

=item 4 列目

C<ok> if the alignment is best for performance, or C<bad> if the alignment
can cause performance problems

=item 5 列目以降

オプションの自由なテキスト説明。

=back

The exit code from the program changes depending on whether poorly aligned
partitions were found.  See L</EXIT STATUS> below.

If you just want the exit code with no output, use the I<-q> option.

=head1 オプション

=over 4

=item B<--help>

簡単なヘルプを表示します。

=item B<-a> file

=item B<--add> file

仮想マシンからディスクイメージの I<file> を追加します。

ディスクイメージの形式は自動検知されます。これを上書きして強制的に特定の形式を使用するには、I<--format=..> オプションを使用します。

=item B<-c> URI

=item B<--connect> URI

libvirt を使用していると、指定された I<URI> に接続します。  省略すると、デフォルトの libvirt ハイパーバイザーに接続します。

ゲストのブロックデバイスを直接指定していると((I<-a>))、libvirt は何も使用されません。

=item B<-d> guest

=item B<--domain> guest

名前付きの libvirt 仮想マシンからすべてのディスクを追加します。  ドメインの UUID が名前の代わりに使用されます。

=item B<--format=raw|qcow2|..>

=item B<--format>

I<-a> オプションのデフォルトはディスクイメージの形式を自動検知します。これを使用することにより、I<-a>
オプションのディスク形式をコマンドラインにおいて指定したものに強制できます。引数なしで I<--format> を使用することにより、後続の I<-a>
オプションに対して自動検知に戻せます。

例:

 virt-alignment-scan --format=raw -a disk.img

C<disk.img> に対してローイメージを強制します(自動検出しません)。

 virt-alignment-scan --format=raw -a disk.img --format -a another.img

C<disk.img> に対してロー形式(自動検知なし)を強制し、C<another.img> に対して自動検知に戻します。

仮想マシンのディスクイメージが信頼できないロー形式であるならば、ディスク形式を指定するためにこのオプションを使用すべきです。これにより、悪意のある仮想マシンにより起こり得るセキュリティ問題を回避できます
(CVE-2010-3851)。

=item B<-q>

=item B<--quiet>

何も出力しません。  終了コードを設定するのみです(以下の L</終了ステータス> 参照)。

=item B<--uuid>

Print UUIDs instead of names.  This is useful for following a guest even
when the guest is migrated or renamed, or when two guests happen to have the
same name.

This option only applies when listing all libvirt domains (when no I<-a> or
I<-d> options are specified).

=item B<-v>

=item B<--verbose>

デバッグ用の冗長なメッセージを有効にします。

=item B<-V>

=item B<--version>

バージョン番号を表示して終了します。

=item B<-x>

libguestfs API 呼び出しのトレースを有効にします。

=back

=head1 推奨されるアライメント

Windows 2008 および ca.2010 以前のLinux よりも古いオペレーティングシステムは、512 バイトのセクター容量でセクター 63
に、第 1 パーティションの第1セクターを配置しなければいけません。これは古くからの障害によるものです。ドライブは BIOS
にシリンダー/ヘッド/セクター (CHS) の配置を通知する必要があります。配置は最近のドライブにおいては意味がありませんが、必ずトラックあたり 63
セクターを持つことをときどき通知します。そのため、オペレーティングシステムはセクター 63 にある、第 2 "トラック" の先頭にある第 1
パーティションに置かれます。

ゲスト OS が仮想化されているとき、ホストオペレーティングシステムおよびハイパーバイザーは以下のどれかにアライメントされていることが好ましいでしょう。

=over 4

=item * 512 バイト

ホスト OS がハードディスクのパーティションに直接ローカルストレージを使用して、ハードディスクが 512 バイトの物理セクターを持っている場合。

=item * 4 K バイト

4K バイトの物理セクターを持つ新規ハードディスクにおけるローカルストレージ向け。 4K
バイトのブロック容量を持つファイルシステムにおけるファイル形式のストレージ向け。もしくは、何種類かのネットワークストレージ(NAS)向け。

=item * 64 K バイト

ハイエンドの NAS 向け。いくつかの NetApp ハードウェアに最適なブロックサイズです。

=item * 1 M バイト

以下の L</1 MB パーティションアライメント> 参照。

=back

基礎となるストレージに正しくアライメントされていないパーティションは余計な I/O を引き起こします。たとえば:

                       セクター#63
                       +--------------------------+------
                       |         ゲスト           |
                       | ファイルシステムブロック |
 ---+------------------+------+-------------------+-----+---
    |  ホストブロック         |  ホストブロック         |
    |                         |                         |
 ---+-------------------------+-------------------------+---

この例では、4K ブロックが読み込まれるたびに、ホストにある 2 つのブロックにアクセスする必要があります(そのため I/O が 2
倍になります)。仮想マシンの 4K ブロックが書き込まれるとき、まず 2 つのホストブロックを読み込む必要があり、古いデータと新しいデータが結合され、2
つのブロックが書き込まれます(4 倍の I/O)。

=head2 Linux ホストブロック

新しいバージョンの Linux カーネルは、物理ブロック容量、論理ブロック容量および最小かつ推奨の I/O サイズを明らかにします。

一般的な 512 バイトセクターのハードディスク向け:

 $ cat /sys/block/sda/queue/hw_sector_size
 512
 $ cat /sys/block/sda/queue/physical_block_size
 512
 $ cat /sys/block/sda/queue/logical_block_size
 512
 $ cat /sys/block/sda/queue/minimum_io_size
 512
 $ cat /sys/block/sda/queue/optimal_io_size
 0

新しい 4K バイトセクターのハードディスク向け:

 $ cat /sys/block/sda/queue/hw_sector_size
 4096
 $ cat /sys/block/sda/queue/physical_block_size
 4096
 $ cat /sys/block/sda/queue/logical_block_size
 4096
 $ cat /sys/block/sda/queue/minimum_io_size
 4096
 $ cat /sys/block/sda/queue/optimal_io_size
 0

NetApp LUN 向け:

 $ cat /sys/block/sdc/queue/logical_block_size
 512
 $ cat /sys/block/sdc/queue/physical_block_size
 512
 $ cat /sys/block/sdc/queue/minimum_io_size
 4096
 $ cat /sys/block/sdc/queue/optimal_io_size
 65536

NetApp は、最小の 4K I/O サイズより好ましい 512 バイトアクセスが可能です(しかし、非常に効率が悪いです)、しかし最適な I/O
サイズは 64K です。

これらの数字の意味に関する詳細は
L<http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newstorage-iolimits.html>
を参照してください。

[4K ドライブデータを提供してくれた Matt Booth に感謝します。NetApp のデータと追加情報を提供してくれた Mike Snitzer
に感謝します。]

=head2 1 MB パーティションアライメント

Microsoft は Windows Server 2008 以降、すべてのパーティションに対してデフォルトのアライメントとして 1 MB
を選択しました。 Linux はこれに従ってきました。

Assuming 512 byte sectors in the guest, you will now see the first partition
starting at sector 2048, and subsequent partitions (if any)  will start at a
multiple of 2048 sectors.

1 MB alignment is compatible with all current alignment requirements (4K,
64K) and provides room for future growth in physical block sizes.

=head2 アライメントの設定法

L<virt-resize(1)> can change the alignment of the partitions of some
guests.  Currently it can fully align all the partitions of all Windows
guests, and it will fix the bootloader where necessary.  For Linux guests,
it can align the second and subsequent partitions, so the majority of OS
accesses except at boot will be aligned.

Another way to correct partition alignment problems is to reinstall your
guest operating systems.  If you install operating systems from templates,
ensure these have correct partition alignment too.

古いバージョンの Windows は、次の NetApp ドキュメントに有用な情報があります:
L<http://media.netapp.com/documents/tr-3747.pdf>

For Red Hat Enterprise Linux E<le> 5, use a Kickstart script that contains
an explicit C<%pre> section that creates aligned partitions using
L<parted(8)>.  Do not use the Kickstart C<part> command.  The NetApp
document above contains an example.

=head1 SHELL QUOTING

Libvirt guest names can contain arbitrary characters, some of which have
meaning to the shell such as C<#> and space.  You may need to quote or
escape these characters on the command line.  See the shell manual page
L<sh(1)> for details.

=head1 終了ステータス

このプログラムは以下を返します:

=over 4

=item *

0

正常終了、すべてのパーティションが最高のパフォーマンスのために E<ge> 64K に配置されています

=item *

1

ディスクイメージまたは仮想マシンのスキャン中にエラーが発生しました

=item *

2

正常終了、いくつかのパーティションがハイエンドのネットワークストレージにおいてパフォーマンスの悪い E<lt> 64K のアライメントを持ちます

=item *

3

正常終了、いくつかのパーティションが多くのハイパーバイザーにおいてパフォーマンスの悪い E<lt> 4K のアライメントを持ちます

=back

=head1 関連項目

L<guestfs(3)>, L<guestfish(1)>, L<virt-filesystems(1)>, L<virt-rescue(1)>,
L<virt-resize(1)>, L<http://libguestfs.org/>.

=head1 著者

Richard W.M. Jones L<http://people.redhat.com/~rjones/>

=head1 COPYRIGHT

Copyright (C) 2011 Red Hat Inc.

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.