Thursday, April 7, 2016

Resizing an UFS2 filesystem on FreeBSD

List all block devices:
# gpart show

If this doesn't show the correct size for the resized device, then reboot. During reboot ignore any warnings about invalid GPT headers
Error eg: gpart: table 'ada0' is corrupt: Operation not permitted

Fix the invalid GPT header (replace ada0 by your actual block device):
$ gpart recover ada0

Allow write access to GEOM providers:
$ sysctl -w kern.geom.debugflags=16

Resize the third partition (again, replace 3 and ada0): 
$ gpart resize -i 3 ada0
p/s: i value is depand on /dev/ada0p3 (value after p)

Resize the filesystem:
$ growfs ada0p3
Enter Yes (case-sensitive!) when asked

Disallow write access to GEOM providers (just as a security measure):
$ sysctl -w kern.geom.debugflags=0
This even works for a mounted root filesystem.

No comments:

Post a Comment