Notes on enlarging my /usr, FreeBSD

First, introduce yourself to man fdisk, bsdlabel, growfs.

Quick link: this. Refer for good detailed instructions.


Those with extensive Windows experience might think of “resizing the FreeBSD partition”, but that’s not how it works in FreeBSD.

When you search the net, the first thing you’ll find is people saying you should use growfs to do that. Obviously, they’ve never did anything like it before and are just playing wise-ass.

Here’s the deal: for resizing partitions (in “classical” DOS terms; this is “slices” for FreeBSD), you use fdisk. You may both enlarge and shrink at this stage.

(NOTE 1: you’ll have to do this in single-user mode. When asked which shell you want, use the default /bin/sh. Using /bin/csh is bad, mkay? First, I’ve found the environment variables aren’t set in this case (you’ll have to write full path names). Then, there’s the quirk with utilities (vi, say) grabbing one line instead of the entire screen.)

Then you use bsdlabel (aka disklabel) to change the size of FreeBSD partitions in a chosen slice. You will actually have to use /usr/bin/vi at this stage (I think it’s hard-coded into the bsdlabel executable). You can change the sizes in any way – enlarge or shrink. After all, it’s just editing a text file.

(NOTE 2: vi is on /usr. It will want /tmp to store the file being edited. You’ll have to mount those. Don’t worry, it’s OK, as long as you don’t forget to unmount them after editing.)

Finally, you can use growfs to grow the file system, according to the info you’ve specified in the disk’s label. If there was shrinkfs, you could shrink it, too.

So, you see, growfs is the shortest and easiest part of growing a file system.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: