[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tar cvfz test.tar.gz / gives error while untaring



Incoming from Oliver Fuchs:
> 
> I want to tar my whole / directory.
> 
> I do 
> 	tar cvfz  test.tar.gz /
> and afterwards trying to untar the directory I receive the error-message:
> 	tar::Cannot mkdir: No such file or directory

Check the manpage.  The "f" switch is used to tell tar that the next
parameter is the file to use:

   tar cvzf test.tar.gz /

Instead, cd to someplace with some space, then run it.

> Typing tar tf test.tar the list shows me:
> 
> /
> /boot
> /root
> [...]
> 
> I do not understand why tar is adding the first entry "/" to the archieve
> and I cannot find a way how to prevent tar from doing this.

By default, tar doesn't, so you must have done something wrong.  Try:

   cd /
   tar cvzf /somewhere/test.tgz .
   cd /somewhere
   tar tvzf test.tgz

Note the "."  btw, tarring the whole root dir will tar the entire
filesystem, including everything that's mounted off the root
filesystem.  man tar to find out how not to do that.


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -



Reply to: