# Mounting a folder to another folder in /mnt



## alkyred (Apr 26, 2013)

Without getting into serious details I have a need to mount a folder at the root level to another folder in /mnt.

Here is what I have: I am using an Alix board with a 4G CF card. I can't continuously write to the CF because it has a limited amount of writes. So I added a USB hard hard drive and mounted it to /mnt. There are two folders on the external HD we will call them /temp1 and temp2. On the root of my CF I have /temp1 and /temp2. I am looking for a way to mount /mnt/temp1 to the root folder /temp1 and the same for temp2. This way when I write to /temp1 it is actually writing to /mnt/temp1 and the same for temp2.


Any assistance would be greatly appreciated.

Todd


----------



## kpa (Apr 26, 2013)

Use nullfs(5).


----------



## alkyred (Apr 29, 2013)

@kpa, When I use that command I get 
	
	



```
Operation not supported by device.
```


----------



## fonz (Apr 29, 2013)

alkyred said:
			
		

> When I use that command I get Operation not supported by device.


What _exactly_ did you do (or try)?


----------



## lubnet (Apr 29, 2013)

Why you bother with /mnt? `# mount yourdevice /temp1` This way you will write to /temp1 then.


----------



## alkyred (Apr 29, 2013)

@fonz,

Here is what I am up against and why I am trying to mount /var and/or /tmp to my external hard drive.

I am using an ALIX board to run pfSense with the 5g NANO image. The new pfSense allows you to run Squidguard. The problem is that on an ALIX board running the NANO image of pfSense, they use the onboard 512 memory for the folders /var and /tmp. The OS is loaded on a Compact Flash which is read-only. They use the memory for /var and /tmp folders because that is where pfSense writes logs and temporary items.  

Well, when you use blacklists with Squidguard, there is not enough room to open/unpack the blacklists and then copy them to the Squidguard databases. So two schools of thought. First, make the virtual drives larger to handle the blacklists, however, when you increase the memory for this operation, you get memory errors because there is not enough memory left for the OS. 

This leads me to what I am working on. Add an external USB hard drive and mount /tmp on the external drive not memory. /tmp seems to be the folder that needs the most room.  

I have the external drive working but I cannot get the OS to `mount /dev/ufs/usbdisk /tmp`.

I hope this helps.


----------



## fonz (May 1, 2013)

If you need more space for /tmp and/or /var while they are currently memory-mounted, I think your best bet is to create partitions for them on your external HDD and then edit /etc/fstab to mount those partitions instead of from memory.


----------

