Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Administration: Devices and File Systems Oracle Solaris 11.1 Information Library |
1. Managing Removable Media (Tasks)
2. Writing CDs and DVDs (Tasks)
4. Dynamically Configuring Devices (Tasks)
5. Managing USB Devices (Tasks)
6. Using InfiniBand Devices (Overview/Tasks)
9. Administering Disks (Tasks)
11. Configuring Storage Devices With COMSTAR (Tasks)
12. Configuring and Managing the Oracle Solaris Internet Storage Name Service (iSNS)
13. The format Utility (Reference)
14. Managing File Systems (Overview)
15. Creating and Mounting File Systems (Tasks)
16. Configuring Additional Swap Space (Tasks)
17. Copying Files and File Systems (Tasks)
Commands for Copying File Systems
Copying Directories Between File Systems (cpio Command)
How to Copy Directories Between File Systems (cpio)
Copying Files and File Systems to Tape
Copying Files to Tape (tar Command)
How to Copy Files to a Tape (tar)
Copying Files to a Tape With the pax Command
How to Copy Files to a Tape (pax)
Copying Files to Tape With the cpio Command
How to Copy All Files in a Directory to a Tape (cpio)
How to List the Files on a Tape (cpio)
How to Retrieve All Files From a Tape (cpio)
How to Retrieve Specific Files From a Tape (cpio)
Copying Files to a Remote Tape Device
How to Copy Files to a Remote Tape Device (tar and dd)
How to Extract Files From a Remote Tape Device
Here is information that you should know before you copy files to tape with the tar command:
Copying files to a tape with the -c option to the tar command destroys any files already on the tape at or beyond the current tape position.
You can use file name substitution wildcards (? and *) as part of the file names that you specify when copying files. For example, to copy all documents with a .doc suffix, type *.doc as the file name argument.
You cannot use file name substitution wildcards when you extract files from a tar archive.
$ tar cvf /dev/rmt/n filenames
Indicates that you want to create an archive.
Displays the name of each file as it is archived.
Indicates that the archive should be written to the specified device or file.
Indicates the files and directories that you want to copy. Separate multiple files with spaces.
The file names that you specify are copied to the tape, overwriting any existing files on the tape.
$ tar tvf /dev/rmt/n
For more information on listing files on a tar tape, see How to List the Files on a Tape (tar).
Example 17-2 Copying Files to a Tape (tar)
The following example shows how to copy three files to the tape in tape drive 0.
$ cd /export/home/kryten $ ls reports reportA reportB reportC $ tar cvf /dev/rmt/0 reports a reports/ 0 tape blocks a reports/reportA 59 tape blocks a reports/reportB 61 tape blocks a reports/reportC 63 tape blocks $ tar tvf /dev/rmt/0
$ tar tvf /dev/rmt/n
Lists the table of contents for the files on the tape.
Used with the t option, and provides detailed information about the files on the tape.
Indicates the tape device.
Example 17-3 Listing the Files on a Tape (tar)
The following example shows a listing of files on the tape in drive 0.
$ tar tvf /dev/rmt/0 drwxr-xr-x 0/0 0 Jul 14 13:50 2010 reports/ -r--r--r-- 0/0 206663 Jul 14 13:50 2010 reports/reportC -r--r--r-- 0/0 206663 Jul 14 13:50 2010 reports/reportB -r--r--r-- 0/0 206663 Jul 14 13:50 2010 reports/reportA
$ tar xvf /dev/rmt/n [filenames]
Indicates that the files should be extracted from the specified archive file. All files on the tape in the specified drive are copied to the current directory.
Displays the name of each file as it is retrieved.
Indicates the tape device that contains the archive.
Specifies a file to retrieve. Separate multiple files with spaces.
For more information, see the tar(1) man page.
$ ls -l
Example 17-4 Retrieving Files on a Tape (tar)
The following example shows how to retrieve all the files from the tape in drive 0.
$ cd /var/tmp $ tar xvf /dev/rmt/0 x reports/, 0 bytes, 0 tape blocks x reports/reportA, 0 bytes, 0 tape blocks x reports/reportB, 0 bytes, 0 tape blocks x reports/reportC, 0 bytes, 0 tape blocks x reports/reportD, 0 bytes, 0 tape blocks $ ls -l
Troubleshooting
The names of the files extracted from the tape must exactly match the names of the files that are stored on the archive. If you have any doubts about the names or paths of the files, first list the files on the tape. For instructions on listing the files on the tape, see How to List the Files on a Tape (tar).