File: virt-make-fs.pl

package info (click to toggle)
libguestfs 1%3A1.18.1-1%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,156 kB
  • sloc: ansic: 282,408; ml: 22,707; sh: 16,121; perl: 5,946; java: 5,047; cs: 4,329; makefile: 3,191; haskell: 2,564; erlang: 1,510; python: 1,502; xml: 509; ruby: 217; pascal: 142; cpp: 11
file content (256 lines) | stat: -rw-r--r-- 9,113 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
=encoding utf8

=head1 НАЗВА

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

=head1 КОРОТКИЙ ОПИС

 virt-make-fs [--options] input.tar output.img

 virt-make-fs [--options] input.tar.gz output.img

 virt-make-fs [--options] directory output.img

=head1 ОПИС

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
L<mkisofs(1)>, L<genisoimage(1)> and L<mksquashfs(1)>.  Unlike those tools,
it can create common filesystem types like ext2/3 or NTFS, 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 VM).

To create blank disks, use L<virt-format(1)>.

Basic usage is:

 virt-make-fs input output.img

where C<input> is either a directory containing files that you want to add,
or a tar archive (either uncompressed tar or gzip-compressed tar); and
C<output.img> 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</OPTIONS> below).

=head2 ТИП ФАЙЛОВОЇ СИСТЕМИ

The default filesystem type is C<ext2>.  Just about any filesystem type that
libguestfs supports can be used (but I<not> read-only formats like
ISO9660).  Here are some of the more common choices:

=over 4

=item I<ext3>

Note that ext3 filesystems contain a journal, typically 1-32 MB in size.  If
you are not going to use the filesystem in a way that requires the journal,
then this is just wasted overhead.

=item I<ntfs> або I<vfat>

Useful if exporting data to a Windows guest.

I<Note for vfat>: The tar archive or local directory must only contain files
which are owned by root (ie. UID:GID = 0:0).  The reason is that the tar
program running within libguestfs is unable to change the ownership of
non-root files, since vfat itself does not support this.

=item I<minix>

Lower overhead than C<ext2>, but certain limitations on filename length and
total filesystem size.

=back

=head3 ПРИКЛАД

 virt-make-fs --type=minix input minixfs.img

=head2 TO PARTITION OR NOT TO PARTITION

Optionally virt-make-fs can add a partition table to the output disk.

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).

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 L<fsck(8)>
directly on a partitioned disk image.  (However libguestfs tools such as
L<guestfish(1)> and L<virt-resize(1)> can still be used).

=head3 ПРИКЛАД

Додавання розділу MBR:

 virt-make-fs --partition -- input образ.img

If the output disk image could be terabyte-sized or larger, it's better to
use an EFI/GPT-compatible partition table:

 virt-make-fs --partition=gpt --size=+4T --format=qcow2 input disk.img

=head2 EXTRA SPACE

Unlike formats such as tar and squashfs, a filesystem does not "just fit"
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 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 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 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-fs
to build another image from scratch.

=head3 ПРИКЛАД

 virt-make-fs --format=qcow2 --size=+200M input output.img

=head1 ПАРАМЕТРИ

=over 4

=item B<--help>

Показати коротку довідку.

=item B<--version>

Показати дані щодо версії і завершити роботу.

=item B<--debug>

Увімкнути виведення діагностичних даних.

=item B<--size=E<lt>NE<gt>>

=item B<--size=+E<lt>NE<gt>>

=item B<-s E<lt>NE<gt>>

=item B<-s +E<lt>NE<gt>>

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 large
enough to contain all the files, with not much wasted space.

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.

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: I<--size=+200M> means enough space for
the input files, and (approximately) an extra 200 MB free space.

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).

=item B<--format=E<lt>fmtE<gt>>

=item B<-F E<lt>fmtE<gt>>

Choose the output disk image format.

The default is C<raw> (raw sparse disk image).

For other choices, see the L<qemu-img(1)> manpage.  The only other choice
that would really make sense here is C<qcow2>.

=item B<--type=E<lt>fsE<gt>>

=item B<-t E<lt>fsE<gt>>

Choose the output filesystem type.

Типовим значенням є C<ext2>.

Any filesystem which is supported read-write by libguestfs can be used here.

=item B<--partition>

=item B<--partition=E<lt>parttypeE<gt>>

If specified, this flag adds an MBR partition table to the output disk
image.

You can change the partition table type, eg. I<--partition=gpt> for large
disks.

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 output.img

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 I<--> (a double
dash) between options and the input and output arguments:

 virt-make-fs --partition -- input.tar output.img

For MBR, virt-make-fs sets the partition type byte automatically.

=back

=head1 ЕКРАНУВАННЯ СИМВОЛІВ У ОБОЛОНЦІ

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 ТАКОЖ ПЕРЕГЛЯНЬТЕ

L<guestfish(1)>, L<virt-format(1)>, L<virt-resize(1)>, L<virt-tar-in(1)>,
L<mkisofs(1)>, L<genisoimage(1)>, L<mksquashfs(1)>, L<mke2fs(8)>,
L<resize2fs(8)>, L<guestfs(3)>, L<Sys::Guestfs(3)>,
L<http://libguestfs.org/>.

=head1 ВАДИ

When reporting bugs, please enable debugging and capture the I<complete>
output:

 export LIBGUESTFS_DEBUG=1
 virt-make-fs --debug [...] > /tmp/virt-make-fs.log 2>&1

Attach /tmp/virt-make-fs.log to a new bug report at
L<https://bugzilla.redhat.com/>

=head1 АВТОР

Richard W.M. Jones L<http://people.redhat.com/~rjones/>

=head1 АВТОРСЬКІ ПРАВА

© Red Hat Inc., 2010–2012

Ця програма є вільним програмним забезпеченням; ви можете поширювати та/або
змінювати її за умов дотримання GNU General Public License  утому вигляді,
що оприлюднений Free Software Foundation; версії 2 цієї Ліцензії, або (якщо
забажаєте) будь-якої випущеної пізніше.

Ця програма поширюється у сподіванні, що вона буде корисною, але БЕЗ
БУДЬ-ЯКИХ ГАРАНТІЙНИХ ЗОБОВ’ЯЗАНЬ; навіть без очевидної гарантії
ПРАЦЕЗДАТНОСТІ або ПРИДАТНОСТІ ДЛЯ ВИКОРИСТАННЯ З ПЕВНОЮ МЕТОЮ. Докладніше
про це можна дізнатися з GNU General Public License.

Ви маєте отримати копію GNU General Public License разом з цією програмою;
якщо це не так, повідомте про факт за адресою Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.