1virt-make-fs(1)             Virtualization Support             virt-make-fs(1)
2
3
4

NAME

6       virt-make-fs - Make a filesystem from a tar archive or files
7

SYNOPSIS

9        virt-make-fs [--options] input.tar output.img
10
11        virt-make-fs [--options] input.tar.gz output.img
12
13        virt-make-fs [--options] directory output.img
14

DESCRIPTION

16       Virt-make-fs is a command line tool for creating a filesystem from a
17       tar archive or some files in a directory.  It is similar to tools like
18       mkisofs(1), genisoimage(1) and mksquashfs(1).  Unlike those tools, it
19       can create common filesystem types like ext2/3 or NTFS, which can be
20       useful if you want to attach these filesystems to existing virtual
21       machines (eg. to import large amounts of read-only data to a VM).
22
23       To create blank disks, use virt-format(1).  To create complex layouts,
24       use guestfish(1).
25
26       Basic usage is:
27
28        virt-make-fs input output.img
29
30       where "input" is either a directory containing files that you want to
31       add, or a tar archive (either uncompressed tar or gzip-compressed tar);
32       and "output.img" is a disk image.  The input type is detected
33       automatically.  The output disk image defaults to a raw ext2 sparse
34       image unless you specify extra flags (see "OPTIONS" below).
35
36   FILESYSTEM TYPE
37       The default filesystem type is "ext2".  Just about any filesystem type
38       that libguestfs supports can be used (but not read-only formats like
39       ISO9660).  Here are some of the more common choices:
40
41       ext3
42           Note that ext3 filesystems contain a journal, typically 1-32 MB in
43           size.  If you are not going to use the filesystem in a way that
44           requires the journal, then this is just wasted overhead.
45
46       ntfs or vfat
47           Useful if exporting data to a Windows guest.
48
49       minix
50           Lower overhead than "ext2", but certain limitations on filename
51           length and total filesystem size.
52
53       EXAMPLE
54
55        virt-make-fs --type=minix input minixfs.img
56
57   TO PARTITION OR NOT TO PARTITION
58       Optionally virt-make-fs can add a partition table to the output disk.
59
60       Adding a partition can make the disk image more compatible with certain
61       virtualized operating systems which don't expect to see a filesystem
62       directly located on a block device (Linux doesn't care and will happily
63       handle both types).
64
65       On the other hand, if you have a partition table then the output image
66       is no longer a straight filesystem.  For example you cannot run fsck(8)
67       directly on a partitioned disk image.  (However libguestfs tools such
68       as guestfish(1) and virt-resize(1) can still be used).
69
70       EXAMPLE
71
72       Add an MBR partition:
73
74        virt-make-fs --partition -- input disk.img
75
76       If the output disk image could be terabyte-sized or larger, it's better
77       to use an EFI/GPT-compatible partition table:
78
79        virt-make-fs --partition=gpt --size=+4T --format=qcow2 input disk.img
80
81   EXTRA SPACE
82       Unlike formats such as tar and squashfs, a filesystem does not "just
83       fit" the files that it contains, but might have extra space.  Depending
84       on how you are going to use the output, you might think this extra
85       space is wasted and want to minimize it, or you might want to leave
86       space so that more files can be added later.  Virt-make-fs defaults to
87       minimizing the extra space, but you can use the --size flag to leave
88       space in the filesystem if you want it.
89
90       An alternative way to leave extra space but not make the output image
91       any bigger is to use an alternative disk image format (instead of the
92       default "raw" format).  Using --format=qcow2 will use the native
93       qemu/KVM qcow2 image format (check your hypervisor supports this before
94       using it).  This allows you to choose a large --size but the extra
95       space won't actually be allocated in the image until you try to store
96       something in it.
97
98       Don't forget that you can also use local commands including
99       resize2fs(8) and virt-resize(1) to resize existing filesystems, or
100       rerun virt-make-fs to build another image from scratch.
101
102       EXAMPLE
103
104        virt-make-fs --format=qcow2 --size=+200M input output.img
105

OPTIONS

107       --help
108           Display brief help.
109
110       --version
111           Display version number and exit.
112
113       --debug
114           Enable debugging information.
115
116       --floppy
117           Create a virtual floppy disk.
118
119           Currently this preselects the size (1440K), partition type (MBR)
120           and filesystem type (VFAT).  In future it may also choose the
121           geometry.
122
123       --size=<N>
124       --size=+<N>
125       -s <N>
126       -s +<N>
127           Use the --size (or -s) option to choose the size of the output
128           image.
129
130           If this option is not given, then the output image will be just
131           large enough to contain all the files, with not much wasted space.
132
133           To choose a fixed size output disk, specify an absolute number
134           followed by b/K/M/G/T/P/E to mean bytes, Kilobytes, Megabytes,
135           Gigabytes, Terabytes, Petabytes or Exabytes.  This must be large
136           enough to contain all the input files, else you will get an error.
137
138           To leave extra space, specify "+" (plus sign) and a number followed
139           by b/K/M/G/T/P/E to mean bytes, Kilobytes, Megabytes, Gigabytes,
140           Terabytes, Petabytes or Exabytes.  For example: --size=+200M means
141           enough space for the input files, and (approximately) an extra 200
142           MB free space.
143
144           Note that virt-make-fs estimates free space, and therefore will not
145           produce filesystems containing precisely the free space requested.
146           (It is much more expensive and time-consuming to produce a
147           filesystem which has precisely the desired free space).
148
149       --format=<fmt>
150       -F <fmt>
151           Choose the output disk image format.
152
153           The default is "raw" (raw sparse disk image).
154
155           For other choices, see the qemu-img(1) manpage.  The only other
156           choice that would really make sense here is "qcow2".
157
158       --type=<fs>
159       -t <fs>
160           Choose the output filesystem type.
161
162           The default is "ext2".
163
164           Any filesystem which is supported read-write by libguestfs can be
165           used here.
166
167       --partition
168       --partition=<parttype>
169           If specified, this flag adds an MBR partition table to the output
170           disk image.
171
172           You can change the partition table type, eg. --partition=gpt for
173           large disks.
174
175           Note that if you just use a lonesome --partition, the Perl option
176           parser might consider the next parameter to be the partition type.
177           For example:
178
179            virt-make-fs --partition input.tar output.img
180
181           would cause virt-make-fs to think you wanted to use a partition
182           type of "input.tar" which is completely wrong.  To avoid this, use
183           -- (a double dash) between options and the input and output
184           arguments:
185
186            virt-make-fs --partition -- input.tar output.img
187
188           For MBR, virt-make-fs sets the partition type byte automatically.
189

SHELL QUOTING

191       Libvirt guest names can contain arbitrary characters, some of which
192       have meaning to the shell such as "#" and space.  You may need to quote
193       or escape these characters on the command line.  See the shell manual
194       page sh(1) for details.
195

SEE ALSO

197       guestfish(1), virt-format(1), virt-resize(1), virt-tar-in(1),
198       mkisofs(1), genisoimage(1), mksquashfs(1), mke2fs(8), resize2fs(8),
199       guestfs(3), Sys::Guestfs(3), http://libguestfs.org/.
200

AUTHOR

202       Richard W.M. Jones http://people.redhat.com/~rjones/
203
205       Copyright (C) 2010-2012 Red Hat Inc.
206
207       Contains code from perl String::ShellQuote under the following
208       copyright and license:
209
210       Copyright (c) 1997 Roderick Schertler.  All rights reserved.  This
211       program is free software; you can redistribute it and/or modify it
212       under the same terms as Perl itself.
213

LICENSE

215       This program is free software; you can redistribute it and/or modify it
216       under the terms of the GNU General Public License as published by the
217       Free Software Foundation; either version 2 of the License, or (at your
218       option) any later version.
219
220       This program is distributed in the hope that it will be useful, but
221       WITHOUT ANY WARRANTY; without even the implied warranty of
222       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
223       General Public License for more details.
224
225       You should have received a copy of the GNU General Public License along
226       with this program; if not, write to the Free Software Foundation, Inc.,
227       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
228

BUGS

230       To get a list of bugs against libguestfs, use this link:
231       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
232
233       To report a new bug against libguestfs, use this link:
234       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
235
236       When reporting a bug, please supply:
237
238       ·   The version of libguestfs.
239
240       ·   Where you got libguestfs (eg. which Linux distro, compiled from
241           source, etc)
242
243       ·   Describe the bug accurately and give a way to reproduce it.
244
245       ·   Run libguestfs-test-tool(1) and paste the complete, unedited output
246           into the bug report.
247
248
249
250libguestfs-1.20.11                2013-08-27                   virt-make-fs(1)
Impressum