I have a FreeBsd 9.1 VirtualBox guest machine I've created with a 10G disk. After installing my usual programs, I've got the not-so-friendly "disk full" message.
What to do:
Boot in single user mode and follow these steps:
EDIT: Today I've received a comment on Google Plus by Edward Tomasz Napierała about improvements on FreeBsd 10. Here's the comment:
What to do:
Resize the virtual disk:
VBoxManage \For example:
modifyhd "FULL_PATH_TO_VDI" \
--resize SIZE_IN_MBS
VBoxManage modifyhd "/home/leonardo/VMS/FreeBsd91/disk.vdi" --resize 20480This will resize the disk up to 20Gb
Let the system know you have resized the disk:
Boot in single user mode and follow these steps:
# gpart showThe first thing to note is the "CORRUPTED" label. To fix it just do:
=> 34 21942973 md0 GPT (CORRUPTED)
34 256 1 freebsd-boot (64k)
290 21943129 2 freebsd-ufs (10G)
# gpart recover ada0Now, it's time to grow the 10G partition to fill the whole 20G disk:
# gpart resize -i 2 ada0If you get the "Device busy" message:
gpart: Device busy
# sysctl kern.geom.debugflags=16Ok, now the partition was resized. The last step is to resize de filesystem on it:
kern.geom.debugflags: 0 -> 16
# gpart resize -i 2 ada0
gpart resized
# growfs /dev/ada0p2Done!, now reboot and enjoy your big disk!.
EDIT: Today I've received a comment on Google Plus by Edward Tomasz Napierała about improvements on FreeBsd 10. Here's the comment:
Note that in 10-CURRENT it's possible to do all this without going single-user.
The 'debugflags' step is also not required.
In 9-STABLE it's possible to resize the filesystem mounted read-write,
but it's not possible to resize the partition.