# Seems I have troubles with tmpfs



## talsamon (Jan 28, 2016)

Trying to install lang/ghc:
failes with "out of swap". (failed with poudriere and synth, but compiles in the port).

(I don't really know it this is true, a much bigger package like editors/libreoffice compiles and installs without problems).

I have no swap, but tmpfs(4) with 4 GB. And now I made a swap-file with 8 GB (8 GB RAM).
`df -h` shows

```
tmpfs  4,0G  8,0K  4,0G  0%  /var/tmp
```

before I had it on /tmp.


```
tmpfs_load=yes
```
in /etc/rc.conf


```
/etc/fstab:
tmpfs  /var/tmp  tmpfs  rw,size=4294967296,nosuid,noexec,mode=01777 0  0
```


why capacity 0%, why is nothing in it.
Never used a swap-file, I did it for the moment, but I don't know how could I control if this work, it seems also not work.


----------



## chrbr (Jan 28, 2016)

Please see below the related part of my /etc/fstab

```
md99       none   swap   sw,file=/usr/swap/swap,late   0 0
tmpfs       /tmp   tmpfs   rw,mode=01777 0   0
```
For details see http://www.wonkity.com/~wblock/docs/html/ssd.html#_swap.


----------



## talsamon (Jan 28, 2016)

Thanks, looks in the moment a little better, there is not much but something in /tmp.
In the swapfile I had no late and "my" noexec seems nonsense. I hope it will work. I will report.


----------



## talsamon (Jan 28, 2016)

No. I think it does not work.
`df -h`

```
tmpfs  4,0G  264K  4,0G  0%  /tmp
```


----------



## chrbr (Jan 28, 2016)

The swapfile and tmpfs have no relation as far as I know. Just swap takes over in case tmpfs gets too populated. Have you created a swap file? Is it active? It should not be within the tmpfs file system. Put in /usr/swap/swapfile or similar. Please check the output of `swapinfo`. Here is the output of my (bored) system.

```
# swapinfo
Device  1K-blocks  Used  Avail Capacity
/dev/md99  8388608  0  8388608  0%
```
If in doubt try `swapon -a` if the entry in /etc/fstab is existing and ok.


----------



## talsamon (Jan 28, 2016)

```
swapinfo
Device  1K-blocks  Used  Avail Capacity
/dev/md99  8388608  18524  8370084  0%
```

ok, seems is used. Thanks.


----------



## kpa (Jan 28, 2016)

The relation between tmpfs(5) and swap is that the filesystem allocates virtual memory and that memory usually comes from physical RAM. In an unusual situation where the system is running low on memory the allocation might cause the system to swap and the filesystem backing store will be partly in the swap space.


----------



## chrbr (Jan 28, 2016)

Dear kpa,
yes, this is the perfect explanation. My wordings are too weak. It is possible to use tmpfs(5) without swap and the other way around. But it can be difficult. Some days ago ports-mgmt/poudriere has eaten up tmpfs(5) handling www/firefox and print/texlive-full in parallel. My RAM is 2G which is fine most of the time but not for that. Even the swap space of 3.4G of a rotating disk was full. Enabling a 4G swapfile on my SSD helped a lot. Now I have 8G swap on the SSD, it out of use 99.999% of the time anyhow. So it does not hurt.


----------



## talsamon (Jan 30, 2016)

Swap makes a kernel panic message on shutdown.


----------

