# tmpfs not working



## Windmill (May 18, 2014)

Hi, I mount /tmp as tmpfs and then loaded the driver from /boot/loader.conf, but the system still writes to disk. Why is this happening?


----------



## Toast (May 18, 2014)

What does `df -h` and `mount | column -t` say?


----------



## Windmill (May 18, 2014)

It shows tmpfs as mounted but it writes to disk, in fact after I reboot the files are still there


----------



## Toast (May 18, 2014)

Could you paste what `df -h`, `mount | column -t` and `cat /etc/fstab` say? It's hard to help someone without any information to go on.


----------



## Beastie (May 18, 2014)

It's not using tmpfs. It's still mounted on a partition on the disk.

You don't need to have anything in /boot/loader.conf. The driver will be loaded automatically if you have a valid /etc/fstab entry, which I suspect is missing in your case.


----------



## Windmill (May 18, 2014)

/etc/fstab:

```
tmpfs /tmp tmpfs rw,mode=777 0 0
```


----------



## Beastie (May 18, 2014)

And what does `mount` return?


----------



## t1066 (May 19, 2014)

I think that the permission for /tmp should be 1777 instead of 777.


----------



## Windmill (May 19, 2014)

I tried with both 1777 and 777, it's the same.
`mount`

```
tmpfs on /tmp (tmpfs, local)
```
plus ZFS datasets.

`df -h`

```
Filesystem Size Used Avail Capacity Mounted on
Tmpfs 6,8G 4.0K 6,8G 0% /tmp
```
Strange fact is that the /tmp ZFS dataset shows 16M used.


----------



## SirDice (May 19, 2014)

If there's data in /tmp remove that first before mounting tmpfs(5) on it, make sure it's completely empty (it's best to do this in single user mode). Remove the ZFS /tmp filesystem. And the correct permissions are 1777, not 777. You need the sticky(7) bit too.


----------



## Toast (May 19, 2014)

SirDice said:
			
		

> Remove the ZFS /tmp filesystem.


It's probably that; tmpfs is mounted first then ZFS mounts over it. I wanted to check the output of `mount` to make sure before suggesting it.

`rcorder /etc/rc.d/* /usr/local/etc/rc.d/*`

```
/etc/rc.d/mdconfig
/etc/rc.d/hostid_save
/etc/rc.d/mountcritlocal # fstab mounting
/etc/rc.d/zfs            # zfs mounting
/etc/rc.d/var
/etc/rc.d/cleanvar
```


----------

