Depending on how you are going to use the output, you might think this
extra space is wasted and want to minimize it, or you might want to
leave space so that more files can be added later. Virt-make-fs
-defaults to minimizing the extra space, but you can use the C<--size>
+defaults to minimizing the extra space, but you can use the I<--size>
flag to leave space in the filesystem if you want it.
An alternative way to leave extra space but not make the output image
any bigger is to use an alternative disk image format (instead of the
-default "raw" format). Using C<--format=qcow2> will use the native
+default "raw" format). Using I<--format=qcow2> will use the native
QEmu/KVM qcow2 image format (check your hypervisor supports this
-before using it). This allows you to choose a large C<--size> but the
+before using it). This allows you to choose a large I<--size> but the
extra space won't actually be allocated in the image until you try to
store something in it.
Don't forget that you can also use local commands including
L<resize2fs(8)> and L<virt-resize(1)> to resize existing filesystems,
-or rerun virt-make-resize to build another image from scratch.
+or rerun virt-make-fs to build another image from scratch.
=head3 EXAMPLE
=item B<-s +E<lt>NE<gt>>
-Use the C<--size> (or C<-s>) option to choose the size of the output
+Use the I<--size> (or I<-s>) option to choose the size of the output
image.
If this option is I<not> given, then the output image will be just
To leave extra space, specify C<+> (plus sign) and a number followed
by b/K/M/G/T/P/E to mean bytes, Kilobytes, Megabytes, Gigabytes,
-Terabytes, Petabytes or Exabytes. For example: C<--size=+200M> means
+Terabytes, Petabytes or Exabytes. For example: I<--size=+200M> means
enough space for the input files, and (approximately) an extra 200 MB
free space.
If specified, this flag adds an MBR partition table to the output disk
image.
-You can change the partition table type, eg. C<--partition=gpt> for
+You can change the partition table type, eg. I<--partition=gpt> for
large disks.
-Note that if you just use a lonesome C<--partition>, the Perl option
+Note that if you just use a lonesome I<--partition>, the Perl option
parser might consider the next parameter to be the partition type.
For example:
virt-make-fs --partition input.tar ...
would cause virt-make-fs to think you wanted to use a partition type
-of C<input.tar> which is completely wrong. To avoid this, use C<-->
+of C<input.tar> which is completely wrong. To avoid this, use I<-->
(a double dash) between options and the input file argument:
virt-make-fs --partition -- input.tar ...
}
}
+$size = int ($size);
+
# Create the output disk.
# Take the unusual step of invoking qemu-img here.
my @cmd = ("qemu-img", "create", "-f", $format, $output, $size);
+if ($debug) {
+ print STDERR ("running: ", join (" ", @cmd), "\n");
+}
system (@cmd) == 0 or
die __"qemu-img create: failed to create disk image, see earlier error messages\n";
# Run libguestfs.
my $g = Sys::Guestfs->new ();
- $g->add_drive ($output);
+ $g->add_drive_opts ($output, format => $format);
$g->launch ();
if ($type eq "ntfs" && !feature_available ($g, "ntfs3g", "ntfsprogs")) {
return $pipe;
}
+=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 SEE ALSO
L<guestfish(1)>,
L<virt-resize(1)>,
-L<virt-tar(1)>,
+L<virt-tar-in(1)>,
L<mkisofs(1)>,
L<genisoimage(1)>,
L<mksquashfs(1)>,
=head1 AUTHOR
-Richard W.M. Jones L<http://et.redhat.com/~rjones/>
+Richard W.M. Jones L<http://people.redhat.com/~rjones/>
=head1 COPYRIGHT