Title: Resize live UFS filesystem on FreeBSD 11 Author: Solène Date: 17 May 2016 Tags: freebsd11 Description: I am using FreeBSD in virtual machines and sometimes I need to increase the disk capacity of the storage. From your VM Host, increase the capacity of the storage backend, then on the FreeBSD system (10.3 when writing), you should see this in the last line of _dmesg_. Use `gpart commit vtbd0` to save changes or `gpart undo vtbd0` to revert them. Here is the `gpart show` output on the system: 34 1024 1 freebsd-boot (512K) 1058 159382528 2 freebsd-ufs (76G) 159383586 8388540 3 freebsd-swap (4.0G) 167772126 167772161 - free - (80G) The process is a bit harder here because I have my partition swap at the end of the storage, so if I want to increase the size of the ufs partition, I will need to remove the swap partition, increase the data partition and recreate the swap. This is not that hard but having the freebsd-ufs partition at the end would have been easier. 1. swapoff the device : **`swapoff /dev/vtbd0p3`** 2. delete the swap partition : **`gpart delete -i 3 vtbd0`** 3. resize the freebsd-ufs partition : **`gpart resize -i 2 -a 4k -s 156G vtbd0`** 4. create the swap : **`gpart add -t freebsd-swap -a 4k vtbd0`** 5. swapon : **`swapon /dev/vtbd0p3`** 6. tell UFS to resize : **`growfs /`** If freebsd-ufs was the latest in the gpart order, only steps 3 and 6 would have been necessary. Sources: [FreeBSD Handbook](https://www.freebsd.org/doc/handbook/disks-growing.html) and [gpart(8)](https://www.freebsd.org/cgi/man.cgi?gpart%288%29) |