Adding a new disk on FreeBSD is just a matter of minutes. As usual in the field of system administration i need to do some pre-checks first before carrying out any operation. There are many documentations available on the Official FreeBSD Handbook. However, i create this blog post so that we can discuss more about it.
1.Start by retrieving the trace from dmesg. I fired this command and redirect it into another file.
less /var/run/dmesg.boot > /home/dmesg1.txt
2. You can also redirect the output of the df -h and or gpart show command.
3. Add the disk from the Virtual Box “Storage” tab, i create a new .vdi (Note that you need to switch off the machine before adding disk)
4. After the disk was added i booted the machine and fired another less /var/run/dmesg.boot > /home/dmesg2.txt
5. Then, i made a diff dmesg1.txt dmesg2.txt to compare both dmesg before and after insertion of disk to be assured that a new disk has been detected.
As you can see the result was awesome the new disk “ada1” was detected.
6. Now, we can need to check if we are using GPT or MBR. Through the gpart show command, we already know we are using GPT.
7. So i add the GPT to the disk and the partition is added with the following commands:
gpart create -s GPT ada1
gpart add -t freebsd-ufs ada1
8. Next step is where the file system on the new disk is created with the following commands:
newfs -U /dev/ada1p1
(tips: do press tab twice to see if you really have those device called ada1p1 to do not get confused if you already have more disks)
9. The final step is to create a new directory and mount the new disk:
10. Add the following entry in the /etc/fstab
/dev/ada1p1 /home/newhdd ufs rw 2 2
11. Mount the disk now:
12. I can now do a gpart show to see my new disk as well as a df -h