X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=tools%2Fvirt-resize;h=8a473ca3fcf39047e1d67b94f60ae134d8935042;hp=2a6c406a7c77422dc0f39c760309740fac051420;hb=2729421d176e1194537b499911a5eeb5e32a8b09;hpb=4d88a74532b20bcb60909c0d0983cdf7498aa08c diff --git a/tools/virt-resize b/tools/virt-resize index 2a6c406..8a473ca 100755 --- a/tools/virt-resize +++ b/tools/virt-resize @@ -516,6 +516,36 @@ my $quiet; Don't print the summary. +=cut + +my $format; + +=item B<--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. + +If working with untrusted raw-format guest disk images, you should +ensure the format is always specified. + +Note that this option I affect the output format. +See L. + +=cut + +my $output_format; + +=item B<--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. + +If working with untrusted raw-format guest disk images, you should +ensure the format is always specified. + +Note that you still need to create the output disk with the right +format. See L. + =back =cut @@ -535,6 +565,8 @@ GetOptions ("help|?" => \$help, "d|debug" => \$debug, "n|dryrun|dry-run" => \$dryrun, "q|quiet" => \$quiet, + "format=s" => \$format, + "output-format=s" => \$output_format, ) or pod2usage (2); pod2usage (1) if $help; if ($version) { @@ -562,8 +594,13 @@ sub launch_guestfs { $g = Sys::Guestfs->new (); $g->set_trace (1) if $debug; - $g->add_drive_ro ($infile); - $g->add_drive ($outfile); + my @args = ($infile); + push @args, readonly => 1; + push @args, format => $format if defined $format; + $g->add_drive_opts (@args); + @args = ($outfile); + push @args, format => $output_format if defined $output_format; + $g->add_drive_opts (@args); $g->set_progress_callback (\&progress_callback) unless $quiet; $g->launch (); } @@ -1204,7 +1241,9 @@ sub restart_appliance $g = Sys::Guestfs->new (); $g->set_trace (1) if $debug; - $g->add_drive ($outfile); + my @args = ($outfile); + push @args, format => $output_format if defined $output_format; + $g->add_drive_opts (@args); $g->launch (); # Target partitions have changed from /dev/sdb to /dev/sda, @@ -1404,6 +1443,23 @@ Windows may initiate a lengthy "chkdsk" on first boot after a resize, if NTFS partitions have been expanded. This is just a safety check and (unless it find errors) is nothing to worry about. +=head2 GUEST BOOT STUCK AT "GRUB" + +If a Linux guest does not boot after resizing, and the boot is stuck +after printing C on the console, try reinstalling grub. This +sometimes happens on older (RHEL 5-era) guests, for reasons we don't +fully understand, although we think is to do with partition alignment. + + guestfish -i -a newdisk + > cat /boot/grub/device.map + # check the contents of this file are sensible or + # edit the file if necessary + > grub-install / /dev/vda + > exit + +For more flexible guest reconfiguration, including if you need to +specify other parameters to grub-install, use L. + =head1 ALTERNATIVE TOOLS There are several proprietary tools for resizing partitions. We @@ -1443,6 +1499,9 @@ L, L, L, L, +L, +L, +L, L, L.