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       --blocksize=512
111       --blocksize=4096
112           This parameter sets the sector size of the output disk image.
113
114           The default is 512 bytes.
115
116           See also "guestfs_add_drive_opts" in guestfs(3).
117
118       --floppy
119           Create a virtual floppy disk.
120
121           Currently this preselects the size (1440K), partition type (MBR)
122           and filesystem type (VFAT).  In future it may also choose the
123           geometry.
124
125       --size=N
126       --size=+N
127       -s N
128       -s +N
129           Use the --size (or -s) option to choose the size of the output
130           image.
131
132           If this option is not given, then the output image will be just
133           large enough to contain all the files, with not much wasted space.
134
135           To choose a fixed size output disk, specify an absolute number
136           followed by b/K/M/G/T/P/E to mean bytes, Kilobytes, Megabytes,
137           Gigabytes, Terabytes, Petabytes or Exabytes.  This must be large
138           enough to contain all the input files, else you will get an error.
139
140           To leave extra space, specify "+" (plus sign) and a number followed
141           by b/K/M/G/T/P/E to mean bytes, Kilobytes, Megabytes, Gigabytes,
142           Terabytes, Petabytes or Exabytes.  For example: --size=+200M means
143           enough space for the input files, and (approximately) an extra 200
144           MB free space.
145
146           Note that virt-make-fs estimates free space, and therefore will not
147           produce filesystems containing precisely the free space requested.
148           (It is much more expensive and time-consuming to produce a
149           filesystem which has precisely the desired free space).
150
151       --format=FMT
152       -F FMT
153           Choose the output disk image format.
154
155           The default is "raw" (raw sparse disk image).
156
157       --type=FS
158       -t FS
159           Choose the output filesystem type.
160
161           The default is "ext2".
162
163           Any filesystem which is supported read-write by libguestfs can be
164           used here.
165
166       --label=LABEL
167           Set the filesystem label.
168
169       --partition
170       --partition=PARTTYPE
171           If specified, this flag adds an MBR partition table to the output
172           disk image.
173
174           You can change the partition table type, eg. --partition=gpt for
175           large disks.
176
177           For MBR, virt-make-fs sets the partition type byte automatically.
178
179       -v
180       --verbose
181           Enable debugging information.
182
183       -V
184       --version
185           Display version number and exit.
186
187       -x  Enable libguestfs trace.
188

SEE ALSO

190       guestfish(1), virt-format(1), virt-resize(1), virt-tar-in(1),
191       mkisofs(1), genisoimage(1), mksquashfs(1), mke2fs(8), resize2fs(8),
192       guestfs(3), http://libguestfs.org/.
193

AUTHOR

195       Richard W.M. Jones http://people.redhat.com/~rjones/
196
198       Copyright (C) 2010-2020 Red Hat Inc.
199

LICENSE

201       This program is free software; you can redistribute it and/or modify it
202       under the terms of the GNU General Public License as published by the
203       Free Software Foundation; either version 2 of the License, or (at your
204       option) any later version.
205
206       This program is distributed in the hope that it will be useful, but
207       WITHOUT ANY WARRANTY; without even the implied warranty of
208       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
209       General Public License for more details.
210
211       You should have received a copy of the GNU General Public License along
212       with this program; if not, write to the Free Software Foundation, Inc.,
213       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
214

BUGS

216       To get a list of bugs against libguestfs, use this link:
217       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
218
219       To report a new bug against libguestfs, use this link:
220       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
221
222       When reporting a bug, please supply:
223
224       •   The version of libguestfs.
225
226       •   Where you got libguestfs (eg. which Linux distro, compiled from
227           source, etc)
228
229       •   Describe the bug accurately and give a way to reproduce it.
230
231       •   Run libguestfs-test-tool(1) and paste the complete, unedited output
232           into the bug report.
233
234
235
236guestfs-tools-1.48.2              2022-05-26                   virt-make-fs(1)
Impressum