[X-Unix] Backup and Restore of Symbolic Links

Jerry Krinock jerry at ieee.org
Wed Dec 6 12:34:31 PST 2006


Traffic has been slow lately.  Here's something I figured out yesterday.

Say you have a file A.txt and a symbolic link (symlink) ALink which links to
it, at the root level of your boot drive.  The data in Alink is the string
"/A.txt".

Many backup regimens are based on the unix "cp" command or engines which
behave similarly.  By default, cp does not "follow" symlinks.  Say that you
cp both A.txt and ALink to a mounted Firedrive named FW.  Now doubleclick on
the copy of Alink on FW.  Because the data in Alink is the string "/A.txt",
you will open /A.txt on your boot drive, NOT on FW.

The same thing happens if you have a file on FW, create a symlink to it on
FW, and then cp both of them over to your boot drive.  When you doubleclick
on the symlink copy on the boot drive, you'll open the target file on FW,
because the text in the symlink file begins with "/Volumes/FW/...".  Unmount
FW, doubleclick the symlink again and you'll get "no such file", "file not
found", or whatever.

Thinking back, I believe I have been confounded by this behavior more than
once in my life.

However, say FW is bootable and you re-boot from FW.  If you doubleclick on
this symlink now, you'll get the target file on the FW drive, as expected,
because the "/" in "/A.txt" is now, in fact, FW.

The same thing will happen if you "restore" (cp) files copied from your boot
drive to FW, back to your boot drive.




More information about the X-Unix mailing list