Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Mar 1999 11:10:09 -0500 (EST)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        bangpath@bellsouth.net (borehawg)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: moving filesystems
Message-ID:  <199903081610.LAA23039@cc942873-a.ewndsr1.nj.home.com>
In-Reply-To: <Pine.BSF.4.05.9903080123280.248-100000@kagero.gw.total-web.net> from borehawg at "Mar 8, 99 01:47:51 am"

next in thread | previous in thread | raw e-mail | index | archive | help
borehawg wrote,
> I recently started to become a little low on space in my /usr partition,
> so I deleted a partition off my windows drive (I have two SCSI drives) so
> I could break off /home to a separate partition and expand /usr a bit.
> 
> My current setup is like this:
> (FreeBSD 3.1)
> /dev/da0s1a	/	     
> /dev/da0s1b	swap	        
> /dev/da0s1e	/var	     
> /dev/da0s1f	/usr           <-- prolly will become /home
> /dev/da1s1	/worthless     <-- Win95 partition
> /dev/da1s2a	empty space    <-- soon to be new /usr
> /dev/da2s1	/jaz           (when mounted)
> 
> /dev/da0 is a 1 GB drive
> /dev/da1 is a 2 GB drive with two 1 GB partitions (or slices now)
> 
> My question:
> Do I use the dd command to move an entire partition across or is there
> another command better suited for something like this?
> If I use the dd command to move /usr from /dev/da1s2, would it be
> something like "dd /dev/da0s1f /dev/da1s2a" or do I need to use 
> "dd if=/dev/da0s1f of=/dev/da1s2a" or something else?

I personally think a dump-restore would be better than dd to move a
whole partition.

> I assume I would need to boot into single-user mode and edit /etc/fstab to
> mount everything properly after moving things around. Can I move the
> partitions in multi-user mode, or do I need to do it in single-user mode
> to begin with?

Do you have other users on the machine? If you are the only one who
uses the machine, most (but not all) suggesttions to drop to
single-user mode are not really necessary. If there are other people
logging in and out, you should kick 'em off and keep 'em out.

> What other pitfalls do I need to be aware of before beginning this
> process? I would prefer to do this without losing any data and/or having
> to completly fdisk everything from scratch (and yes, I have definately
> backed up all the important stuff! :-)

If you've backed up and know that the devices being used are all in
working order, I think you are pretty much set. One thing I would do
is have the new disklabels and new fstab ready to go beforehand.

> Or....any FAQs/Tutorials or other reference materials that I should read?

Once, a while ago, I made a post just like this before I cut /home
its own partition. I included my planned command lines. You might want
to look it up in the mail archives. Sorry if I cannot recall the
Subject line.

Anyway, here would be my take on how this would work (all of the
repartitioning should be done before this and is left as an excercise
for the reader, if you need help with that part, let us know ;),

# newfs /dev/da1s2a
# mount /dev/da1s2a /new_usr
# cd /new_usr
# dump -0af - /usr | restore -rf -
# umount /usr
# umount /new_usr
# mv /new_usr /home
# mv /etc/fstab.new /etc/fstab
# mount /dev/da1s2a /usr
# mount /dev/da0s1f /home
# cd /home
# rm -rf `ls -a . | sed s/home//`    # Example ONLY!
# mv home/* .
# rmdir home
# cd /usr
# rm -rf home
# ln -s /home home

And you should be ready to go on with life. No reboots.

One other small point, you might want to reconsider naming the new
/usr partition 'a.' The a-partition is usually assumed to be a root
partition, which in this case, it is not.
-- 
Crist J. Clark                           cjclark@home.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903081610.LAA23039>