/usr backup/remove issue

Jerry McAllister jerrymc at clunix.cl.msu.edu
Tue May 24 09:56:34 PDT 2005


> 
> hi all,
> 
> i have freebsd 5.1 running with 4 x 200GB ATA HD. let's say i have
> /usr installed in hd1. i want to move /usr to a larger partition in
> hd4. how can i do that?
> 
> here is my scenario. i backed up all /usr data to /usr1 in hd4. then i
> checked the location of ln and mkdir to make sure that they are not
> located in /usr. after that, i deleted or files in /usr "rm -Rf /usr"
> and planned to create symbolic link from /usr1 to /usr. anyway, lately
> i realized this is really stupid idea. after rebooting, i couldn't log
> in to terminal. even logged in as single user didn't help. (i tried
> mount the partition, but was nothing to avail).

I am a little unclear here.
What did you do to "back up" stuff from /usr to /usr1?
Did you put a dump or tar file there or make a duplicate copy
of /usr in /usr1?

Hopefully you did the latter.  
Then you can just go to your  /etc/fstab  file and edit it
so that the partition that was getting mounted as /usr1 now
gets mounted as /usr.    At the same time, fix it so that
the partition that was getting mounted as /usr now gets mounted
as something else or not at all.    Then, just reboot.  No links
needed.

You might want to do the editing of /etc/fstab in single user mode.

Since something seems hosed now, it will be necessary to know
what you have in order to direct your way out of it.   If you 
really have a duplicate of the stuff in the partition that was
getting mounted as /usr, then come up to single user, fsck stuff
and remount root as read/write    (mount -u /)   and then
mount the partition with the good version of /usr  (that used to
get mounted as /usr1)  as /usr.   Then edit your /etc/fstab.

The system doesn't care which partition it is in, just where is
is mounted.

If you didn't make an identical copy of /usr  in  /usr1, then it will
be a little harder.   If you have a dump file there, you are luck because
restore is in /sbin/restore which is probably in your root partition, 
then you can boot to single user, remount root, mount the new partition 
as something - /usr would probably do if you already nuked the old one -  
and then cd to that partition and restore -r the dump file in to that 
partition.
If it is a tar file, that won't work because tar is in /usr and you
nuked that.   So, hope for an identical /usr or a dump file.

By the way, you should not have done the rm -rf until all things
were hooked up and happy.    You should have just unmounted it and
mounted the other one there.   Then test stuff and edit /etc/fstab
and reboot.   You only do the rm long after you have proven to 
yourself that everything is good.

////jerry

> anybody can shed a light?
> 
> thanks before.
> Mike
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list