tools: Specify format of disks (RHBZ#642934,CVE-2010-3851).
[libguestfs.git] / tools / virt-resize
index 0f0679e..8a71f96 100755 (executable)
@@ -78,6 +78,11 @@ remaining space to /dev/sda2:
 
  virt-resize --resize /dev/sda1=+200M --expand /dev/sda2 olddisk newdisk
 
 
  virt-resize --resize /dev/sda1=+200M --expand /dev/sda2 olddisk newdisk
 
+As above, but the output format will be uncompressed qcow2:
+
+ qemu-img create -f qcow2 newdisk.qcow2 15G
+ virt-resize --expand /dev/sda2 olddisk newdisk.qcow2
+
 =head1 DETAILED USAGE
 
 =head2 EXPANDING A VIRTUAL MACHINE DISK
 =head1 DETAILED USAGE
 
 =head2 EXPANDING A VIRTUAL MACHINE DISK
@@ -230,6 +235,25 @@ 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.
 
 but note that it also renumbers any partitions after the one which is
 deleted, which can leave some guests unbootable.
 
+=head2 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:
+
+ qemu-img create [-c] -f qcow2 outdisk [size]
+
+instead of the truncate command (use C<-c> for a compressed disk).
+
+Similarly, to get non-sparse raw output use:
+
+ fallocate -l size outdisk
+
+(on older systems that don't have the L<fallocate(1)> command use
+C<dd if=/dev/zero of=outdisk bs=1M count=..>)
+
 =head1 OPTIONS
 
 =over 4
 =head1 OPTIONS
 
 =over 4
@@ -1380,6 +1404,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.
 
 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<GRUB> 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
+ ><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
+
+For more flexible guest reconfiguration, including if you need to
+specify other parameters to grub-install, use L<virt-rescue(1)>.
+
 =head1 ALTERNATIVE TOOLS
 
 There are several proprietary tools for resizing partitions.  We
 =head1 ALTERNATIVE TOOLS
 
 There are several proprietary tools for resizing partitions.  We
@@ -1418,6 +1459,10 @@ L<ntfsresize(8)>,
 L<virsh(1)>,
 L<parted(8)>,
 L<truncate(1)>,
 L<virsh(1)>,
 L<parted(8)>,
 L<truncate(1)>,
+L<fallocate(1)>,
+L<grub(8)>,
+L<grub-install(8)>,
+L<virt-rescue(1)>,
 L<Sys::Guestfs(3)>,
 L<http://libguestfs.org/>.
 
 L<Sys::Guestfs(3)>,
 L<http://libguestfs.org/>.