From owner-freebsd-questions@FreeBSD.ORG Tue Aug 21 05:30:10 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3056416A421 for ; Tue, 21 Aug 2007 05:30:10 +0000 (UTC) (envelope-from msherman77@yahoo.com) Received: from web88310.mail.re4.yahoo.com (web88310.mail.re4.yahoo.com [216.39.53.233]) by mx1.freebsd.org (Postfix) with SMTP id EE59D13C45A for ; Tue, 21 Aug 2007 05:30:09 +0000 (UTC) (envelope-from msherman77@yahoo.com) Received: (qmail 99233 invoked by uid 60001); 21 Aug 2007 05:30:09 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=Qz4sFLdpF6zBWGrd3aCXEJtK0Vc8FU74qM/XBnjI4zQ+ZbhNZQkEKAp1xznXuflmVDyv3Go//GET6mb1sYH97O0124YpbVNQUVA8jPo8TOggyf1DmIBxqk2MU+TdGIdLskEDyDiar+fDh8laXoqr8b0B0UvFKEd39MZQjn7ie/w=; X-YMail-OSG: 5oOK9.4VM1miHLd3l.ddv5bsxSwRk02k1R1xGLzkecZ1qZRQuh.YhxbKN8AZOb50BMinlATWJstFrtcfhj5C6i3hqCMzwdNSa8r02aX66HpixEyluSY- Received: from [74.107.243.44] by web88310.mail.re4.yahoo.com via HTTP; Tue, 21 Aug 2007 01:30:09 EDT Date: Tue, 21 Aug 2007 01:30:09 -0400 (EDT) From: Michael S To: Vinny , FreeBSD Mailing List In-Reply-To: <46CA52E1.1080102@palaceofretention.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <228964.87960.qm@web88310.mail.re4.yahoo.com> Cc: Subject: Re: Trying to move /usr - Fixed X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Aug 2007 05:30:10 -0000 I was able to rectify the problem by removing /home, which was a link and was pointing to /usr/home and then recreating it as a directory. Thanks everyone for their suggestions, Michael --- Vinny wrote: > Michael S wrote: > > I reverted to the old /usr. > > What I had done: > > Initially I set up the newly installed drive (da2) > > to have only one partition (da2s1d) which I chose > to > > be /user (note the e). > > I tarred /usr to a file in /user > > tar -cf /user/usr.tar /tar > > > > and extracted the file > > tar -xf usr.tar > > I had the whole structure of /usr underneath > /user/usr > > > > And then > > cd usr > > mv * .. > > > > to have everything under /user > > > > After thinking about that mv command, I have come to > the > conclusion that /dev/da2s1d does not in fact contain > a /usr directory structure and if mounted will be > empty. Why? > > Note /dev/ad8s1e is an empty partition (a new disk, > if you will on my system that I will in this > demonstration). > > Also, I'll use user and usrdemo as the names of the > user and usr > directories that Michael is using, respectively. I > don't want > to overwrite my own usr directory needlessly. > > Observe: > > Create a mount point and mount the disk > t# cd / > t# mkdir user > t# mount -t ufs /dev/ad8s1e /user > > t# pwd > /user > t# mkdir -p usrdemo/path > > Check our partition (there is a dot (.)after the df > command, > look closely): > > t# df . > Filesystem 1K-blocks Used Avail Capacity Mounted > on > /dev/ad8s1e 507630 6 467014 0% /user > > Create a file for no reason. > > t# touch usrdemo/path/file.txt > t# cd / > t# ls -laR /user > total 6 > drwxrwxrwt 3 root wheel 512 Aug 20 22:05 . > drwxr-xr-x 26 root wheel 1024 Aug 20 21:59 .. > drwxr-xr-x 3 root wheel 512 Aug 20 22:05 > usrdemo > > /user/usrdemo: > total 6 > drwxr-xr-x 3 root wheel 512 Aug 20 22:05 . > drwxrwxrwt 3 root wheel 512 Aug 20 22:05 .. > drwxr-xr-x 2 root wheel 512 Aug 20 22:05 path > > /user/usrdemo/path: > total 4 > drwxr-xr-x 2 root wheel 512 Aug 20 22:05 . > drwxr-xr-x 3 root wheel 512 Aug 20 22:05 .. > -rw-r--r-- 1 root wheel 0 Aug 20 22:05 file.txt > t# cd /user > > Let's look at what file system we're on again: > > t# df . > Filesystem 1K-blocks Used Avail Capacity Mounted > on > /dev/ad8s1e 507630 6 467014 0% /user > > Still on the new drive. > > Now that we're in the /user directory let us try, as > Michael > says "to have everything under /user". Right idea, > but mv is not > the tool in this case: The next command causes much > trouble: > > t# mv * .. > > will in fact move the contents of /user to the > parent directory > which is in fact /, the root of the file system. > > There is nothing left in /user: > t# pwd > /user > > t# ls -la > total 4 > drwxrwxrwt 2 root wheel 512 Aug 20 22:06 . > drwxr-xr-x 27 root wheel 512 Aug 20 22:06 .. > > If we change directory to the .. directory target > (the same target as > the mv command) we'll see the usrdemo directory. > > t# cd .. > t# ls > .cshrc compat lib proc > usb > .profile dev libexec > rescue usr > .snap dist media root > usrdemo > COPYRIGHT dvdrom mnd sbin > var > bin entropy mnt sdvd > boot etc user sys > cdrom home portable tmp > > If we change to it and check our file system: > > t# cd usrdemo/path/ > t# ls > file.txt > t# df . > Filesystem 1K-blocks Used Avail Capacity Mounted > on > /dev/ad4s1a 507630 99704 367316 21% / > > We find it now sitting as a directory the / root > partition! > In Michael's case it would be sitting on the old > /usr > partition. Definitely not what we wanted. > > So what has happened is that the mv * command with > Michael's > usr directory actually overwrote the current /usr > directory > with the contents of the tar archive. Seems like a > no-op but > there could be symbolic link issues, i.e. /usr/home > -> /home. > > I hope that is semi-coherent. > > What you probably want to do to replace a /usr > partition is > something like this: > > cd / > mkdir user > mount -t ufs /dev/da2s1d /user > cd /usr > pax -rw -pe . /user > > pax is like tar. -rw means to read (r) from the > source (.) > and write (w) to the destination (/user). -pe means > to > preserve everything (permissions, ownership etc). > > Having done that, you now have a duplicate usr > directory > structure "under" /user i.e. /user/bin /user/lib and > so on. > > Now you can switch the fstab entries like you > planned, > reboot, and you should have replaced /usr with the > new drive. > > Hope this helps, although you may have some issues > in the future due to any unintended consequences > of the tar/mv command combination. > > Vinny > > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" >