HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

tar command does nothing

 
SOLVED
Go to solution
Dag A.
Frequent Advisor

tar command does nothing

Hi.

I am trying to write 2 directories to tape using tar, using the command as described in the man page:

" Archive files from /usr/include and /etc:

tar cv -C /usr/include -C /etc"

(except that I am backing up two other directories)

What happens is that the tape LED flashes for a few seconds, then tar stops.
No error or status messages are displayed anytime.

Running
tar tv
displays nothing written to tape.

I have also tried tar
-cvf /dev/rmt/0m ........
with no luck.

What could cause this?

(The OS version is HP-UX 10.20)
4 REPLIES
Rita C Workman
Honored Contributor
Solution

Re: tar command does nothing

Have you tried?

tar -cvf /dev/rmt/0m /usr/include /etc

Rita
Dag A.
Frequent Advisor

Re: tar command does nothing

Thanks, that works!

Seems to me that the -C options is just there for confusion.
Patrick Wallek
Honored Contributor

Re: tar command does nothing

>>Seems to me that the -C options is just there for confusion.

No, you just didn't use it correctly.

You missed the '.' after the directory names in the man page example.

tar cv -C /usr/include . -C /etc .

The man page states:

-C directory
causes tar to perform a chdir() to directory (see chdir(2)). Subsequent file and -C directory arguments are relative to directory. This allows multiple directories not related by a close or common parent to be archived using short relative path names.

Basically the '.' after the path indicates to get all files in that path BUT to use relative path names.

So, the files archived from /usr/include would be stored in the tar archive as filea, fileb, filec, etc. rather than /usr/include/filea, /usr/include/fileb.

When paired with the '-C /etc .' you would get ALL files with relatives paths, so you would have filea, fileb, filec, passwd, hosts, group, nsswitch.conf instead of /usr/include/filea, /usr/include/fileb, /etc/hosts, /etc/passwd, /etc/group, etc.

The way Rita showed WILL cause all files to have the FULL path name in the tar archive (/usr/include/filea, /etc/hosts, etc.).

Re: tar command does nothing

>Patrick: cause all files to have the FULL path name in the tar archive

You can use pax(1) or gnu tar to remove the initial "/" in these files.