1826496 Members
2854 Online
109692 Solutions
New Discussion

Re: cpio.

 
SOLVED
Go to solution
Worapoj P.
Regular Advisor

cpio.

Dear all,

Please suggest me. How to use "cpio" backup files system and
restore all files/specify files system from tape.

Thanks advance for your answer.
Worapoj P.
For LOVE For Honor For Mankind
4 REPLIES 4
Alex Glennie
Honored Contributor
Solution

Re: cpio.

ITRC DOC ID KBAN00000271 has even more useful details, here's an extract though which maybe useful ?

Full backup to a local tape using cpio:

A full backup from your root disk must include the hidden and special device files. At
HPUX 10.x and 11.x find will automatically find hidden files so the -hidden option does
not apply on 10.x and 11.x.

Running the following commands will write a full backup onto the target tape(s):

# cd /
# /etc/shutdown -y 0 (single user mode is recommended)
# find . -depth -xdev | cpio -ovcxB > /dev/rmt/0m

Reading the contents of a cpio tape:

1.To determine what is written on the `cpio` tape:

# cpio -ictvB < /dev/rmt/0m
# cpio -itvB < /dev/rmt/0m

Note: The c option must be used in the input mode if it was used in the output
mode.

Reading the contents of a tape may take a few minutes (6 or 7 seconds per
megabyte) because the contents of the tape have to be read from the starting point
all the way through to the end of that cpio archive. The cpio does not have an
index or directory copy on tape, so the files that are listed are the files that are
actually on the tape.

2.To create a file containing the list of files stored on the cpio archive:

# cpio -ictvB < /dev/rmt/0m > /tmp/index

3.Relative versus absolute paths:

If the file name listing starts with a / then the cpio archive is written in an absolute
path format. This means that the files will be recovered to that absolute location, no
matter what directory the cpio restore command is given from.

Absolute path:

100666 user group Apr 2 18:21:30 1999 /tmp/xyz

Relative path:

100666 user group Apr 2 18:21:30 1999 tmp/xyz

Restoring a cpio archive from tape:

1.Set your current directory to the destination directory.

# cd /dir

Files will only be restored relative to this destination directory if the were backed
up with relative pathnames. If they were backed up with full pathnames, they will
be restored to the same location they were backed up.

2.Restore the required set of files:

Restore all files: (Files will be restored under the working directory if the
tape was written with relative paths.)

# cpio -icvdxumB < /dev/rmt/0m

Restore files by pattern:

# cpio -icvdxumB < /dev/rmt/0m `xyz/*`

Restore specific files:

# cpio -icvdxumB < /dev/rmt/0m dir1... dir2...
dir3...
Insu Kim
Honored Contributor

Re: cpio.

Let's do with file system, /home with device file /dev/rmt/0m.

To backup files, file system
# find /home -print| cpio -ocxBv > /dev/rmt/0m

To see a listing of files,
# cpio -icBvumd < /dev/rmt/0m

To restore a file, files from backup,
# cpio -icBudxv < /dev/rmt/0m
# cpio -icBxv /etc/passwd < /dev/rmt/0m
Never say "no" first.
Worapoj P.
Regular Advisor

Re: cpio.

Dear Alex,

Where I can get DOC ID KBAN00000271 ?

Best Regards,
Worapoj P.
For LOVE For Honor For Mankind
Alex Glennie
Honored Contributor

Re: cpio.