How to mount a harddisk in FreeBSD

We want to access the data from a harddisk drive or an USB memory. Then we need to mount it on FreeBSD. This is done by mount the device onto an empty directory. After that is done we should be able to see what’s on that drive inside of that directory after the mount process.

First step is to create an empty directory. So imagen that user foo wants to mount the harddisk on a new folder named photos. First he need to create an directory inside of hes home directory.

# creates a new directory
mkdir /home/foo/photos

Next step is to mount the harddisk on the mounting point. All devices on your system can be found under /dev/ directory. In my case, I want to mount my device /dev/da1 on /home/foo/photos/ directory. So then I use this command.

mount /dev/da1 /home/foo/photos

You should now be able to see all the files in /home/foo/photos

How to mount other filesystems

In case we are having an USB memory device with Fat32 filesystem, we are in a situation when we have to tell FreeBSD to use a foreign filesystem. Here you have the mount command for fat/fat32.

So when I mount my usbmemory onto the /home/foo/photos/ directory I do like this.

mount -t msdosfs /dev/da1s1 /home/foo/photos/

For more information about which foreign filesystems are being supported by FreeBSD project, visit FreeBSD website by clicking here

How to unmount a filesystem

Let’s say that you want to remove the mounting of an device. This could be for several reasons, the most common is that you might want to erase a disk or move it over to another mount point. In case of un mounting an device do as this.

umount /home/foo/photos/

Make sure you are not standing inside the directory you try to unmount else it wont work.

In case you wish to mount drives on startup then we need to alter the /etc/fstab file.


Set default gateway in FreeBSD – IPv4

The default gateway is the address to the first gateway (router) you will reach in your network from your machine. In case you’ve set IP and DNS correct but your packages cannot reach, it might be because you’ve not set the default gateway address which means that your packages don’t know where to be sent from the machine to the first router.

So let’s set the default gateway in /etc/rc.conf so it remains after every reboot of the machine. Then edit the /etc/rc.conf file and add this line.


And thats it, after a reboot your machine will have that address as default router.

How to remove default router and add a new one

route delete default
route add default 


How to change password in FreeBSD

There are two type of users, root and normal users. The user root is able to change the password on normal users and the normal users can only change their own password.

If you are logged in as root and want to change password on user flouken then do like this.

passwd flouken

After that command you will be asked to enter a new password for the user.

In case you’re a normal user and want to change your own password then do like this.


And you will be asked to enter a new password.