[lug] tar and symlinks

Sean Reifschneider jafo-nclug at tummy.com
Mon Oct 28 22:09:58 MST 2002

On Tue, Oct 29, 2002 at 04:56:33AM +0000, j davis wrote:
> So I did a backup to tape using the tar command. To test, I restored
>the /etc dir i backed up from tape to my home dir. I then did a diff
>and recived the output below. All the file are symlinks...so if i do
>a restore do i have to manually remake the symlinks?

Tar seems to be able to handle sym-links:

   guin:tmp$ mkdir tarfoo
   guin:tmp$ cd tarfoo
   guin:tarfoo$ date >file
   guin:tarfoo$ ln -s file symlink
   guin:tarfoo$ tar c . | tar xvv
   drwxr-xr-x jafo/jafo         0 2002-10-28 22:06:54 ./
   -rw-r--r-- jafo/jafo        29 2002-10-28 22:06:45 ./file
   lrwxrwxrwx jafo/jafo         0 2002-10-28 22:06:54 ./symlink -> file

I presume that there were errors while restoring the tar which said why
the symlinks weren't getting restored, but that you didn't notice or
pass them on in your message...

 "The big bad wolf, he learned the rule.  You gotta get hot to play real cool."
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin
      Back off man. I'm a scientist.   http://HackingSociety.org/

More information about the LUG mailing list