Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2007 11:33:06 -0400
From:      Jerry McAllister <jerrymc@msu.edu>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Cc:        Jerry McAllister <jerrymc@msu.edu>
Subject:   Re: resizing partitions
Message-ID:  <20071024153306.GA88476@gizmo.acns.msu.edu>
In-Reply-To: <20071023181503.GC54356@demeter.hydra>
References:  <20071023181503.GC54356@demeter.hydra>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 23, 2007 at 12:15:03PM -0600, Chad Perrin wrote:

> I have need to alter some partition sizes on a (laptop) system I use
> daily, with FreeBSD 6.2-RELEASE installed.  Are there tools you'd
> recommend for this, that should be stable and not prone to hosing up my
> filesystems?  In particular, I probably don't need to shrink any
> partitions -- only grow them -- but I'm not sure how I want to handle
> this at this time.  I worry a bit about using some Linux LiveCD's
> partition management tools on a FreeBSD system.  Any advice would be
> appreciated.

First, is there a strong reason that you must change the partition sizes?
Could you not instead just move some directories and make soft links
(Symbolic Links) from the old location to the new?   This can solve
most issues with much less hassle.

Second, are you for sure meaning partition and not slice in FreeBSD
terms?   If you mean slices, then there is no reasonable way other
than to back things up - using dump - and rebuild things and then
restore data.

If you mean FreeBSD partitions, then it is possible you could use
a utility called growfs.  But, it requires adjacent space to grow
in to.  You would have to free space in the partition that is next
higher in address space.   That would mean also backing that partition
up and blowing it away, growing the lower partition and creating the
higher one anew.    Given all that trouble - and room for error, it
might be easier just to back up each partition/file system with a
reliable dump (check it before nuking things) and then rebuilding
the file systems from scratch using the fixit CD and then restoring
each file system.    

If you are referring to FreeBSD partitions (and not MS partitions which
FreeBSD calls slices), then after making dumps of each file system (except
/tmp - don't bother with it)  you boot the install CD, select the fixit
shell, use disklabel to remake partitions and newfs to build the
file systems.  Make temporary mount pointss (which really exist in a 
memory file system, but you don't care about that) in the fixit's root 
and then cd in to each and restore the appropriate dump in to it with
a  'restore -rf '  Since you would, in this case be restoring a root
that you were already using, if you do not change the number and names
of partitions/file systems - just sizes, such things as /etc/fstab 
and rc.conf, etc would already be there and set up as you need them, so 
just reboot when all the restores are done.   If you change any of the 
partitions so that mount information needs to be redone, then you will 
want to go to that /etc/fstab in the temporarily mounted restored root
file system and modify it to suit the new situation.  Then reboot.

I think that if moving a directory and creating a symlink, as in my first
comment above, will not do the trick for you, then doing the complete dump 
and rebuild of partitions/file systems is a better bet that growfs.  Growfs 
is really more suitable for those situations where a person left a large 
glob of space un the slice unallocated in any partition, thinking another 
use was to be put to it later but now wants to incorporate that glob in 
to the partition next to it.   It is not really designed for moving stuff 
around in the middle of things.   But you can try it.

Third, Anyway, don't try using LINUX tools to manipulate 
the FreeBSD partitions.   There is too much difference.

////jerry

> 
> -- 
> CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
> John W. Russell: "People point. Sometimes that's just easier. They also use
> words. Sometimes that's just easier. For the same reasons that pointing has
> not made words obsolete, there will always be command lines."
> _______________________________________________
> 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"



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