forked from solene/openbsd-webzine
improve tip, no root, round up memsize
This commit is contained in:
parent
a9d604f1d4
commit
38e8801385
|
@ -2,14 +2,20 @@
|
||||||
<div class="puffies" aria-hidden="true">🐡🐡🐡</div>
|
<div class="puffies" aria-hidden="true">🐡🐡🐡</div>
|
||||||
<h2>Shell tips</h2>
|
<h2>Shell tips</h2>
|
||||||
<p>
|
<p>
|
||||||
To improve performances or avoid disk i/o, one may mount /tmp in memory (mfs). As example to create a /tmp using 10% of available RAM:
|
To improve performances or avoid disk i/o, one may mount /tmp in memory (mfs). The new fstab entry would look like this :
|
||||||
|
</p>
|
||||||
|
<pre> swap /tmp mfs rw,nodev,nosuid,-s=800MB 0 0</pre>
|
||||||
|
Of course, replace the size 800MB according to how much memory you want to let for /tmp.
|
||||||
|
</p>
|
||||||
|
<p> To know how much memory you have, you may use dmesg and awk : </p>
|
||||||
|
<pre>dmesg | awk '/avail mem/'</pre>
|
||||||
|
<p>
|
||||||
|
As example to create a /tmp using 10% of available RAM, the following command will output the line to copy in /etc/fstab to replace "/tmp" entry, using awk to compute the size :
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
# sed -i '/\/tmp /s/^/\#/' /etc/fstab
|
printf "swap /tmp mfs rw,nodev,nosuid,-s=%sB 0 0\n" \
|
||||||
# printf "swap /tmp mfs rw,nodev,nosuid,-s=%sB 0 0\n" \
|
$(dmesg |awk '/avail mem/ { print int($4 /10) }')
|
||||||
$(dmesg |awk '/avail mem/ { print $4 /10 }') \
|
|
||||||
>> /etc/fstab
|
|
||||||
# chmod 1777 /tmp
|
|
||||||
# mount -a
|
|
||||||
</pre>
|
</pre>
|
||||||
|
<p>You may have to adjust newly created /tmp permissions:</p>
|
||||||
|
<pre> # chmod 1777 /tmp</pre>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in New Issue