Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Dec 1997 15:15:03 -0500 (EST)
From:      "Adrian T. Filipi-Martin" <atf3r@cs.virginia.edu>
To:        ringlord@bbs.dcoisp.net
Subject:   Re: A simple use of tar question.
Message-ID:  <Pine.SOL.3.96.971221150520.6961A-100000@mamba.cs.Virginia.EDU>
Resent-Message-ID: <Pine.SOL.3.96.971221151526.6961B@mamba.cs.Virginia.EDU>
In-Reply-To: <TCPSMTP.17.12.21.10.20.38.3047923923.10604@bbs.dcoisp.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 21 Dec 1997 ringlord@bbs.dcoisp.net wrote:

> Hello all.
> I am attempting to back a portion of a webserver space for one of my
> clients.
> I plan to use tar and compress the file with gzip.
> I only have one question.
> I am a little unclear on how to preserve the symbolic links, as well as
> write the data that the sym links point to.
> For example.  Suppose this client is in a directory called
> /home/twc-online
> Within this directory, they have a directory called www.  Unfortunately,
> this www directory is nothing more than a symbolic link.  When someone
> changes to the /home/twc-online/www directory, they are changed to the
> linked directory: /home/www/twc-online.
> I see that tar has an h option that supposedly writes the data of
> symbolic links instead of just writing the link itself.  Is that the way
> something like this should be accomplished?  Or is there a better suited
> tar option that will even work better?
> Thanks for any assistance.
> Jeremy

	The 'h' option is probably not what you want, because there will
be no symbolic links when you extract the tarfile.  It will look as if
there never were any symlinks to begin with.

	I'd recommend keeping the symbolic links, since this is what you
will want if you ever use these tarfiles to recreate the original
configuration.  Hence, you have a couple of options.  You can either use
multiple tarfiles, one for each subdirectory root, or you can include
muyltiple subdirectory roots in a single tarfile.

	e.g.  If I want to back up /usr/client and this directory contains
a symlink /usr/client/www to /usr/www/client_root, you could try either
of the following approaches:

   option 1:
	tar -C /usr -czf client.tgz client
	tar -C /usr/www -czf client_root.tgz client_root

   option 2:
	tar -C /usr -czf client.tgz client www/client_root


	I'd recommend the second approach, since the symlinks are
completely preserved no matter where you extract the tarball.  Of course
your symlinks need to be relative for this to work best.  i.e. you used
"ln -s ../www/client_root www" instead of "ln -s /usr/www/client_root www"
to make the link.

	Hope this helps.

	Adrian
--
adrian@virginia.edu        ---->>>>| If I were stranded on a desert island, and
System Administrator         --->>>| I could only have one OS for my computer,
Neurosurgical Visualzation Lab -->>| it would be FreeBSD.  Think about it.....
http://www.nvl.virginia.edu/     ->|      http://www.freebsd.org/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.3.96.971221150520.6961A-100000>