Print this page
OS-4 libiscsit: several leaks due to left "errlist"
OS-199 keep your tree clean
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/man/man1m/dd.1m.man.txt
+++ new/usr/src/man/man1m/dd.1m.man.txt
1 1 DD(1M) Maintenance Commands DD(1M)
2 2
3 3
4 4
5 5 NAME
6 6 dd - convert and copy a file
7 7
8 8 SYNOPSIS
9 9 /usr/bin/dd [operand=value]...
10 10
11 11
12 12 DESCRIPTION
13 13 The dd utility copies the specified input file to the specified output
14 14 with possible conversions. The standard input and output are used by
15 15 default. The input and output block sizes may be specified to take
16 16 advantage of raw physical I/O. Sizes are specified in bytes; a number
17 17 may end with k, b, or w to specify multiplication by 1024, 512, or 2,
18 18 respectively. Numbers may also be separated by x to indicate
19 19 multiplication.
20 20
21 21
22 22 The dd utility reads the input one block at a time, using the specified
23 23 input block size. dd then processes the block of data actually
24 24 returned, which could be smaller than the requested block size. dd
25 25 applies any conversions that have been specified and writes the
26 26 resulting data to the output in blocks of the specified output block
27 27 size.
28 28
29 29
30 30 cbs is used only if ascii, asciib, unblock, ebcdic, ebcdicb, ibm, ibmb,
31 31 or block conversion is specified. In the first two cases, cbs
32 32 characters are copied into the conversion buffer, any specified
33 33 character mapping is done, trailing blanks are trimmed, and a NEWLINE
34 34 is added before sending the line to output. In the last three cases,
35 35 characters up to NEWLINE are read into the conversion buffer and blanks
36 36 are added to make up an output record of size cbs. ASCII files are
37 37 presumed to contain NEWLINE characters. If cbs is unspecified or 0, the
38 38 ascii, asciib, ebcdic, ebcdicb, ibm, and ibmb options convert the
39 39 character set without changing the input file's block structure. The
40 40 unblock and block options become a simple file copy.
41 41
42 42
43 43 After completion, dd reports the number of whole and partial input and
44 44 output blocks.
45 45
46 46 OPERANDS
47 47 The following operands are supported:
48 48
49 49 if=file
50 50
51 51 Specifies the input path. Standard input is the default.
52 52
53 53
54 54 of=file
55 55
56 56 Specifies the output path. Standard output is the default. If the
57 57 seek=expr conversion is not also specified, the output file will be
58 58 truncated before the copy begins, unless conv=notrunc is specified.
59 59 If seek=expr is specified, but conv=notrunc is not, the effect of
60 60 the copy will be to preserve the blocks in the output file over
61 61 which dd seeks, but no other portion of the output file will be
62 62 preserved. (If the size of the seek plus the size of the input file
63 63 is less than the previous size of the output file, the output file
64 64 is shortened by the copy.)
65 65
66 66
67 67 ibs=n
68 68
69 69 Specifies the input block size in n bytes (default is 512).
70 70
71 71
72 72 obs=n
73 73
74 74 Specifies the output block size in n bytes (default is 512).
75 75
76 76
77 77 bs=n
78 78
79 79 Sets both input and output block sizes to n bytes, superseding ibs=
80 80 and obs=. If no conversion other than sync, noerror, and notrunc is
81 81 specified, each input block is copied to the output as a single
82 82 block without aggregating short blocks.
83 83
84 84
85 85 cbs=n
86 86
87 87 Specifies the conversion block size for block and unblock in bytes
88 88 by n (default is 0). If cbs= is omitted or given a value of 0,
89 89 using block or unblock produces unspecified results.
90 90
91 91 This option is used only if ASCII or EBCDIC conversion is
92 92 specified. For the ascii and asciib operands, the input is handled
93 93 as described for the unblock operand except that characters are
94 94 converted to ASCII before the trailing SPACE characters are
95 95 deleted. For the ebcdic, ebcdicb, ibm, and ibmb operands, the input
96 96 is handled as described for the block operand except that the
97 97 characters are converted to EBCDIC or IBM EBCDIC after the trailing
98 98 SPACE characters are added.
99 99
100 100
101 101 files=n
102 102
103 103 Copies and concatenates n input files before terminating (makes
104 104 sense only where input is a magnetic tape or similar device).
105 105
106 106
107 107 skip=n
108 108
109 109 Skips n input blocks (using the specified input block size) before
110 110 starting to copy. On seekable files, the implementation reads the
111 111 blocks or seeks past them. On non-seekable files, the blocks are
112 112 read and the data is discarded.
113 113
114 114
115 115 iseek=n
116 116
117 117 Seeks n blocks from beginning of input file before copying
118 118 (appropriate for disk files, where skip can be incredibly slow).
119 119
120 120
121 121 oseek=n
122 122
123 123 Seeks n blocks from beginning of output file before copying.
124 124
125 125
126 126 seek=n
127 127
128 128 Skips n blocks (using the specified output block size) from
129 129 beginning of output file before copying. On non-seekable files,
130 130 existing blocks are read and space from the current end-of-file to
131 131 the specified offset, if any, is filled with null bytes. On
132 132 seekable files, the implementation seeks to the specified offset or
133 133 reads the blocks as described for non-seekable files.
134 134
135 135
136 136 ostride=n
137 137
138 138 Writes every nth block (using the specified output block size) when
139 139 writing output. Skips n - 1 blocks after writing each record.
140 140
141 141
142 142 istride=n
143 143
144 144 Reads every nth block (using the specified input block size) when
145 145 reading input. Skips n - 1 blocks after reading each record.
146 146
147 147
148 148 stride=n
149 149
150 150 Reads every nth block (using the specified input block size) when
151 151 reading input. Skips n - 1 blocks after reading each record. Also
152 152 writes every nth block (using the specified output block size) when
153 153 writing output. Skips n - 1 blocks after writing each record.
154 154
155 155
156 156 count=n
157 157
158 158 Copies only n input blocks.
159 159
160 160
161 161 conv=value[,value...]
162 162
163 163 Where values are comma-separated symbols from the following list:
164 164
165 165 ascii
166 166 Converts EBCDIC to ASCII.
167 167
168 168
169 169 asciib
170 170 Converts EBCDIC to ASCII using BSD-compatible character
171 171 translations.
172 172
173 173
174 174 ebcdic
175 175 Converts ASCII to EBCDIC. If converting fixed-length
176 176 ASCII records without NEWLINEs, sets up a pipeline with
177 177 dd conv=unblock beforehand.
178 178
179 179
180 180 ebcdicb
181 181 Converts ASCII to EBCDIC using BSD-compatible character
182 182 translations. If converting fixed-length ASCII records
183 183 without NEWLINEs, sets up a pipeline with dd
184 184 conv=unblock beforehand.
185 185
186 186
187 187 ibm
188 188 Slightly different map of ASCII to EBCDIC. If converting
189 189 fixed-length ASCII records without NEWLINEs, sets up a
190 190 pipeline with dd conv=unblock beforehand.
191 191
192 192
193 193 ibmb
194 194 Slightly different map of ASCII to EBCDIC using
195 195 BSD-compatible character translations. If converting
196 196 fixed-length ASCII records without NEWLINEs, sets up a
197 197 pipeline with dd conv=unblock beforehand.
198 198
199 199 The ascii (or asciib), ebcdic (or ebcdicb), and ibm (or ibmb)
200 200 values are mutually exclusive.
201 201
202 202 block
203 203 Treats the input as a sequence of NEWLINE-terminated or
204 204 EOF-terminated variable-length records independent of
205 205 the input block boundaries. Each record is converted to
206 206 a record with a fixed length specified by the conversion
207 207 block size. Any NEWLINE character is removed from the
208 208 input line. SPACE characters are appended to lines that
209 209 are shorter than their conversion block size to fill the
210 210 block. Lines that are longer than the conversion block
211 211 size are truncated to the largest number of characters
212 212 that will fit into that size. The number of truncated
213 213 lines is reported.
214 214
215 215
216 216 unblock
217 217 Converts fixed-length records to variable length. Reads
218 218 a number of bytes equal to the conversion block size (or
219 219 the number of bytes remaining in the input, if less than
220 220 the conversion block size), delete all trailing SPACE
221 221 characters, and append a NEWLINE character.
222 222
223 223 The block and unblock values are mutually exclusive.
224 224
225 225 lcase
226 226 Maps upper-case characters specified by the LC_CTYPE
227 227 keyword tolower to the corresponding lower-case character.
228 228 Characters for which no mapping is specified are not
229 229 modified by this conversion.
230 230
231 231
232 232 ucase
233 233 Maps lower-case characters specified by the LC_CTYPE
234 234 keyword toupper to the corresponding upper-case character.
235 235 Characters for which no mapping is specified are not
236 236 modified by this conversion.
237 237
238 238 The lcase and ucase symbols are mutually exclusive.
239 239
240 240 swab
241 241 Swaps every pair of input bytes. If the current input
242 242 record is an odd number of bytes, the last byte in the
243 243 input record is ignored.
244 244
245 245
246 246 noerror
247 247 Does not stop processing on an input error. When an
248 248 input error occurs, a diagnostic message is written on
249 249 standard error, followed by the current input and output
250 250 block counts in the same format as used at completion.
251 251 If the sync conversion is specified, the missing input
252 252 is replaced with null bytes and processed normally.
253 253 Otherwise, the input block will be omitted from the
254 254 output.
255 255
256 256
257 257 notrunc
258 258 Does not truncate the output file. Preserves blocks in
259 259 the output file not explicitly written by this
260 260 invocation of dd. (See also the preceding of=file
|
↓ open down ↓ |
260 lines elided |
↑ open up ↑ |
261 261 operand.)
262 262
263 263
264 264 sync
265 265 Pads every input block to the size of the ibs= buffer,
266 266 appending null bytes. (If either block or unblock is
267 267 also specified, appends SPACE characters, rather than
268 268 null bytes.)
269 269
270 270
271 + oflag=value[,value...]
271 272
272 - oflag=value[,value...]
273 + Where values are comma-separated symbols from the following list
274 + which affect the behavior of writing the output file:
273 275
274 - Where values are comma-separated symbols from the following list which
275 - affect the behavior of writing the output file:
276 + dsync
277 + The output file is opened with the O_DSYNC flag set. All
278 + data writes will be synchronous. For more information on
279 + O_DSYNC see fcntl.h(3HEAD).
276 280
277 - dsync
278 - The output file is opened with the O_DSYNC flag set. All
279 - data writes will be synchronous. For more information on
280 - O_DSYNC see fcntl.h(3HEAD).
281 281
282 + sync
283 + The output file is opened with the O_SYNC flag set. All
284 + data and metadata writes will be synchronous. For more
285 + information on O_SYNC see fcntl.h(3HEAD).
282 286
283 - sync
284 - The output file is opened with the O_SYNC flag set. All data
285 - and metadata writes will be synchronous. For more
286 - information on O_SYNC see fcntl.h(3HEAD).
287 287
288 288
289 + If operands other than conv= and oflag= are specified more than
290 + once, the last specified operand=value is used.
289 291
290 - If operands other than conv= and oflag= are specified more than once,
291 - the last specified operand=value is used.
292 292
293 + For the bs=, cbs=, ibs=, and obs= operands, the application must
294 + supply an expression specifying a size in bytes. The expression,
295 + expr, can be:
293 296
294 - For the bs=, cbs=, ibs=, and obs= operands, the application must supply
295 - an expression specifying a size in bytes. The expression, expr, can be:
297 + 1. a positive decimal number
296 298
297 - 1. a positive decimal number
299 + 2. a positive decimal number followed by k, specifying
300 + multiplication by 1024
298 301
299 - 2. a positive decimal number followed by k, specifying
300 - multiplication by 1024
302 + 3. a positive decimal number followed by M, specifying
303 + multiplication by 1024*1024
301 304
302 - 3. a positive decimal number followed by M, specifying
303 - multiplication by 1024*1024
305 + 4. a positive decimal number followed by G, specifying
306 + multiplication by 1024*1024*1024
304 307
305 - 4. a positive decimal number followed by G, specifying
306 - multiplication by 1024*1024*1024
308 + 5. a positive decimal number followed by T, specifying
309 + multiplication by 1024*1024*1024*1024
307 310
308 - 5. a positive decimal number followed by T, specifying
309 - multiplication by 1024*1024*1024*1024
311 + 6. a positive decimal number followed by P, specifying
312 + multiplication by 1024*1024*1024*1024*1024
310 313
311 - 6. a positive decimal number followed by P, specifying
312 - multiplication by 1024*1024*1024*1024*1024
314 + 7. a positive decimal number followed by E, specifying
315 + multiplication by 1024*1024*1024*1024*1024*1024
313 316
314 - 7. a positive decimal number followed by E, specifying
315 - multiplication by 1024*1024*1024*1024*1024*1024
317 + 8. a positive decimal number followed by Z, specifying
318 + multiplication by 1024*1024*1024*1024*1024*1024*1024
316 319
317 - 8. a positive decimal number followed by Z, specifying
318 - multiplication by 1024*1024*1024*1024*1024*1024*1024
320 + 9. a positive decimal number followed by b, specifying
321 + multiplication by 512
319 322
320 - 9. a positive decimal number followed by b, specifying
321 - multiplication by 512
323 + 10. two or more positive decimal numbers (with or without k
324 + or b) separated by x, specifying the product of the
325 + indicated values.
322 326
323 - 10. two or more positive decimal numbers (with or without k or
324 - b) separated by x, specifying the product of the indicated
325 - values.
326 327
328 + All of the operands will be processed before any input is read.
327 329
328 - All of the operands will be processed before any input is read.
329 -
330 330 SIGNALS
331 331 When dd receives either SIGINFO or SIGUSR1, dd will emit the current
332 332 input and output block counts, total bytes written, total time elapsed,
333 333 and the number of bytes per second to standard error. This is the same
334 334 information format that dd emits when it successfully completes. Users
335 335 may send SIGINFO via their terminal. The default character is ^T, see
336 336 stty(1) for more information.
337 337
338 338
339 339 For SIGINT, dd writes status information to standard error before
340 340 exiting. dd takes the standard action for all other signals.
341 341
342 342
343 343 USAGE
344 344 See largefile(5) for the description of the behavior of dd when
345 345 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
346 346
347 347 EXAMPLES
348 348 Example 1 Copying from one tape drive to another
349 349
350 350
351 351 The following example copies from tape drive 0 to tape drive 1, using a
352 352 common historical device naming convention.
353 353
354 354
355 355 example% dd if=/dev/rmt/0h of=/dev/rmt/1h
356 356
357 357
358 358
359 359 Example 2 Stripping the first 10 bytes from standard input
360 360
361 361
362 362 The following example strips the first 10 bytes from standard input:
363 363
364 364
365 365 example% dd ibs=10 skip=1
366 366
367 367
368 368
369 369 Example 3 Reading a tape into an ASCII file
370 370
371 371
372 372 This example reads an EBCDIC tape blocked ten 80-byte EBCDIC card
373 373 images per block into the ASCII file x:
374 374
375 375
376 376 example% dd if=/dev/tape of=x ibs=800 cbs=80 conv=ascii,lcase
377 377
378 378
379 379
380 380 Example 4 Using conv=sync to write to tape
381 381
382 382
383 383 The following example uses conv=sync when writing to a tape:
384 384
385 385
386 386 example% tar cvf - . | compress | dd obs=1024k of=/dev/rmt/0 conv=sync
387 387
388 388
389 389
390 390 ENVIRONMENT VARIABLES
391 391 See environ(5) for descriptions of the following environment variables
392 392 that affect the execution of dd: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
393 393 and NLSPATH.
394 394
395 395 EXIT STATUS
396 396 The following exit values are returned:
397 397
398 398 0
399 399 The input file was copied successfully.
400 400
401 401
402 402 >0
403 403 An error occurred.
404 404
405 405
406 406
407 407 If an input error is detected and the noerror conversion has not been
408 408 specified, any partial output block will be written to the output file,
409 409 a diagnostic message will be written, and the copy operation will be
410 410 discontinued. If some other error is detected, a diagnostic message
411 411 will be written and the copy operation will be discontinued.
412 412
413 413 ATTRIBUTES
414 414 See attributes(5) for descriptions of the following attributes:
415 415
416 416
417 417
418 418
419 419 +--------------------+-----------------+
420 420 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
421 421 +--------------------+-----------------+
422 422 |Interface Stability | Standard |
423 423 +--------------------+-----------------+
424 424
425 425 SEE ALSO
426 426 cp(1), sed(1), tr(1), fcntl.h(3HEAD), attributes(5), environ(5),
427 427 largefile(5), standards(5)
428 428
429 429 DIAGNOSTICS
430 430 f+p records in(out)
431 431 numbers of full and partial blocks read(written)
432 432
433 433
434 434 NOTES
435 435 Do not use dd to copy files between file systems having different block
436 436 sizes.
437 437
438 438
439 439 Using a blocked device to copy a file will result in extra nulls being
440 440 added to the file to pad the final block to the block boundary.
441 441
442 442
443 443 When dd reads from a pipe, using the ibs=X and obs=Y operands, the
444 444 output will always be blocked in chunks of size Y. When bs=Z is used,
445 445 the output blocks will be whatever was available to be read from the
446 446 pipe at the time.
447 447
448 448
449 449 When using dd to copy files to a tape device, the file size must be a
450 450 multiple of the device sector size (for example, 512 Kbyte). To copy
451 451 files of arbitrary size to a tape device, use tar(1) or cpio(1).
452 452
453 453
454 454
455 455 December 12, 2014 DD(1M)
|
↓ open down ↓ |
116 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX