Trying to move /usr

Ian Smith smithi at nimnet.asn.au
Mon Aug 20 22:43:22 PDT 2007


Michael, firstly let me quote the head of your original message, just so
I/we don't get too confused, especially by all the gratuitous re-quoting
of subsequent 'relative irrelevancies' like your dmesg ..

>I am trying to migrate my /usr to a newly installed
>SCSI drive. Up until yesterday I had /, /var, /usr on
>a 5 Gig drive and my /home was on another 60 Gig
>drive, which was fine because it had no GUI and
>functioned mostly as a server.

Ok, so /home was its own drive, one slice.  This would suggest that you
didn't have /home as a soft link in / but you should check 'ls -la /' to
be sure that's the case, ie that a link hasn't crept in somehow.  If one
has, delete it.  Also check that your 'old' /usr dir has no link to
/home lying around, which might account for some of this oddness,
especially since your tar and (I'd consider potentially hairy) 'mv * ..'

>Last night I added a third drive, with a capacity
>around 18G; since my other two drives are hard-wired
>in /boot/device.hints, there were no problems with
>device numbering. I wrote down the device name
>(/dev/da2) and proceeded to sysinstall to first create
>a FreeBSD partition and then the only slice within
>that partition. I named it /user.

And you intended to leave /home on the 60G drive?  Its not clear what
you intended to put on the new /user, or was it just an intermediary?

I think I may have called it '/fred' till the process was finished, but
never mind .. back to the more recent, with formatting touched up a tad: 

On Mon, 20 Aug 2007 19:28:51 -0400 (EDT) Michael S <msherman77 at yahoo.com> wrote:

 > Here's df -k output:
 > 
 > Filesystem  1K-blocks     Used    Avail Capacity 
 > Mounted on
 > /dev/da0s1a    507630    85046   381974    18%    /
 > devfs               1        1        0   100%    /dev
 > /dev/da0s1e    495726       10   456058     0%    /tmp
 > /dev/da0s1f   3733038  2869704   564692    84%    /user
 > /dev/da0s1d    495726   110700   345368    24%    /var

So that /user is your old /usr, right?  Do an 'ls -la /user' and check
its contents are the same as your new /usr below.  Also 'du -d1 /user'
should look like 'du -d1 /usr'.  Neither should contain a link to /home

 > /dev/da1s1d  68431992 27948332 35009102    44%    /usr/home
 > /dev/da2s1d  17213408  2882922 12953414    18%    /usr

This looks confused.  I think you want /home (not /usr/home) to be your
60G da1s1d, don't you?  As is, the mountpoint is on the 17G da2s1d,
which would a) actually need to be mounted first, and b) contain a
/usr/home dir to mount it on.

Better would be to mkdir /home, and mount it directly on there.

 > When I go back to the old /usr by editing fstab:
 > /dev/da0s1b             none            swap    sw    0       0
 > /dev/da1s1b             none            swap    sw    0       0
 > /dev/da0s1a             /               ufs     rw    1       1
 > /dev/da0s1e             /tmp            ufs     rw    2       2
 > /dev/da0s1f             /usr            ufs     rw    2       2
 > /dev/da0s1d             /var            ufs     rw    2       2

 > /dev/da1s1d             /home           ufs     rw    2       2
 > /dev/da2s1d             /user           ufs     rw    2       2
 > /dev/acd0               /cdrom          cd9660  ro,noauto       0       
 > 
 > I get into my home directory with no problem.

Right, so you do have a /home directory, not a link there?  Use ls -la
to confirm contents of /, /home and /usr (and /usr/home, if present),
with either the old or the new setup, which might help point out where
this confusion is occuring, especially if there are any links involved.

Also, the realpath command can be useful to discombobulate any links, ie
'cd ~michael ; realpath .'

 > --- Jerry McAllister <jerrymc at msu.edu> wrote:
 > 
 > > On Mon, Aug 20, 2007 at 06:52:12PM -0400, Michael S
 > > wrote:
 > > 
 > > > I tried the earlier suggested dump/restore:
 > > > %cd /user
 > > > %dump -L -f - /usr | restore -r -f -
 > > > 
 > > > When I log-in over ssh I get:
 > > > Could not chdir to home directory /home/michael:
 > > No
 > > > such file or directory.
 > > 
 > > Well, is there a directory named    /home/michael
 > > 
 > > It looks like there is a file system mounted as
 > > /home.
 > > I am guessing that has not changed.   But, it is
 > > telling you
 > > that it cannot find that directory.   Are there some
 > > links
 > > messing you up?
 > > 
 > > What does  'df -k'   show?
 > > 
 > > ////jerry

I'll leave it there, trying to keep the re-quoting level down, but Jerry
and I seem to be on the same page, if reading it in a different order :)

Cheers, Ian



More information about the freebsd-questions mailing list