File: virt-resize.1

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 (748 lines) | stat: -rw-r--r-- 31,269 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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.el \{\
.    de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "virt-resize 1"
.TH virt-resize 1 "2012-06-01" "libguestfs-1.18.1" "Virtualization Support"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "НАЗВА"
.IX Header "НАЗВА"
virt-resize — програма для зміни розмірів дисків віртуальної машини
.SH "КОРОТКИЙ ОПИС"
.IX Header "КОРОТКИЙ ОПИС"
.Vb 3
\& virt\-resize [\-\-resize /dev/sdaN=[+/\-]<size>[%]]
\&   [\-\-expand /dev/sdaN] [\-\-shrink /dev/sdaN]
\&   [\-\-ignore /dev/sdaN] [\-\-delete /dev/sdaN] [...] indisk outdisk
.Ve
.SH "ОПИС"
.IX Header "ОПИС"
Virt-resize is a tool which can resize a virtual machine disk, making it
larger or smaller overall, and resizing or deleting any partitions contained
within.
.PP
Virt-resize \fBcannot\fR resize disk images in-place.  Virt-resize \fBshould
not\fR be used on live virtual machines \- for consistent results, shut the
virtual machine down before resizing it.
.PP
If you are not familiar with the associated tools: \fIvirt\-filesystems\fR\|(1)
and \fIvirt\-df\fR\|(1), we recommend you go and read those manual pages first.
.SH "ПРИКЛАДИ"
.IX Header "ПРИКЛАДИ"
.IP "1." 4
Copy \f(CW\*(C`olddisk\*(C'\fR to \f(CW\*(C`newdisk\*(C'\fR, extending one of the guest's partitions to
fill the extra 5GB of space.
.Sp
.Vb 1
\& virt\-filesystems \-\-long \-h \-\-all \-a olddisk
\& 
\& truncate \-r olddisk newdisk
\& truncate \-s +5G newdisk
\& 
\& # Note "/dev/sda2" is a partition inside the "olddisk" file.
\& virt\-resize \-\-expand /dev/sda2 olddisk newdisk
.Ve
.IP "2." 4
As above, but make the /boot partition 200MB bigger, while giving the
remaining space to /dev/sda2:
.Sp
.Vb 2
\& virt\-resize \-\-resize /dev/sda1=+200M \-\-expand /dev/sda2 \e
\&   olddisk newdisk
.Ve
.IP "3." 4
As in the first example, but expand a logical volume as the final step.
This is what you would typically use for Linux guests that use \s-1LVM:\s0
.Sp
.Vb 2
\& virt\-resize \-\-expand /dev/sda2 \-\-LV\-expand /dev/vg_guest/lv_root \e
\&   olddisk newdisk
.Ve
.IP "4." 4
As in the first example, but the output format will be qcow2 instead of a
raw disk:
.Sp
.Vb 2
\& qemu\-img create \-f qcow2 newdisk.qcow2 15G
\& virt\-resize \-\-expand /dev/sda2 olddisk newdisk.qcow2
.Ve
.SH "ДОКЛАДНІШЕ ЩОДО ВИКОРИСТАННЯ"
.IX Header "ДОКЛАДНІШЕ ЩОДО ВИКОРИСТАННЯ"
.SS "РОЗШИРЕННЯ ДИСКА ВІРТУАЛЬНОЇ МАШИНИ"
.IX Subsection "РОЗШИРЕННЯ ДИСКА ВІРТУАЛЬНОЇ МАШИНИ"
.IP "1. Shut down the virtual machine" 4
.IX Item "1. Shut down the virtual machine"
.PD 0
.IP "2. Locate input disk image" 4
.IX Item "2. Locate input disk image"
.PD
Locate the input disk image (ie. the file or device on the host containing
the guest's disk).  If the guest is managed by libvirt, you can use \f(CW\*(C`virsh
dumpxml\*(C'\fR like this to find the disk image name:
.Sp
.Vb 4
\& # virsh dumpxml guestname | xpath /domain/devices/disk/source
\& Found 1 nodes:
\& \-\- NODE \-\-
\& <source dev="/dev/vg/lv_guest" />
.Ve
.IP "3. Look at current sizing" 4
.IX Item "3. Look at current sizing"
Use \fIvirt\-filesystems\fR\|(1) to display the current partitions and sizes:
.Sp
.Vb 5
\& # virt\-filesystems \-\-long \-\-parts \-\-blkdevs \-h \-a /dev/vg/lv_guest
\& Name       Type       Size  Parent
\& /dev/sda1  partition  101M  /dev/sda
\& /dev/sda2  partition  7.9G  /dev/sda
\& /dev/sda   device     8.0G  \-
.Ve
.Sp
(This example is a virtual machine with an 8 \s-1GB\s0 disk which we would like to
expand up to 10 \s-1GB\s0).
.IP "4. Create output disk" 4
.IX Item "4. Create output disk"
Virt-resize cannot do in-place disk modifications.  You have to have space
to store the resized output disk.
.Sp
To store the resized disk image in a file, create a file of a suitable size:
.Sp
.Vb 2
\& # rm \-f outdisk
\& # truncate \-s 10G outdisk
.Ve
.Sp
Or use \fIlvcreate\fR\|(1) to create a logical volume:
.Sp
.Vb 1
\& # lvcreate \-L 10G \-n lv_name vg_name
.Ve
.Sp
Or use \fIvirsh\fR\|(1) vol-create-as to create a libvirt storage volume:
.Sp
.Vb 2
\& # virsh pool\-list
\& # virsh vol\-create\-as poolname newvol 10G
.Ve
.IP "5. Зміна розміру" 4
.IX Item "5. Зміна розміру"
virt-resize takes two mandatory parameters, the input disk (eg. device or
file) and the output disk.  The output disk is the one created in the
previous step.
.Sp
.Vb 1
\& # virt\-resize indisk outdisk
.Ve
.Sp
This command just copies disk image \f(CW\*(C`indisk\*(C'\fR to disk image \f(CW\*(C`outdisk\*(C'\fR
\&\fIwithout\fR resizing or changing any existing partitions.  If \f(CW\*(C`outdisk\*(C'\fR is
larger, then an extra, empty partition is created at the end of the disk
covering the extra space.  If \f(CW\*(C`outdisk\*(C'\fR is smaller, then it will give an
error.
.Sp
More realistically you'd want to expand existing partitions in the disk
image by passing extra options (for the full list see the \*(L"\s-1OPTIONS\s0\*(R"
section below).
.Sp
\&\*(L"\-\-expand\*(R" is the most useful option.  It expands the named partition
within the disk to fill any extra space:
.Sp
.Vb 1
\& # virt\-resize \-\-expand /dev/sda2 indisk outdisk
.Ve
.Sp
(In this case, an extra partition is \fInot\fR created at the end of the disk,
because there will be no unused space).
.Sp
\&\*(L"\-\-resize\*(R" is the other commonly used option.  The following would
increase the size of /dev/sda1 by 200M, and expand /dev/sda2 to fill the
rest of the available space:
.Sp
.Vb 2
\& # virt\-resize \-\-resize /dev/sda1=+200M \-\-expand /dev/sda2 \e
\&     indisk outdisk
.Ve
.Sp
If the expanded partition in the image contains a filesystem or \s-1LVM\s0 \s-1PV\s0, then
if virt-resize knows how, it will resize the contents, the equivalent of
calling a command such as \fIpvresize\fR\|(8), \fIresize2fs\fR\|(8), \fIntfsresize\fR\|(8)
or \fIbtrfs\fR\|(8).  However virt-resize does not know how to resize some
filesystems, so you would have to online resize them after booting the
guest.
.Sp
Other options are covered below.
.IP "6. Перевірка" 4
.IX Item "6. Перевірка"
Thoroughly test the new disk image \fIbefore\fR discarding the old one.
.Sp
If you are using libvirt, edit the \s-1XML\s0 to point at the new disk:
.Sp
.Vb 1
\& # virsh edit guestname
.Ve
.Sp
Change <source ...>, see
<http://libvirt.org/formatdomain.html#elementsDisks>
.Sp
Then start up the domain with the new, resized disk:
.Sp
.Vb 1
\& # virsh start guestname
.Ve
.Sp
and check that it still works.  See also the \*(L"\s-1NOTES\s0\*(R" section below for
additional information.
.IP "7. Resize LVs etc inside the guest" 4
.IX Item "7. Resize LVs etc inside the guest"
(This can also be done offline using \fIguestfish\fR\|(1))
.Sp
Once the guest has booted you should see the new space available, at least
for filesystems that virt-resize knows how to resize, and for PVs.  The user
may need to resize LVs inside PVs, and also resize filesystem types that
virt-resize does not know how to expand.
.SS "\s-1SHRINKING\s0 A \s-1VIRTUAL\s0 \s-1MACHINE\s0 \s-1DISK\s0"
.IX Subsection "SHRINKING A VIRTUAL MACHINE DISK"
Shrinking is somewhat more complex than expanding, and only an overview is
given here.
.PP
Firstly virt-resize will not attempt to shrink any partition content (PVs,
filesystems).  The user has to shrink content before passing the disk image
to virt-resize, and virt-resize will check that the content has been shrunk
properly.
.PP
(Shrinking can also be done offline using \fIguestfish\fR\|(1))
.PP
After shrinking PVs and filesystems, shut down the guest, and proceed with
steps 3 and 4 above to allocate a new disk image.
.PP
Then run virt-resize with any of the \fI\-\-shrink\fR and/or \fI\-\-resize\fR options.
.SS "ІГНОРУВАННЯ І ВИЛУЧЕННЯ РОЗДІЛІВ"
.IX Subsection "ІГНОРУВАННЯ І ВИЛУЧЕННЯ РОЗДІЛІВ"
virt-resize also gives a convenient way to ignore or delete partitions when
copying from the input disk to the output disk.  Ignoring a partition speeds
up the copy where you don't care about the existing contents of a
partition.  Deleting a partition removes it completely, but note that it
also renumbers any partitions after the one which is deleted, which can
leave some guests unbootable.
.SS "\s-1QCOW2\s0 \s-1AND\s0 NON-SPARSE \s-1RAW\s0 \s-1FORMATS\s0"
.IX Subsection "QCOW2 AND NON-SPARSE RAW FORMATS"
If the input disk is in qcow2 format, then you may prefer that the output is
in qcow2 format as well.  Alternately, virt-resize can convert the format on
the fly.  The output format is simply determined by the format of the empty
output container that you provide.  Thus to create qcow2 output, use:
.PP
.Vb 1
\& qemu\-img create [\-c] \-f qcow2 outdisk [size]
.Ve
.PP
instead of the truncate command (use \fI\-c\fR for a compressed disk).
.PP
Similarly, to get non-sparse raw output use:
.PP
.Vb 1
\& fallocate \-l size outdisk
.Ve
.PP
(on older systems that don't have the \fIfallocate\fR\|(1) command use \f(CW\*(C`dd
if=/dev/zero of=outdisk bs=1M count=..\*(C'\fR)
.SS "ЛОГІЧНІ РОЗДІЛИ"
.IX Subsection "ЛОГІЧНІ РОЗДІЛИ"
Logical partitions (a.k.a. \f(CW\*(C`/dev/sda5+\*(C'\fR on disks using \s-1DOS\s0 partition
tables) cannot be resized.
.PP
To understand what is going on, firstly one of the four partitions
\&\f(CW\*(C`/dev/sda1\-4\*(C'\fR will have \s-1MBR\s0 partition type \f(CW05\fR or \f(CW\*(C`0f\*(C'\fR.  This is called
the \fBextended partition\fR.  Use \fIvirt\-filesystems\fR\|(1) to see the \s-1MBR\s0
partition type.
.PP
Logical partitions live inside the extended partition.
.PP
The extended partition can be expanded, but not shrunk (unless you force it,
which is not advisable).  When the extended partition is copied across, all
the logical partitions contained inside are copied over implicitly.
Virt-resize does not look inside the extended partition, so it copies the
logical partitions blindly.
.PP
You cannot specify a logical partition (\f(CW\*(C`/dev/sda5+\*(C'\fR) at all on the command
line.  Doing so will give an error.
.SH "ПАРАМЕТРИ"
.IX Header "ПАРАМЕТРИ"
.IP "\fB\-\-help\fR" 4
.IX Item "--help"
Показати довідкове повідомлення.
.IP "\fB\-\-align\-first auto\fR" 4
.IX Item "--align-first auto"
.PD 0
.IP "\fB\-\-align\-first never\fR" 4
.IX Item "--align-first never"
.IP "\fB\-\-align\-first always\fR" 4
.IX Item "--align-first always"
.PD
Align the first partition for improved performance (see also the
\&\fI\-\-alignment\fR option).
.Sp
The default is \fI\-\-align\-first auto\fR which only aligns the first partition
if it is safe to do so.  That is, only when we know how to fix the
bootloader automatically, and at the moment that can only be done for
Windows guests.
.Sp
\&\fI\-\-align\-first never\fR means we never move the first partition.  This is the
safest option.  Try this if the guest does not boot after resizing.
.Sp
\&\fI\-\-align\-first always\fR means we always align the first partition (if it
needs to be aligned).  For some guests this will break the bootloader,
making the guest unbootable.
.IP "\fB\-\-alignment N\fR" 4
.IX Item "--alignment N"
Set the alignment of partitions to \f(CW\*(C`N\*(C'\fR sectors.  The default in virt-resize
< 1.13.19 was 64 sectors, and after that is 128 sectors.
.Sp
Assuming 512 byte sector size inside the guest, here are some suitable
values for this:
.RS 4
.IP "\fI\-\-alignment 1\fR (512 байтів)" 4
.IX Item "--alignment 1 (512 байтів)"
The partitions would be packed together as closely as possible, but would be
completely unaligned.  In some cases this can cause very poor performance.
See \fIvirt\-alignment\-scan\fR\|(1) for further details.
.IP "\fI\-\-alignment 8\fR (4K)" 4
.IX Item "--alignment 8 (4K)"
This would be the minimum acceptable alignment for reasonable performance on
modern hosts.
.IP "\fI\-\-alignment 128\fR (64K)" 4
.IX Item "--alignment 128 (64K)"
This alignment provides good performance when the host is using high end
network storage.
.IP "\fI\-\-alignment 2048\fR (1M)" 4
.IX Item "--alignment 2048 (1M)"
This is the standard alignment used by all newly installed guests since
around 2008.
.RE
.RS 4
.RE
.IP "\fB\-d\fR" 4
.IX Item "-d"
.PD 0
.IP "\fB\-\-debug\fR" 4
.IX Item "--debug"
.PD
Увімкнути показ діагностичних повідомлень.
.IP "\fB\-\-debug\-gc\fR" 4
.IX Item "--debug-gc"
Debug garbage collection and memory allocation.  This is only useful when
debugging memory problems in virt-resize or the OCaml libguestfs bindings.
.IP "\fB\-\-delete розділ\fR" 4
.IX Item "--delete розділ"
Delete the named partition.  It would be more accurate to describe this as
\&\*(L"don't copy it over\*(R", since virt-resize doesn't do in-place changes and the
original disk image is left intact.
.Sp
Note that when you delete a partition, then anything contained in the
partition is also deleted.  Furthermore, this causes any partitions that
come after to be \fIrenumbered\fR, which can easily make your guest unbootable.
.Sp
Цей параметр можна вказувати декілька разів.
.IP "\fB\-\-expand розділ\fR" 4
.IX Item "--expand розділ"
Expand the named partition so it uses up all extra space (space left over
after any other resize changes that you request have been done).
.Sp
If virt-resize knows how, it will expand the direct content of the
partition.  For example, if the partition is an \s-1LVM\s0 \s-1PV\s0, it will expand the
\&\s-1PV\s0 to fit (like calling \fIpvresize\fR\|(8)).  Virt-resize leaves any other
content it doesn't know about alone.
.Sp
У поточній версії virt-resize може змінювати розміри таких файлових систем:
.RS 4
.IP "\(bu" 4
Файлових систем ext2, ext3 і ext4.
.IP "\(bu" 4
Файлових систем \s-1NTFS\s0, якщо libguestfs було зібрано з підтримкою \s-1NTFS\s0.
.Sp
The filesystem must have been shut down consistently last time it was used.
Additionally, \fIntfsresize\fR\|(8) marks the resized filesystem as requiring a
consistency check, so at the first boot after resizing Windows will check
the disk.
.IP "\(bu" 4
\&\s-1LVM\s0 PVs (physical volumes).  virt-resize does not usually resize anything
inside the \s-1PV\s0, but see the \fI\-\-LV\-expand\fR option.  The user could also
resize LVs as desired after boot.
.IP "\(bu" 4
Btrfs filesystems, if libguestfs was compiled with support for btrfs.
.RE
.RS 4
.Sp
Note that you cannot use \fI\-\-expand\fR and \fI\-\-shrink\fR together.
.RE
.IP "\fB\-\-format\fR raw" 4
.IX Item "--format raw"
Specify the format of the input disk image.  If this flag is not given then
it is auto-detected from the image itself.
.Sp
If working with untrusted raw-format guest disk images, you should ensure
the format is always specified.
.Sp
Note that this option \fIdoes not\fR affect the output format.  See \*(L"\s-1QCOW2\s0
\&\s-1AND\s0 NON-SPARSE \s-1RAW\s0 \s-1FORMATS\s0\*(R".
.IP "\fB\-\-ignore розділ\fR" 4
.IX Item "--ignore розділ"
Ignore the named partition.  Effectively this means the partition is
allocated on the destination disk, but the content is not copied across from
the source disk.  The content of the partition will be blank (all zero
bytes).
.Sp
Цей параметр можна вказувати декілька разів.
.IP "\fB\-\-LV\-expand логічний_том\fR" 4
.IX Item "--LV-expand логічний_том"
This takes the logical volume and, as a final step, expands it to fill all
the space available in its volume group.  A typical usage, assuming a Linux
guest with a single \s-1PV\s0 \f(CW\*(C`/dev/sda2\*(C'\fR and a root device called
\&\f(CW\*(C`/dev/vg_guest/lv_root\*(C'\fR would be:
.Sp
.Vb 2
\& virt\-resize indisk outdisk \e
\&   \-\-expand /dev/sda2 \-\-LV\-expand /dev/vg_guest/lv_root
.Ve
.Sp
This would first expand the partition (and \s-1PV\s0), and then expand the root
device to fill the extra space in the \s-1PV\s0.
.Sp
The contents of the \s-1LV\s0 are also resized if virt-resize knows how to do
that.  You can stop virt-resize from trying to expand the content by using
the option \fI\-\-no\-expand\-content\fR.
.Sp
Use \fIvirt\-filesystems\fR\|(1) to list the filesystems in the guest.
.Sp
You can give this option multiple times, \fIbut\fR it doesn't make sense to do
this unless the logical volumes you specify are all in different volume
groups.
.IP "\fB\-\-machine\-readable\fR" 4
.IX Item "--machine-readable"
This option is used to make the output more machine friendly when being
parsed by other programs.  See \*(L"\s-1MACHINE\s0 \s-1READABLE\s0 \s-1OUTPUT\s0\*(R" below.
.IP "\fB\-n\fR" 4
.IX Item "-n"
.PD 0
.IP "\fB\-\-dryrun\fR" 4
.IX Item "--dryrun"
.PD
Print a summary of what would be done, but don't do anything.
.IP "\fB\-\-no\-copy\-boot\-loader\fR" 4
.IX Item "--no-copy-boot-loader"
By default, virt-resize copies over some sectors at the start of the disk
(up to the beginning of the first partition).  Commonly these sectors
contain the Master Boot Record (\s-1MBR\s0) and the boot loader, and are required
in order for the guest to boot correctly.
.Sp
If you specify this flag, then this initial copy is not done.  You may need
to reinstall the boot loader in this case.
.IP "\fB\-\-no\-extra\-partition\fR" 4
.IX Item "--no-extra-partition"
By default, virt-resize creates an extra partition if there is any extra,
unused space after all resizing has happened.  Use this option to prevent
the extra partition from being created.  If you do this then the extra space
will be inaccessible until you run fdisk, parted, or some other partitioning
tool in the guest.
.Sp
Note that if the surplus space is smaller than 10 \s-1MB\s0, no extra partition
will be created.
.IP "\fB\-\-no\-expand\-content\fR" 4
.IX Item "--no-expand-content"
By default, virt-resize will try to expand the direct contents of
partitions, if it knows how (see \fI\-\-expand\fR option above).
.Sp
If you give the \fI\-\-no\-expand\-content\fR option then virt-resize will not
attempt this.
.IP "\fB\-\-ntfsresize\-force\fR" 4
.IX Item "--ntfsresize-force"
Pass the \fI\-\-force\fR option to \fIntfsresize\fR\|(8), allowing resizing even if
the \s-1NTFS\s0 disk is marked as needing a consistency check.  You have to use
this option if you want to resize a Windows guest multiple times without
booting into Windows between each resize.
.IP "\fB\-\-output\-format\fR raw" 4
.IX Item "--output-format raw"
Specify the format of the output disk image.  If this flag is not given then
it is auto-detected from the image itself.
.Sp
If working with untrusted raw-format guest disk images, you should ensure
the format is always specified.
.Sp
Note that this option \fIdoes not create\fR the output format.  This option
just tells libguestfs what it is so it doesn't try to guess it.  You still
need to create the output disk with the right format.  See \*(L"\s-1QCOW2\s0 \s-1AND\s0
NON-SPARSE \s-1RAW\s0 \s-1FORMATS\s0\*(R".
.IP "\fB\-q\fR" 4
.IX Item "-q"
.PD 0
.IP "\fB\-\-quiet\fR" 4
.IX Item "--quiet"
.PD
Не виводити даних резюме.
.IP "\fB\-\-resize розділ=розмір\fR" 4
.IX Item "--resize розділ=розмір"
Resize the named partition (expanding or shrinking it) so that it has the
given size.
.Sp
\&\f(CW\*(C`size\*(C'\fR can be expressed as an absolute number followed by b/K/M/G to mean
bytes, Kilobytes, Megabytes, or Gigabytes; or as a percentage of the current
size; or as a relative number or percentage.  For example:
.Sp
.Vb 1
\& \-\-resize /dev/sda2=10G
\&
\& \-\-resize /dev/sda4=90%
\&
\& \-\-resize /dev/sda2=+1G
\&
\& \-\-resize /dev/sda2=\-200M
\&
\& \-\-resize /dev/sda1=+128K
\&
\& \-\-resize /dev/sda1=+10%
\&
\& \-\-resize /dev/sda1=\-10%
.Ve
.Sp
You can increase the size of any partition.  Virt-resize will expand the
direct content of the partition if it knows how (see \fI\-\-expand\fR below).
.Sp
You can only \fIdecrease\fR the size of partitions that contain filesystems or
PVs which have already been shrunk.  Virt-resize will check this has been
done before proceeding, or else will print an error (see also
\&\fI\-\-resize\-force\fR).
.Sp
Цей параметр можна вказувати декілька разів.
.IP "\fB\-\-resize\-force розділ=розмір\fR" 4
.IX Item "--resize-force розділ=розмір"
This is the same as \fI\-\-resize\fR except that it will let you decrease the
size of any partition.  Generally this means you will lose any data which
was at the end of the partition you shrink, but you may not care about that
(eg. if shrinking an unused partition, or if you can easily recreate it such
as a swap partition).
.Sp
Див. також опис параметра \fI\-\-ignore\fR.
.IP "\fB\-\-shrink розділ\fR" 4
.IX Item "--shrink розділ"
Shrink the named partition until the overall disk image fits in the
destination.  The named partition \fBmust\fR contain a filesystem or \s-1PV\s0 which
has already been shrunk using another tool (eg. \fIguestfish\fR\|(1) or other
online tools).  Virt-resize will check this and give an error if it has not
been done.
.Sp
The amount by which the overall disk must be shrunk (after carrying out all
other operations requested by the user) is called the \*(L"deficit\*(R".  For
example, a straight copy (assume no other operations)  from a 5GB disk image
to a 4GB disk image results in a 1GB deficit.  In this case, virt-resize
would give an error unless the user specified a partition to shrink and that
partition had more than a gigabyte of free space.
.Sp
Note that you cannot use \fI\-\-expand\fR and \fI\-\-shrink\fR together.
.IP "\fB\-V\fR" 4
.IX Item "-V"
.PD 0
.IP "\fB\-\-version\fR" 4
.IX Item "--version"
.PD
Показати дані щодо версії і завершити роботу.
.SH "MACHINE READABLE OUTPUT"
.IX Header "MACHINE READABLE OUTPUT"
The \fI\-\-machine\-readable\fR option can be used to make the output more machine
friendly, which is useful when calling virt-resize from other programs, GUIs
etc.
.PP
Існує два способи використання цього параметра.
.PP
Firstly use the option on its own to query the capabilities of the
virt-resize binary.  Typical output looks like this:
.PP
.Vb 6
\& $ virt\-resize \-\-machine\-readable
\& virt\-resize
\& ntfsresize\-force
\& 32bitok
\& ntfs
\& btrfs
.Ve
.PP
A list of features is printed, one per line, and the program exits with
status 0.
.PP
Secondly use the option in conjunction with other options to make the
regular program output more machine friendly.
.PP
У поточній версії це означає таке:
.IP "1." 4
Progress bar messages can be parsed from stdout by looking for this regular
expression:
.Sp
.Vb 1
\& ^[0\-9]+/[0\-9]+$
.Ve
.IP "2." 4
The calling program should treat messages sent to stdout (except for
progress bar messages) as status messages.  They can be logged and/or
displayed to the user.
.IP "3." 4
The calling program should treat messages sent to stderr as error messages.
In addition, virt-resize exits with a non-zero status code if there was a
fatal error.
.PP
Versions of the program prior to 1.13.9 did not support the
\&\fI\-\-machine\-readable\fR option and will return an error.
.SH "ПРИМІТКИ"
.IX Header "ПРИМІТКИ"
.SS "«Розділ 1 не закінчується на межі циліндра.»"
.IX Subsection "«Розділ 1 не закінчується на межі циліндра.»"
Virt-resize aligns partitions to multiples of 128 sectors (see the
\&\fI\-\-alignment\fR parameter).  Usually this means the partitions will not be
aligned to the ancient \s-1CHS\s0 geometry.  However \s-1CHS\s0 geometry is meaningless
for disks manufactured since the early 1990s, and doubly so for virtual hard
drives.  Alignment of partitions to cylinders is not required by any modern
operating system.
.SS "ЗМІНА РОЗМІРІВ ВІРТУАЛЬНИХ МАШИН \s-1WINDOWS\s0"
.IX Subsection "ЗМІНА РОЗМІРІВ ВІРТУАЛЬНИХ МАШИН WINDOWS"
In Windows Vista and later versions, Microsoft switched to using a separate
boot partition.  In these VMs, typically \f(CW\*(C`/dev/sda1\*(C'\fR is the boot partition
and \f(CW\*(C`/dev/sda2\*(C'\fR is the main (C:) drive.  Resizing the first (boot)
partition causes the bootloader to fail with \f(CW0xC0000225\fR error.  Resizing
the second partition (ie. C: drive)  should work.
.PP
Windows may initiate a lengthy \*(L"chkdsk\*(R" on first boot after a resize, if
\&\s-1NTFS\s0 partitions have been expanded.  This is just a safety check and (unless
it find errors) is nothing to worry about.
.SS "ЗАВАНТАЖЕННЯ ГОСТЬОВОЇ СИСТЕМИ ЗУПИНЯЄТЬСЯ НА «GRUB»"
.IX Subsection "ЗАВАНТАЖЕННЯ ГОСТЬОВОЇ СИСТЕМИ ЗУПИНЯЄТЬСЯ НА «GRUB»"
If a Linux guest does not boot after resizing, and the boot is stuck after
printing \f(CW\*(C`GRUB\*(C'\fR on the console, try reinstalling grub.
.PP
.Vb 6
\& guestfish \-i \-a newdisk
\& ><fs> cat /boot/grub/device.map
\& # check the contents of this file are sensible or
\& # edit the file if necessary
\& ><fs> grub\-install / /dev/vda
\& ><fs> exit
.Ve
.PP
For more flexible guest reconfiguration, including if you need to specify
other parameters to grub-install, use \fIvirt\-rescue\fR\|(1).
.SS "\s-1WINDOWS\s0 \s-1UNMOUNTABLE_BOOT_VOLUME\s0 \s-1BSOD\s0"
.IX Subsection "WINDOWS UNMOUNTABLE_BOOT_VOLUME BSOD"
After sysprepping a Windows guest and then resizing it with virt-resize, you
may see the guest fail to boot with an \f(CW\*(C`UNMOUNTABLE_BOOT_VOLUME\*(C'\fR \s-1BSOD\s0.
This error is caused by having \f(CW\*(C`ExtendOemPartition=1\*(C'\fR in the sysprep.inf
file.  Removing this line before sysprepping should fix the problem.
.SH "АЛЬТЕРНАТИВНІ ІНСТРУМЕНТИ"
.IX Header "АЛЬТЕРНАТИВНІ ІНСТРУМЕНТИ"
There are several proprietary tools for resizing partitions.  We won't
mention any here.
.PP
\&\fIparted\fR\|(8) and its graphical shell gparted can do some types of resizing
operations on disk images.  They can resize and move partitions, but I don't
think they can do anything with the contents, and they certainly don't
understand \s-1LVM\s0.
.PP
\&\fIguestfish\fR\|(1) can do everything that virt-resize can do and a lot more,
but at a much lower level.  You will probably end up hand-calculating sector
offsets, which is something that virt-resize was designed to avoid.  If you
want to see the guestfish-equivalent commands that virt-resize runs, use the
\&\fI\-\-debug\fR flag.
.SH "ЕКРАНУВАННЯ СИМВОЛІВ У ОБОЛОНЦІ"
.IX Header "ЕКРАНУВАННЯ СИМВОЛІВ У ОБОЛОНЦІ"
Libvirt guest names can contain arbitrary characters, some of which have
meaning to the shell such as \f(CW\*(C`#\*(C'\fR and space.  You may need to quote or
escape these characters on the command line.  See the shell manual page
\&\fIsh\fR\|(1) for details.
.SH "СТАН ВИХОДУ"
.IX Header "СТАН ВИХОДУ"
Ця програма повертає значення 0 у разі успішного завершення і ненульове
значення, якщо сталася помилка.
.SH "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
.IX Header "ТАКОЖ ПЕРЕГЛЯНЬТЕ"
\&\fIvirt\-filesystems\fR\|(1), \fIvirt\-df\fR\|(1), \fIguestfs\fR\|(3), \fIguestfish\fR\|(1),
\&\fIlvm\fR\|(8), \fIpvresize\fR\|(8), \fIlvresize\fR\|(8), \fIresize2fs\fR\|(8),
\&\fIntfsresize\fR\|(8), \fIbtrfs\fR\|(8), \fIvirsh\fR\|(1), \fIparted\fR\|(8), \fItruncate\fR\|(1),
\&\fIfallocate\fR\|(1), \fIgrub\fR\|(8), \fIgrub\-install\fR\|(8), \fIvirt\-rescue\fR\|(1),
\&\fIvirt\-sparsify\fR\|(1), \fIvirt\-alignment\-scan\fR\|(1), <http://libguestfs.org/>.
.SH "АВТОР"
.IX Header "АВТОР"
Richard W.M. Jones <http://people.redhat.com/~rjones/>
.SH "АВТОРСЬКІ ПРАВА"
.IX Header "АВТОРСЬКІ ПРАВА"
© Red Hat Inc., 2010–2012
.PP
Ця програма є вільним програмним забезпеченням; ви можете поширювати та/або
змінювати її за умов дотримання \s-1GNU\s0 General Public License  утому вигляді,
що оприлюднений Free Software Foundation; версії 2 цієї Ліцензії, або (якщо
забажаєте) будь\-якої випущеної пізніше.
.PP
Ця програма поширюється у сподіванні, що вона буде корисною, але БЕЗ
БУДЬ\-ЯКИХ ГАРАНТІЙНИХ ЗОБОВ’ЯЗАНЬ; навіть без очевидної гарантії
ПРАЦЕЗДАТНОСТІ або ПРИДАТНОСТІ ДЛЯ ВИКОРИСТАННЯ З ПЕВНОЮ МЕТОЮ. Докладніше
про це можна дізнатися з \s-1GNU\s0 General Public License.
.PP
Ви маєте отримати копію \s-1GNU\s0 General Public License разом з цією програмою;
якщо це не так, повідомте про факт за адресою Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA\s0 02110\-1301, \s-1USA\s0.