From: Amindra Mahto <>
Date: Mon Apr 22 2002 - 11:49:48 EDT
Thanks a lot to the following people who responded so quickly. I used the GNU
tar to solve my problem because I didn't want to spend 4-5 hours to backup
again by using relative path.

Lars Hecking <>

You have to use the P (capital P) option when _creating_ the archive.
 You could have found out yourself by reading the man page for tar.

"Brian Sherwood" <>

use GNU tar to strip the leading "/" from the archive.

In the future, don't backup with a leading "/".

Another option is to symlink a directiry structure together and "trick" tar
into putting the file where you want it.


Jesus Garcia <>
Problem is that you probably included the absolute path of the files
when doing that tar, and that's something difficult to solve in solaris;
it will try to restore from /. You should never include absolute paths
when doing a tar archive (remove leading /).

To restore in current directory you can use the GNU tar, which
automatically removes trailing /.

Grab it at:

I hope this helps.


"Homan, Charles (NE)" <Charles.Homan@GDC4S.Com>
As they say in Maine, "You can't get there from here."  If you tar the files
using the absolute path (starting with "/") then they will untar using the
absolute path.  What you need to do is re-tar them using a relative path,
and then untar them.  For instance, you could change /tmp/listoffiles to be:


Then make sure you are in the root directory ("cd /") before you run your
tar command.


"Gurugunti, Mahesh" <>
I think if the files are backup using the absolute path, then no matter
which directory you are in they get extracted to original path mentioned
while backing up.
Meaning, if you think the files are backed up using /export/home/../../

then they get restored in /export/../../  , NOTE the absolute path (this
begins with  /export/ instead of  export/


Todd Urie <>
Since you created the files using absolute pathnames, the files will be
extracted using those same absolute pathnames.  This means that, using tar
alone, you will not be able to restore them to the /tmp directory.

However, if you use 'chroot' in conjunction with the restore, you may be
able to extract them to a temporary directory, then move them to where you
want.  You might want to view the man pages for 'tar' and 'chroot.'


Todd Urie

as you put absolute paths in the archive, you can't restore elsewhere with
the Solaris tar.
you may try with the Gnu tar (get it on

Gaziz Nugmanov <>
Hello Amindra,

When making a tar - get rid of "/" in the beginning of the files: ie
cd /
tar cvf /dev/rmt/0 export usr etc
then you can untar them this way:
cd /tmp
tar xvf /dev/rmt/0 export

Somesh Nagthan <>
You will be unable to restore into the /tmp directory using tar xvf since
you did not use relative pathnames for the directories.
however you should be able to use chroot to change the root directory and
then restore as and where you please.
Please read the man page for chroot for more details.
Hope this helps.

Here is my original question:

Hi All,

I tared three files in following way by using -I option

#tar cvf /dev/rmt/0 -I /tmp/listoffiles <return>
and the content of /tmp/listoffiles is as below
I have already checked the tar status by # tar tvf /dev/rmt/0 and could see
all the above mentioned files so I'll say tar was done ok.


I want to restore the files in /tmp directory. I give the following command:
#cd /tmp
#tar xvf /dev/rmt/0 .<return>
But nothing gets restored then I tried
#tar xvf /dev/rmt/0 /export/home/kumar/installer . <return> then files got
restored in /export/home/kumar but not in /tmp
How to restore in current directory???? Please let me know. I'll summarise.


sunmanagers mailing list
Received on Mon Apr 22 11:55:16 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:41 EST