Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2007 20:24:40 -0400
From:      John Nielsen <lists@jnielsen.net>
To:        freebsd-questions@freebsd.org
Cc:        Chad Perrin <perrin@apotheon.com>
Subject:   Re: resizing partitions
Message-ID:  <200710232024.42358.lists@jnielsen.net>
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 Tuesday 23 October 2007, 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.

The best tools (IMO) for this are dump and restore. If you have external 
storage, storage on another system accessible by a reasonably fast network 
from your laptop, or dvd burner (if the example here[1] works, I haven't 
tried it) then this will definitely be your best option. Make your backup 
using dump and verify that it's complete, intact, and able to be restored 
from a fixit CD. Then (still from the fixit CD) blow away your existing 
partitions, make your new ones, and run restore to put your data back.

If that option doesn't appeal to you you should still make and verify a 
complete backup before doing anything else. Depending on how much free 
space (and possibly swap) you have on your disk, you could possibly do a 
few different passes using growfs (in the base system) to this effect:
	identify next (in block order on the disk) partition to be grown.
	if there is no (or not enough) unpartitioned space after the growing 
partition, move everything from the next partition to other partitions, 
possibly creating temporary partitions closer to the end of the disk, or 
permanently relocating one or more partitions to the end of the disk, or 
temporarily converting your swap partition to a filesystem (be sure to not 
use it as swap for the duration, of course)...
		destroy the newly freed partition
	use growfs
	if there's room and a need, recreate the destroyed partition and restore 
its contents from elsewhere
	repeat

I share your doubts about Linux utilities being able to handle UFS (esp. 
UFS2) filesystems correctly.

JN

[1] http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?dump+8
Specifically, the example command line is:
/sbin/dump -0u  -L -C16 -B4589840 -P 'growisofs -Z /dev/cd0=/dev/fd/0' /u



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