The dd Command Tape−Related Commands

−p [option] directory Causes cpio to read a list of ordinary files from its standard input and copy them to the specified directory Additional Options Meaning a Resets access times of input files after they are copied c Writes the header information in ASCII characters for portability to other machines d Creates directories as needed; used when directories are specified to be copied f Copies only files not matched by pattern l Creates links to files in the new directories instead of copying them if possible m Does not change modification time of files when copying them r Allows files to be renamed as they are copied; cpio waits for a new name t List the names of the input files without copying them u Pushes cpio to overwrite files if they already exist ordinarily, cpio does not copy files if they already exist v Prints a list of the files being copied The cpio command is usually combined piped with other UNIX commands to perform a requested command sequence often within scripts. The manual use of the command from the command line is not very convenient, but still workable. The need to handle special device files makes this command unavoidable. Here are a few examples: To archive all files, starting in the current directory and continuing with subsequent subdirectories, onto the magnetic tape identified by the tape device file 0m: find . −print | cpio −o devrmt0m • To copy all files in the directory dir1 into dir2: ls dir1 | cpio −p dir2 • Although it works for any directory, the example is used primarily to copy special device files: ls devdir1 | cpio −p devdir2 The d option is required if the directory dir2 does not already exist.

12.2.3 The dd Command

The dd command converts and copies files with various data formats; it copies a specified input file to a specified output with possible conversions. The standard input and output are used by default. The input and output block size may be specified to take advantage of raw physical IO. The format of the dd command is: dd [ option=value ]… The options are: if=nameInput file is taken from name; standard input is default 277 Set both input and output block size, superseding ibs and obs cbs=n Conversi on buffer size skip=n Skip n input records before starting copy files=n Copy n input files before terminating makes sense only when the input is a magnetic tape or similar device seek=n Seek n records from beginning of output file before copying. This option generally only works with magnetic tapes and raw disk files and is otherwise usually useless if the explicit output file was named with the of option count=nCopy only n input records conv=…Specify a conversion EBCDIC, ASCII, etc. After completion, dd reports the number of whole and partial input and output blocks. A few examples are: To read an EBCDIC tape, with blocked ten 80−byte EBCDIC card images per record, into the ASCII file filename: dd if=devrmt0 of = filename ibs=800 cbs=80 conv=ascii, lcase • To write the file filename to a 3.5−inch floppy and read from the floppy into a file filename, respectively: dd if= filename of=devrfd0c bs=9k dd if=devrfd0c of= filename bs=9k • This command can be used to figure out the actual size of a raw disk partition or a logical volume, for example: dd if=devvg00lvol5 of=devnull bs=2k 51200+0 records in 51200+0 records out • In this example, the complete logical volume lvol5 was copied into null device nowhere; the reported number of input and output records for the defined block size of 2K determines the total raw volume size of 102.4 MB. Be careful in using this command, because a reverse selection of the input and output file would have a completely different meaning: it will erase the contents of the volume.

12.2.4 The mt Command