Mittwoch, 2 Mrz 2011

Webtropia servers with FreeBSD.

Webtropia is a Server Provider in Germany that supports FreeBSD. I have some
new machines there with a default FreeBSD installation.

Unfortunately there are some small bugs in the installation routine, when the filesytem is created for the first time without softupdates, you can easily change it in the rescue system, but the real problem is the swap. The swap size is only 300MB. Normally it is not big deal if you use a 64 bit system, but if you were to try to use your box as a package testing box like me, then you will run into a lot of problems, like the following:

swap_pager_getswapspace(4): failed
swap_pager_getswapspace(9): failed
swap_pager_getswapspace(3): failed
swap_pager_getswapspace(8): failed
swap_pager_getswapspace(2): failed
pid 95498 (httpd), uid 1003, was killed: out of swap space

I googled the error and found a nice workaround in beats@ blog. I
translated it in a short version, and hopefully the Webtropia team will try to fix that soon.

First, create a swap file and adjust the permission. The following example creates a large 1GB swap file:

# dd if=/dev/zero of=/usr/swapdatei bs=1024k count=1024
# chmod 0600 /usr/swapdatei

Now the swap file to the system is provided:

# mdconfig -a -t vnode -f /usr/swapdatei -u 0
# swapon /dev/md0

If you want the swap file to persist after reboot, add the following line to /etc/rc.conf:

swapfile=”/usr/swapdatei”

The system can be checked if it uses the additional swap file by using swapinfo (8):

# swapinfo
Device 1K-blocks Used Avail Capacity
/dev/ar0s1b 1048576 70204 978372 7%
/dev/md0 1048576 0 1048576 0%
Total 2097152 70204 2026948 3%

Thanks Beat for your awesome Blog :-). I hope this will help others who run into the same problem.


Leave a Reply