Copying a file system w/ tar - symbolic links not copied right.

Dan Nelson dnelson at allantgroup.com
Wed May 10 19:21:32 PDT 2006


In the last episode (May 10), Don O'Neil said:
> Hi all...
> 
> I'm trying to move a file system from one disk to another, and when I
> do this:
> 
> tar cf - /source/* | ( cd /destination && tar xfv - )
> 
> It copies all the files, but the symbolic links are copied as files
> of 0 length, rather than re-established as links.
> 
> What am I doing wrong here, or is my tar broken?

Sounds like your tar's broken.

(dan at dan.7) /tmp/z> ln -s testing link
(dan at dan.7) /tmp/z> md bsdtar gnutar
(dan at dan.7) /tmp/z> bsdtar cf - link | ( cd bsdtar && bsdtar xvf - )
x link
(dan at dan.7) /tmp/z> gtar cf - link | ( cd gnutar && gtar xvf - )    
link
(dan at dan.7) /tmp/z> ls -l bsdtar gnutar
bsdtar:
total 4
drwxr-xr-x  2 dan  wheel  512 May 10 21:19 ./
drwxr-xr-x  4 dan  wheel  512 May 10 21:18 ../
lrwxr-xr-x  1 dan  wheel    7 May 10 21:18 link@ -> testing

gnutar:
total 4
drwxr-xr-x  2 dan  wheel  512 May 10 21:19 ./
drwxr-xr-x  4 dan  wheel  512 May 10 21:18 ../
lrwxr-xr-x  1 dan  wheel    7 May 10 21:19 link@ -> testing
(dan at dan.7) /tmp/z> bsdtar --version
bsdtar 1.01.020, libarchive 1.02.033
Copyright (C) 2003-2004 Tim Kientzle
(dan at dan.7) /tmp/z> gtar --version
tar (GNU tar) 1.13.25

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list