When upgrading your disk space (either by AddOn or complete upgrade), or you still have unpartitioned space available, you can use this to create a new partition.
Please note! Knowledge of FreeBSD is required to successfully create a partition. Specific know-how of editing files is required if you want to automatically boot the partition after a reboot.
All FreeBSD 9.0 and later installations are suited with GPT. GPT in combination with a UFS filesystem is used in this guide to create a partition. In case of FreeBSD it's always possible to use ZFS as a filesystem, more information on creating a ZFS partition can be found here. Follow the following steps to successfully create a UFS partition (Note: If not mentioned, a command is always followed by an Enter):
- First make sure that you are logged in as root, if your are not then use the command "su -". Start gpart show and document the two numbers before -free-. From now on we will refer to this numbers as respectively START and SIZE. Also document the GEOM. You can recognize the rule in which you can find the GEOM by the '=> ' symbol. The third column in this rule is the GEOM code. In our example START is 734003166 and SIZE is 209715201. The GEOM is vtbd0.
- Now submit the command gpart recover vtbd0 but replace vtbd0 with the GEOM from step 1. Now run 'gpart show' again and you will notice that the size of the free disk space has grown.
- You are now ready to use the following command gpart add -t freebsd-ufs -b BEGIN -s SIZE GEOM. You are to replace START, SIZE and GEOM with the codes that you documented in step 1. This is a random example of how the code might look like:
gpart add -t freebsd-ufs -b 20971682 -s 18874240 vtbd0
- You will receive a variation of the following output 'vtbd0px added'. In our example it is 'vtbd0p4 added'. Document this output, you will need it for the following step.
- Now you will have to equip the new partition with a filesystem by using the command newfs -U /dev/vtbd0p4. Replace vtbd0p4 with the output from the previous step.
- You are now ready to mount the partition somewhere in the filesystem. However, one more step is required before that can happen. You will need to use mkdir /transip to create a new map. You can replace 'transip' with any name you like. Now mount the partition to the filesystem by using mount /dev/vtbd0p4 /transip. Replace vtbd0p4 with the output from step 4 and transip with the map name you chose earlier.
- Now use df -h to check if the new partition and disk space are successfully created.
- Do not forget to add the new partition to /etc/fstab to enable autmatic booting of the partition. If omitted, you will have to manually mount the partition (mount /dev/vtbd0p4 /transip) every time the VPS is rebooted.
The new partition is now ready to use!
Please note! Should the extra disk space be visible, but a notice that the partition is "corrupted", then this will most likely be caused because the because the GPT backup partition table is no longer at the end of the drive. Fix the backup partition table with gpart:
gpart recover vtbd0