From owner-freebsd-questions Sun Jul 30 13:58: 5 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mailhost01.reflexnet.net (mailhost01.reflexnet.net [64.6.192.82]) by hub.freebsd.org (Postfix) with ESMTP id 6297737B808 for ; Sun, 30 Jul 2000 13:57:30 -0700 (PDT) (envelope-from cjc@184.215.6.64.reflexcom.com) Received: from 184.215.6.64.reflexcom.com ([64.6.215.184]) by mailhost01.reflexnet.net with Microsoft SMTPSVC(5.5.1877.197.19); Sun, 30 Jul 2000 13:56:31 -0700 Received: (from cjc@localhost) by 184.215.6.64.reflexcom.com (8.9.3/8.9.3) id NAA25551; Sun, 30 Jul 2000 13:57:28 -0700 (PDT) (envelope-from cjc) Date: Sat, 29 Jul 2000 13:29:18 -0700 From: "Crist J. Clark" To: Doug Lee Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Fake root for symlinks? Message-ID: <20000729132918.B7953@cjc-desktop.reflexcom.com> Reply-To: cjclark@alum.mit.edu References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from dgl@visi.com on Sat, Jul 29, 2000 at 03:18:57AM -0500 Status: RO Lines: 43 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [This mail was resent due to delivery problems. If you have received it twice, please ignore. Sorry for any inconvenience.] On Sat, Jul 29, 2000 at 03:18:57AM -0500, Doug Lee wrote: > I have had occasion to mount drives and NFS shares containing absolute > symlinks which, once mounted, point to the wrong thing. Can I somehow > make the "root" for such absolute links something other than /? > > Example: I mount an old FreeBSD drive in /old complete with all its > partitions: The old / becomes /old, the old /usr becomes /old/usr, > etc. (I recently did this while upgrading from 3.4 to 4.1 via a fresh > install on a new drive.) I then make the mistake of trying to change to > /old/home, which was a symlink to the old /usr/home... but now I'm > suddenly waking up in /usr/home on my current system. I want to mount the > old partitions such that the absolute symlink /old/home --> /usr/home is > redirected to point to /old/usr/home. This is surely a problem > encountered by many folks making NFS mounts as well. This is not unique to NFS. I learned this lesson too from putting FreeBSD 3.x and 4.x systems on the same drive. The 4.x system has a /3.x-STABLE directory and the 3.x has a /4.x-STABLE where they mount the stuff from one another. Sometimes absolute symlinks drop you in the running system when 'cd'ing around the other. There is no reasonable way to change this, not with the way symlinks actually work. The fact symlinks are the only way to link files across filesystems, starting to do dynamic things with what / means will be a mess. The fact that a link pointed to /usr/home is _always_ /usr/home no matter where the filesystem containing a link to it is mounted, IMHO, a useful feature rather than bug. In your case, and what I do with my two FreeBSDs on one disk, is to, % rm /old/home % ln -s /old/home usr/home Note... NO initial '/'. If you are in /old and now do a 'cd home,' you'll end up in the right place. As a rule of thumb, always make symlinks that are supposed to point to something in the same filesystem relative (cannot start with '/'); this way, they can never break by moving the mount point. As for symlinks that cross filesystems... a much stickier point. Since you cannot necesarily be sure the other filesystem will be there, they cannot be guaranteed to work. What to do will depend on how you mean things to work. -- Crist J. Clark cjclark@alum.mit.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message