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 (403 lines) | stat: -rw-r--r-- 14,923 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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
=encoding utf8

=head1 НАЗВА

virt-alignment-scan — перевірити вирівнювання розділів віртуальної машини

=head1 КОРОТКИЙ ОПИС

 virt-alignment-scan [--параметри] -d назва_домену

 virt-alignment-scan [--параметри] -a диск.img [-a диск.img ...]

 virt-alignment-scan [--параметри]

=head1 ОПИС

Під час встановлення застарілих операційних систем засоби розподілу диска
можуть розташувати розділ на секторі з помилковим вирівнюванням відносно
системи зберігання даних (типово, перший розділ починається з сектора
C<63>). Розділи з помилковим вирівнюванням можуть призвести до неоптимальної
кількості запитів щодо виведення та введення даних від операційної системи.

Програма virt-alignment-scan виконує перевірку вирівнювання розділів у
віртуальних машинах та образів дисків і повідомляє вам, якщо буде виявлено
помилки вирівнювання.

У поточній версії не передбачено програми для виправлення помилок,
пов’язаних з вирівнюванням. Ви можете лише перевстановити гостьову
операційну систему. У цьому документі можна знайти короткі описи помилок та
можливі шляхи усування цих помилок:
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

Дані буде виведено у форматі 4 або більшої кількості стовпчиків,
відокремлених пробілами. Якщо ви маєте намір обробляти ці дані якоюсь
програмою, до уваги слід брати лише перші 4 стовпчики. Ось ці стовпчики:

=over 4

=item стовпчик 1

Назва пристрою і розділу (наприклад, C</dev/sda1> означає перший розділ на
першому блоковому пристрої).

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>, якщо вирівнювання є оптимальним з огляду на швидкодію, або C<bad>,
якщо вирівнювання може призвести до проблем зі швидкодією

=item стовпчик 5 і далі

додаткові пояснення у довільному форматі.

=back

Код виходу програми залежить від того, чи буде знайдено розділи з помилковим
вирівнюванням.  Див. розділ L</EXIT STATUS> нижче.

Якщо вам потрібен лише код виходу без виведення даних, скористайтеся
параметром I<-q>.

=head1 ПАРАМЕТРИ

=over 4

=item B<--help>

Показати коротку довідку.

=item B<-a> файл

=item B<--add> файл

Додати I<файл>, який має бути образом диска з віртуальної машини.

The format of the disk image is auto-detected.  To override this and force a
particular format use the I<--format=..> option.

=item B<-c> адреса

=item B<--connect> адреса

If using libvirt, connect to the given I<URI>.  If omitted, then we connect
to the default libvirt hypervisor.

If you specify guest block devices directly (I<-a>), then libvirt is not
used at all.

=item B<-d> гість

=item B<--domain> гість

Add all the disks from the named libvirt guest.  Domain UUIDs can be used
instead of names.

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

=item B<--format>

The default for the I<-a> option is to auto-detect the format of the disk
image.  Using this forces the disk format for I<-a> options which follow on
the command line.  Using I<--format> with no argument switches back to
auto-detection for subsequent I<-a> options.

Приклад:

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

forces raw format (no auto-detection) for C<disk.img>.

 virt-cat --format=raw -a disk.img --format -a another.img file

forces raw format (no auto-detection) for C<disk.img> and reverts to
auto-detection for C<another.img>.

If you have untrusted raw-format guest disk images, you should use this
option to specify the disk format.  This avoids a possible security problem
with malicious guests (CVE-2010-3851).

=item B<-q>

=item B<--quiet>

Don't produce any output.  Just set the exit code (see L</EXIT STATUS>
below).

=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.

=back

=head1 РЕКОМЕНДОВАНЕ ВИРІВНЮВАННЯ

Operating systems older than Windows 2008 and Linux before ca.2010 place the
first sector of the first partition at sector 63, with a 512 byte sector
size.  This happens because of a historical accident.  Drives have to report
a cylinder / head / sector (CHS) geometry to the BIOS.  The geometry is
completely meaningless on modern drives, but it happens that the geometry
reported always has 63 sectors per track.  The operating system therefore
places the first partition at the start of the second "track", at sector 63.

When the guest OS is virtualized, the host operating system and hypervisor
may prefer accesses aligned to one of:

=over 4

=item * 512 байти

if the host OS uses local storage directly on hard drive partitions, and the
hard drive has 512 byte physical sectors.

=item * 4 кілобайтів

for local storage on new hard drives with 4Kbyte physical sectors; for
file-backed storage on filesystems with 4Kbyte block size; or for some types
of network-attached storage.

=item * 64 кілобайтів

for high-end network-attached storage.  This is the optimal block size for
some NetApp hardware.

=item * 1 мегабайт

see L</1 MB PARTITION ALIGNMENT> below.

=back

Partitions which are not aligned correctly to the underlying storage cause
extra I/O.  For example:

                       sect#63
                       +--------------------------+------
                       |         guest            |
                       |    filesystem block      |
 ---+------------------+------+-------------------+-----+---
    |  host block             |  host block             |
    |                         |                         |
 ---+-------------------------+-------------------------+---

In this example, each time a 4K guest block is read, two blocks on the host
must be accessed (so twice as much I/O is done).  When a 4K guest block is
written, two host blocks must first be read, the old and new data combined,
and the two blocks written back (4x I/O).

=head2 LINUX HOST BLOCK AND I/O SIZE

New versions of the Linux kernel expose the physical and logical block size,
and minimum and recommended I/O size.

For a typical consumer hard drive with 512 byte sectors:

 $ 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

Для нових звичайних жорстких дисків з секторами у 4 кБ:

 $ 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

The NetApp allows 512 byte accesses (but they will be very inefficient),
prefers a minimum 4K I/O size, but the optimal I/O size is 64K.

Щоб дізнатися більше про призначення цих чисел, ознайомтеся зі сторінкою
L<http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newstorage-iolimits.html>

[Thanks to Matt Booth for providing 4K drive data.  Thanks to Mike Snitzer
for providing NetApp data and additional information.]

=head2 ВИРІВНЮВАННЯ РОЗДІЛІВ НА ПОЗНАЧКИ 1 МБ

Microsoft picked 1 MB as the default alignment for all partitions starting
with Windows 2008 Server, and Linux has followed this.

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.

For older versions of Windows, the following NetApp document contains useful
information: 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 ЕКРАНУВАННЯ СИМВОЛІВ У ОБОЛОНЦІ

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> 64 кБ для отримання
найкращої швидкодії

=item *

1

під час сканування образу диска або гостьової системи сталася помилка

=item *

2

successful exit, some partitions have alignment E<lt> 64K which can result
in poor performance on high end network storage

=item *

3

successful exit, some partitions have alignment E<lt> 4K which can result in
poor performance on most hypervisors

=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 АВТОРСЬКІ ПРАВА

© Red Hat Inc., 2011

Ця програма є вільним програмним забезпеченням; ви можете поширювати та/або
змінювати її за умов дотримання GNU General Public License  утому вигляді,
що оприлюднений Free Software Foundation; версії 2 цієї Ліцензії, або (якщо
забажаєте) будь-якої випущеної пізніше.

Ця програма поширюється у сподіванні, що вона буде корисною, але БЕЗ
БУДЬ-ЯКИХ ГАРАНТІЙНИХ ЗОБОВ’ЯЗАНЬ; навіть без очевидної гарантії
ПРАЦЕЗДАТНОСТІ або ПРИДАТНОСТІ ДЛЯ ВИКОРИСТАННЯ З ПЕВНОЮ МЕТОЮ. Докладніше
про це можна дізнатися з GNU General Public License.

Ви маєте отримати копію GNU General Public License разом з цією програмою;
якщо це не так, повідомте про факт за адресою Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.