[afnog] Resize FreeBSD partition

Brian Candler B.Candler at pobox.com
Thu Sep 1 23:39:28 EAT 2005


On Thu, Sep 01, 2005 at 12:59:45PM -0700, Hervey Allen wrote:
> Brian Candler wrote:
> 
> > Resizing partitions which contain data that you want to keep is tricky. Your
> > best bet might be a commercial package like PartitionMagic - although it
> > might not be able to resize a FreeBSD partition.
> > 
> 
> I looked in to this once and found that PartitionMagic can't 
> deal with UFS file systems. The current version 8.0 claims 
> that it, "Supports FAT, FAT32, NTFS, Ext2, and Ext3 file 
> systems."
> 
> Full details are here:
> 
> http://www.powerquest.com/partitionmagic/features.html

A quick google around shows that FreeBSD comes with a growfs(8) utility to
enlarge a UFS partition - but not shrink it.

There's another useful-looking tool here:
http://www.gnu.org/software/parted/parted.html
Again like partition magic it won't resize UFS, but you could at least use
it to grow your Windows partition, for free. Completely untested by me, so
use it at your own risk.

Otherwise, for the partitions within the FreeBSD slice: you could dump(8)
them to a remote machine, and to restore(8) them afterwards. You can pipe
dump/restore to a remote file over ssh. e.g.

    # dump -0u -f - / | ssh myname at remotemachine 'cat >dump.root'
    # dump -0u -f - /usr | ssh myname at remotemachine 'cat >dump.usr'
    ...etc - repeat for the other filesystems in /etc/fstab

You can pipe it through gzip too to save space on the remote machine, at the
expense of CPU:

    # dump -0u -f - / | gzip | ssh myname at remotemachine 'cat >dump.root.gz'

Restoring them will probably involve booting off a rescue CD. I can't really
give you step-by-steps on that.

It makes life easier if when you first build a machine, all your 'useful'
data is within one partition (I use /u, and symlink /home to /u/home). Then
you can just do a FreeBSD reinstall from scratch, then restore that one
partition. Keep a separate tar backup of /etc and /usr/local/etc.

dump/restore are effective but don't allow you to restore data selectively.
So you may prefer to use tar or cpio if you just want to be able to restore
individual data files rather than the whole O/S.

Another option would be to burn your FreeBSD data to CD-R or DVD-R. See
burncd (base system), mkisofs (ports) and cdrtools (ports).

Regards,

Brian.



More information about the afnog mailing list