Resizing the file system in FreeBSD 12
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
In order to size your file system, you must first repair the partitions.
Connect to your instance and watch the status of your partitions:
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. So we will fix it:
By repeating the first step, you can see that the system is now repaired:
You can now resize the freebsd-zfs partition. To do this, use this command:
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 spread automatically. Use this command to verify:
In the example output above, zroot now has a size of 50 GB. ZFS is therefore well extended.
Go further
Join our community of users.