Resizing the file system in FreeBSD
Find out how to resize the file system of an OVHcloud Public Cloud instance or VPS with FreeBSD
Objective
The purpose of this guide is to explain how to resize your file system after installing FreeBSD 12 or resizing the service. By doing this, your system will be able to take advantage of all the disk space.
Requirements
- Having an instance with FreeBSD 12 in your Public Cloud project or a Virtual Private Server with FreeBSD 12
- Having freshly installed the instance/VPS or having resized it
In this tutorial a Public Cloud r2-15 instance is used. The instruction steps are valid for a VPS or a Public Cloud instance. In the examples below, the file system size is initially 5 GB and then 50 GB after applying the actions.
Instructions
To resize your file system, you must first repair the partitions.
Connect to your instance and watch the status of your partitions:
FreeBSD does not install sudo by default. If sudo is unavailable, switch to the root user with su and then run the command without sudo.
You may find that the file system is corrupted. This state is normal due to the installation of the image on the service or after resizing it. To fix it, run the following command:
Running the previous command again confirms the system is now repaired:
Resize the freebsd-zfs partition:
The partition number may be different. To find the correct number, check the vtbd0 column and the number in front of the freebsd-zfs line.
You have now resized your file system. ZFS is configured to expand automatically. Use this command to verify:
In the example output above, zroot now has a size of 50 GB. The ZFS pool has now expanded.
Go further
Join our community of users.