~akopytov/percona-xtrabackup/bug1166888-2.1

« back to all changes in this revision

Viewing changes to src/libarchive/cpio/bsdcpio.1

  • Committer: Alexey Kopytov
  • Date: 2012-02-10 20:05:56 UTC
  • mto: (391.1.5 staging)
  • mto: This revision was merged to the branch mainline in revision 390.
  • Revision ID: akopytov@gmail.com-20120210200556-6kx41z8wwrqfucro
Rebase of the parallel compression patch on new trunk + post-review
fixes.

Implementation of parallel compression and streaming for XtraBackup.

This revision implements the following changes:

* InnoDB files are now streamed by the xtrabackup binary rather than
innobackupex. As a result, integrity is now verified by xtrabackup and
thus tar4ibd is no longer needed, so it was removed.

* xtrabackup binary now accepts the new '--stream' option which has
exactly the same semantics as the '--stream' option in
innobackupex: it tells xtrabackup to stream all files to the standard
output in the specified format rather than storing them locally.

* The xtrabackup binary can now do parallel compression using the
quicklz library. Two new options were added to xtrabackup to support
this feature:

- '--compress' tells xtrabackup to compress all output data, including
the transaction log file and meta data files, using the specified
compression algorithm. The only currently supported algorithm is
'quicklz'. The resulting files have the qpress archive format,
i.e. every *.qp file produced by xtrabackup is essentially a one-file
qpress archive and can be extracted and uncompressed by the qpress
file archiver (http://www.quicklz.com/).

- '--compress-threads' specifies the number of worker threads used by
xtrabackup for parallel data compression. This option defaults to 1.

Parallel compression ('--compress-threads') can be used together with
parallel file copying ('--parallel'). For example, '--parallel=4
--compress --compress-threads=2' will create 4 IO threads that will
read the data and pipe it to 2 compression threads.

* To support simultaneous compression and streaming, a new custom
streaming format called 'xbstream' was introduced to XtraBackup in
addition to the 'tar' format. That was required to overcome some
limitations of traditional archive formats such as 'tar', 'cpio' and
others that do not allow streaming dynamically generated files, for
example dynamically compressed files.  Other advantages of xbstream over
traditional streaming/archive formats include ability to stream multiple
files concurrently (so it is possible to use streaming in the xbstream
format together with the --parallel option) and more compact data
storage.

* To allow streaming and extracting files to/from the xbstream format
produced by xtrabackup, a new utility aptly called 'xbstream' was
added to the XtraBackup distribution. This utility has a tar-like
interface:

- with the '-x' option it extracts files from the stream read from its
standard input to the current directory unless specified otherwise
with the '-C' option.

- with the '-c' option it streams files specified on the command line
to its standard output.

The utility also tries to minimize its impact on the OS page cache by
using the appropriate posix_fadvise() calls when available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.\" Copyright (c) 2003-2007 Tim Kientzle
 
2
.\" All rights reserved.
 
3
.\"
 
4
.\" Redistribution and use in source and binary forms, with or without
 
5
.\" modification, are permitted provided that the following conditions
 
6
.\" are met:
 
7
.\" 1. Redistributions of source code must retain the above copyright
 
8
.\"    notice, this list of conditions and the following disclaimer.
 
9
.\" 2. Redistributions in binary form must reproduce the above copyright
 
10
.\"    notice, this list of conditions and the following disclaimer in the
 
11
.\"    documentation and/or other materials provided with the distribution.
 
12
.\"
 
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
23
.\" SUCH DAMAGE.
 
24
.\"
 
25
.\" $FreeBSD$
 
26
.\"
 
27
.Dd December 21, 2007
 
28
.Dt BSDCPIO 1
 
29
.Os
 
30
.Sh NAME
 
31
.Nm cpio
 
32
.Nd copy files to and from archives
 
33
.Sh SYNOPSIS
 
34
.Nm
 
35
.Brq Fl i
 
36
.Op Ar options
 
37
.Op Ar pattern ...
 
38
.Op Ar < archive
 
39
.Nm
 
40
.Brq Fl o
 
41
.Op Ar options
 
42
.Ar < name-list
 
43
.Op Ar > archive
 
44
.Nm
 
45
.Brq Fl p
 
46
.Op Ar options
 
47
.Ar dest-dir
 
48
.Ar < name-list
 
49
.Sh DESCRIPTION
 
50
.Nm
 
51
copies files between archives and directories.
 
52
This implementation can extract from tar, pax, cpio, zip, jar, ar,
 
53
and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
 
54
and shar archives.
 
55
.Pp
 
56
The first option to
 
57
.Nm
 
58
is a mode indicator from the following list:
 
59
.Bl -tag -compact -width indent
 
60
.It Fl i
 
61
Input.
 
62
Read an archive from standard input (unless overriden) and extract the
 
63
contents to disk or (if the
 
64
.Fl t
 
65
option is specified)
 
66
list the contents to standard output.
 
67
If one or more file patterns are specified, only files matching
 
68
one of the patterns will be extracted.
 
69
.It Fl o
 
70
Output.
 
71
Read a list of filenames from standard input and produce a new archive
 
72
on standard output (unless overriden) containing the specified items.
 
73
.It Fl p
 
74
Pass-through.
 
75
Read a list of filenames from standard input and copy the files to the
 
76
specified directory.
 
77
.El
 
78
.Pp
 
79
.Sh OPTIONS
 
80
Unless specifically stated otherwise, options are applicable in
 
81
all operating modes.
 
82
.Bl -tag -width indent
 
83
.It Fl 0
 
84
Read filenames separated by NUL characters instead of newlines.
 
85
This is necessary if any of the filenames being read might contain newlines.
 
86
.It Fl A
 
87
(o mode only)
 
88
Append to the specified archive.
 
89
(Not yet implemented.)
 
90
.It Fl a
 
91
(o and p modes)
 
92
Reset access times on files after they are read.
 
93
.It Fl B
 
94
(o mode only)
 
95
Block output to records of 5120 bytes.
 
96
.It Fl C Ar size
 
97
(o mode only)
 
98
Block output to records of
 
99
.Ar size
 
100
bytes.
 
101
.It Fl c
 
102
(o mode only)
 
103
Use the old POSIX portable character format.
 
104
Equivalent to
 
105
.Fl -format Ar odc .
 
106
.It Fl d
 
107
(i and p modes)
 
108
Create directories as necessary.
 
109
.It Fl E Ar file
 
110
(i mode only)
 
111
Read list of file name patterns from
 
112
.Ar file
 
113
to list and extract.
 
114
.It Fl F Ar file
 
115
Read archive from or write archive to
 
116
.Ar file .
 
117
.It Fl f Ar pattern
 
118
(i mode only)
 
119
Ignore files that match
 
120
.Ar pattern .
 
121
.It Fl -format Ar format
 
122
(o mode only)
 
123
Produce the output archive in the specified format.
 
124
Supported formats include:
 
125
.Pp
 
126
.Bl -tag -width "iso9660" -compact
 
127
.It Ar cpio
 
128
Synonym for
 
129
.Ar odc .
 
130
.It Ar newc
 
131
The SVR4 portable cpio format.
 
132
.It Ar odc
 
133
The old POSIX.1 portable octet-oriented cpio format.
 
134
.It Ar pax
 
135
The POSIX.1 pax format, an extension of the ustar format.
 
136
.It Ar ustar
 
137
The POSIX.1 tar format.
 
138
.El
 
139
.Pp
 
140
The default format is
 
141
.Ar odc .
 
142
See
 
143
.Xr libarchive_formats 5
 
144
for more complete information about the
 
145
formats currently supported by the underlying
 
146
.Xr libarchive 3
 
147
library.
 
148
.It Fl H Ar format
 
149
Synonym for
 
150
.Fl -format .
 
151
.It Fl h , Fl -help
 
152
Print usage information.
 
153
.It Fl I Ar file
 
154
Read archive from
 
155
.Ar file .
 
156
.It Fl i
 
157
Input mode.
 
158
See above for description.
 
159
.It Fl -insecure
 
160
(i and p mode only)
 
161
Disable security checks during extraction or copying.
 
162
This allows extraction via symbolic links and path names containing
 
163
.Sq ..
 
164
in the name.
 
165
.It Fl J
 
166
(o mode only)
 
167
Compress the file with xz-compatible compression before writing it.
 
168
In input mode, this option is ignored; xz compression is recognized
 
169
automatically on input.
 
170
.It Fl j
 
171
Synonym for
 
172
.Fl y .
 
173
.It Fl L
 
174
(o and p modes)
 
175
All symbolic links will be followed.
 
176
Normally, symbolic links are archived and copied as symbolic links.
 
177
With this option, the target of the link will be archived or copied instead.
 
178
.It Fl l
 
179
(p mode only)
 
180
Create links from the target directory to the original files,
 
181
instead of copying.
 
182
.It Fl lzma
 
183
(o mode only)
 
184
Compress the file with lzma-compatible compression before writing it.
 
185
In input mode, this option is ignored; lzma compression is recognized
 
186
automatically on input.
 
187
.It Fl m
 
188
(i and p modes)
 
189
Set file modification time on created files to match
 
190
those in the source.
 
191
.It Fl n
 
192
(i mode, only with
 
193
.Fl t )
 
194
Display numeric uid and gid.
 
195
By default,
 
196
.Nm
 
197
displays the user and group names when they are provided in the
 
198
archive, or looks up the user and group names in the system
 
199
password database.
 
200
.It Fl no-preserve-owner
 
201
(i mode only)
 
202
Do not attempt to restore file ownership.
 
203
This is the default when run by non-root users.
 
204
.It Fl O Ar file
 
205
Write archive to
 
206
.Ar file .
 
207
.It Fl o
 
208
Output mode.
 
209
See above for description.
 
210
.It Fl p
 
211
Pass-through mode.
 
212
See above for description.
 
213
.It Fl preserve-owner
 
214
(i mode only)
 
215
Restore file ownership.
 
216
This is the default when run by the root user.
 
217
.It Fl -quiet
 
218
Suppress unnecessary messages.
 
219
.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc
 
220
Set the owner and/or group on files in the output.
 
221
If group is specified with no user
 
222
(for example,
 
223
.Fl R Ar :wheel )
 
224
then the group will be set but not the user.
 
225
If the user is specified with a trailing colon and no group
 
226
(for example,
 
227
.Fl R Ar root: )
 
228
then the group will be set to the user's default group.
 
229
If the user is specified with no trailing colon, then
 
230
the user will be set but not the group.
 
231
In
 
232
.Fl i
 
233
and
 
234
.Fl p
 
235
modes, this option can only be used by the super-user.
 
236
(For compatibility, a period can be used in place of the colon.)
 
237
.It Fl r
 
238
(All modes.)
 
239
Rename files interactively.
 
240
For each file, a prompt is written to
 
241
.Pa /dev/tty
 
242
containing the name of the file and a line is read from
 
243
.Pa /dev/tty .
 
244
If the line read is blank, the file is skipped.
 
245
If the line contains a single period, the file is processed normally.
 
246
Otherwise, the line is taken to be the new name of the file.
 
247
.It Fl t
 
248
(i mode only)
 
249
List the contents of the archive to stdout;
 
250
do not restore the contents to disk.
 
251
.It Fl u
 
252
(i and p modes)
 
253
Unconditionally overwrite existing files.
 
254
Ordinarily, an older file will not overwrite a newer file on disk.
 
255
.It Fl v
 
256
Print the name of each file to stderr as it is processed.
 
257
With
 
258
.Fl t ,
 
259
provide a detailed listing of each file.
 
260
.It Fl -version
 
261
Print the program version information and exit.
 
262
.It Fl y
 
263
(o mode only)
 
264
Compress the archive with bzip2-compatible compression before writing it.
 
265
In input mode, this option is ignored;
 
266
bzip2 compression is recognized automatically on input.
 
267
.It Fl Z
 
268
(o mode only)
 
269
Compress the archive with compress-compatible compression before writing it.
 
270
In input mode, this option is ignored;
 
271
compression is recognized automatically on input.
 
272
.It Fl z
 
273
(o mode only)
 
274
Compress the archive with gzip-compatible compression before writing it.
 
275
In input mode, this option is ignored;
 
276
gzip compression is recognized automatically on input.
 
277
.El
 
278
.Sh ENVIRONMENT
 
279
The following environment variables affect the execution of
 
280
.Nm :
 
281
.Bl -tag -width ".Ev BLOCKSIZE"
 
282
.It Ev LANG
 
283
The locale to use.
 
284
See
 
285
.Xr environ 7
 
286
for more information.
 
287
.It Ev TZ
 
288
The timezone to use when displaying dates.
 
289
See
 
290
.Xr environ 7
 
291
for more information.
 
292
.El
 
293
.Sh EXIT STATUS
 
294
.Ex -std
 
295
.Sh EXAMPLES
 
296
The
 
297
.Nm
 
298
command is traditionally used to copy file heirarchies in conjunction
 
299
with the
 
300
.Xr find 1
 
301
command.
 
302
The first example here simply copies all files from
 
303
.Pa src
 
304
to
 
305
.Pa dest :
 
306
.Dl Nm find Pa src | Nm Fl pmud Pa dest
 
307
.Pp
 
308
By carefully selecting options to the
 
309
.Xr find 1
 
310
command and combining it with other standard utilities,
 
311
it is possible to exercise very fine control over which files are copied.
 
312
This next example copies files from
 
313
.Pa src
 
314
to
 
315
.Pa dest
 
316
that are more than 2 days old and whose names match a particular pattern:
 
317
.Dl Nm find Pa src Fl mtime Ar +2 | Nm grep foo[bar] | Nm Fl pdmu Pa dest
 
318
.Pp
 
319
This example copies files from
 
320
.Pa src
 
321
to
 
322
.Pa dest
 
323
that are more than 2 days old and which contain the word
 
324
.Do foobar Dc :
 
325
.Dl Nm find Pa src Fl mtime Ar +2 | Nm xargs Nm grep -l foobar | Nm Fl pdmu Pa dest
 
326
.Sh COMPATIBILITY
 
327
The mode options i, o, and p and the options
 
328
a, B, c, d, f, l, m, r, t, u, and v comply with SUSv2.
 
329
.Pp
 
330
The old POSIX.1 standard specified that only
 
331
.Fl i ,
 
332
.Fl o ,
 
333
and
 
334
.Fl p
 
335
were interpreted as command-line options.
 
336
Each took a single argument of a list of modifier
 
337
characters.
 
338
For example, the standard syntax allows
 
339
.Fl imu
 
340
but does not support
 
341
.Fl miu
 
342
or
 
343
.Fl i Fl m Fl u ,
 
344
since
 
345
.Ar m
 
346
and
 
347
.Ar u
 
348
are only modifiers to
 
349
.Fl i ,
 
350
they are not command-line options in their own right.
 
351
The syntax supported by this implementation is backwards-compatible
 
352
with the standard.
 
353
For best compatibility, scripts should limit themselves to the
 
354
standard syntax.
 
355
.Sh SEE ALSO
 
356
.Xr bzip2 1 ,
 
357
.Xr tar 1 ,
 
358
.Xr gzip 1 ,
 
359
.Xr mt 1 ,
 
360
.Xr pax 1 ,
 
361
.Xr libarchive 3 ,
 
362
.Xr cpio 5 ,
 
363
.Xr libarchive-formats 5 ,
 
364
.Xr tar 5
 
365
.Sh STANDARDS
 
366
There is no current POSIX standard for the cpio command; it appeared
 
367
in
 
368
.St -p1003.1-96
 
369
but was dropped from
 
370
.St -p1003.1-2001 .
 
371
.Pp
 
372
The cpio, ustar, and pax interchange file formats are defined by
 
373
.St -p1003.1-2001
 
374
for the pax command.
 
375
.Sh HISTORY
 
376
The original
 
377
.Nm cpio
 
378
and
 
379
.Nm find
 
380
utilities were written by Dick Haight
 
381
while working in AT&T's Unix Support Group.
 
382
They first appeared in 1977 in PWB/UNIX 1.0, the
 
383
.Dq Programmer's Work Bench
 
384
system developed for use within AT&T.
 
385
They were first released outside of AT&T as part of System III Unix in 1981.
 
386
As a result,
 
387
.Nm cpio
 
388
actually predates
 
389
.Nm tar ,
 
390
even though it was not well-known outside of AT&T until some time later.
 
391
.Pp
 
392
This is a complete re-implementation based on the
 
393
.Xr libarchive 3
 
394
library.
 
395
.Sh BUGS
 
396
The cpio archive format has several basic limitations:
 
397
It does not store user and group names, only numbers.
 
398
As a result, it cannot be reliably used to transfer
 
399
files between systems with dissimilar user and group numbering.
 
400
Older cpio formats limit the user and group numbers to
 
401
16 or 18 bits, which is insufficient for modern systems.
 
402
The cpio archive formats cannot support files over 4 gigabytes,
 
403
except for the
 
404
.Dq odc
 
405
variant, which can support files up to 8 gigabytes.