.\" Automatically generated by Podwrapper::Man 1.28.1 (Pod::Simple 3.28) .\" .\" 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" '' . ds C` . ds C' '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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "virt-make-fs 1" .TH virt-make-fs 1 "2014-10-18" "libguestfs-1.28.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 "NAME" virt\-make\-fs \- Make a filesystem from a tar archive or files .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& virt\-make\-fs [\-\-options] input.tar output.img \& \& virt\-make\-fs [\-\-options] input.tar.gz output.img \& \& virt\-make\-fs [\-\-options] directory output.img .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Virt-make-fs is a command line tool for creating a filesystem from a tar archive or some files in a directory. It is similar to tools like \&\fImkisofs\fR\|(1), \fIgenisoimage\fR\|(1) and \fImksquashfs\fR\|(1). Unlike those tools, it can create common filesystem types like ext2/3 or \s-1NTFS,\s0 which can be useful if you want to attach these filesystems to existing virtual machines (eg. to import large amounts of read-only data to a \s-1VM\s0). .PP To create blank disks, use \fIvirt\-format\fR\|(1). To create complex layouts, use \fIguestfish\fR\|(1). .PP Basic usage is: .PP .Vb 1 \& virt\-make\-fs input output.img .Ve .PP where \f(CW\*(C`input\*(C'\fR is either a directory containing files that you want to add, or a tar archive (either uncompressed tar or gzip-compressed tar); and \f(CW\*(C`output.img\*(C'\fR is a disk image. The input type is detected automatically. The output disk image defaults to a raw ext2 sparse image unless you specify extra flags (see \*(L"\s-1OPTIONS\*(R"\s0 below). .SS "\s-1FILESYSTEM TYPE\s0" .IX Subsection "FILESYSTEM TYPE" The default filesystem type is \f(CW\*(C`ext2\*(C'\fR. Just about any filesystem type that libguestfs supports can be used (but \fInot\fR read-only formats like \s-1ISO9660\s0). Here are some of the more common choices: .IP "\fIext3\fR" 4 .IX Item "ext3" Note that ext3 filesystems contain a journal, typically 1\-32 \s-1MB\s0 in size. If you are not going to use the filesystem in a way that requires the journal, then this is just wasted overhead. .IP "\fIntfs\fR or \fIvfat\fR" 4 .IX Item "ntfs or vfat" Useful if exporting data to a Windows guest. .IP "\fIminix\fR" 4 .IX Item "minix" Lower overhead than \f(CW\*(C`ext2\*(C'\fR, but certain limitations on filename length and total filesystem size. .PP \fI\s-1EXAMPLE\s0\fR .IX Subsection "EXAMPLE" .PP .Vb 1 \& virt\-make\-fs \-\-type=minix input minixfs.img .Ve .SS "\s-1TO PARTITION OR NOT TO PARTITION\s0" .IX Subsection "TO PARTITION OR NOT TO PARTITION" Optionally virt-make-fs can add a partition table to the output disk. .PP Adding a partition can make the disk image more compatible with certain virtualized operating systems which don't expect to see a filesystem directly located on a block device (Linux doesn't care and will happily handle both types). .PP On the other hand, if you have a partition table then the output image is no longer a straight filesystem. For example you cannot run \&\fIfsck\fR\|(8) directly on a partitioned disk image. (However libguestfs tools such as \fIguestfish\fR\|(1) and \fIvirt\-resize\fR\|(1) can still be used). .PP \fI\s-1EXAMPLE\s0\fR .IX Subsection "EXAMPLE" .PP Add an \s-1MBR\s0 partition: .PP .Vb 1 \& virt\-make\-fs \-\-partition \-\- input disk.img .Ve .PP If the output disk image could be terabyte-sized or larger, it's better to use an EFI/GPT\-compatible partition table: .PP .Vb 1 \& virt\-make\-fs \-\-partition=gpt \-\-size=+4T \-\-format=qcow2 input disk.img .Ve .SS "\s-1EXTRA SPACE\s0" .IX Subsection "EXTRA SPACE" Unlike formats such as tar and squashfs, a filesystem does not \*(L"just fit\*(R" the files that it contains, but might have extra space. 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 \fI\-\-size\fR flag to leave space in the filesystem if you want it. .PP 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 \*(L"raw\*(R" format). Using \fI\-\-format=qcow2\fR will use the native qemu/KVM qcow2 image format (check your hypervisor supports this before using it). This allows you to choose a large \fI\-\-size\fR but the extra space won't actually be allocated in the image until you try to store something in it. .PP Don't forget that you can also use local commands including \&\fIresize2fs\fR\|(8) and \fIvirt\-resize\fR\|(1) to resize existing filesystems, or rerun virt-make-fs to build another image from scratch. .PP \fI\s-1EXAMPLE\s0\fR .IX Subsection "EXAMPLE" .PP .Vb 1 \& virt\-make\-fs \-\-format=qcow2 \-\-size=+200M input output.img .Ve .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-\-help\fR" 4 .IX Item "--help" Display brief help. .IP "\fB\-\-floppy\fR" 4 .IX Item "--floppy" Create a virtual floppy disk. .Sp Currently this preselects the size (1440K), partition type (\s-1MBR\s0) and filesystem type (\s-1VFAT\s0). In future it may also choose the geometry. .IP "\fB\-\-size=\fR" 4 .IX Item "--size=" .PD 0 .IP "\fB\-\-size=+\fR" 4 .IX Item "--size=+" .IP "\fB\-s \fR" 4 .IX Item "-s " .IP "\fB\-s +\fR" 4 .IX Item "-s +" .PD Use the \fI\-\-size\fR (or \fI\-s\fR) option to choose the size of the output image. .Sp If this option is \fInot\fR given, then the output image will be just large enough to contain all the files, with not much wasted space. .Sp To choose a fixed size output disk, specify an absolute number followed by b/K/M/G/T/P/E to mean bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Petabytes or Exabytes. This must be large enough to contain all the input files, else you will get an error. .Sp To leave extra space, specify \f(CW\*(C`+\*(C'\fR (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: \fI\-\-size=+200M\fR means enough space for the input files, and (approximately) an extra 200 \s-1MB\s0 free space. .Sp Note that virt-make-fs estimates free space, and therefore will not produce filesystems containing precisely the free space requested. (It is much more expensive and time-consuming to produce a filesystem which has precisely the desired free space). .IP "\fB\-\-format=\fR" 4 .IX Item "--format=" .PD 0 .IP "\fB\-F \fR" 4 .IX Item "-F " .PD Choose the output disk image format. .Sp The default is \f(CW\*(C`raw\*(C'\fR (raw sparse disk image). .IP "\fB\-\-type=\fR" 4 .IX Item "--type=" .PD 0 .IP "\fB\-t \fR" 4 .IX Item "-t " .PD Choose the output filesystem type. .Sp The default is \f(CW\*(C`ext2\*(C'\fR. .Sp Any filesystem which is supported read-write by libguestfs can be used here. .IP "\fB\-\-label=<\s-1LABEL\s0>\fR" 4 .IX Item "--label=