Freebsd – how to mount extra disk in freebsd

freebsdvirtualbox

I am trying to mount extra storage on my pfsense installation running in virtualbox.

I have added an extra virtual drive and can see it attached when running fdisk /dev/da1.

I want to mount it in /squidcache. When looking at /etc/fstab it shows drives mounted as /dev/label/. So next I tried to label the partiton. The disk seems to have one partition on it, /dev/da1 returns … the data for partition 1 is …

Tunefs -L cache /dev/da1s1 returns "could not read superblock to fill out disk".

I think the partition is named da1s1 but i'm not even sure about that. (using any other designation returns "could not find special device".

Trying to mount it via fstab without labeling likt this:
/dev/da1s1 /squidcache ufs rw 0 0
returns "mount /dev/da1s1: invalid argument"

I have some experience in these things on linux but freebsd seems to be just different enough to stop me from accomplishing this.

How do i go about labeling this partition or how do i mount the partition without labeling it.

Best Answer

After adding the disk to VirtualBox, did you use fdisk or gpart to actually create an MBR or (better) GPT partition?

For MBR:

gpart create -s bsd da0s1
gpart add -t freebsd-ufs  -a 4k -s 2g   da0s1
newfs -L squidfs -U /dev/da0s1a

For GPT:

gpart create -s gpt da0
gpart add -t freebsd-ufs -l squidfs -b 1M -s 2G da0
newfs -U /dev/gpt/squidfs

There are fdisk equivalents, to the gpart commands above if you are more familiar using that.

The sizes and parameter values need to be set "according to taste", but that should given you an idea of what you need to do next.

Check out Disk Setup On FreeBSD and the example section in the gpart man page.