How to disable bitnami VM swap

At some point you may want to change the size of swap or create your own and disable it.

The file containing the swap file can be found in

root@redmine:/# grep -rnw /opt/ -e “bitnami.swap”
/opt/bitnami/scripts/init/swap_file:9:SWAPFILE=/mnt/.bitnami.swap

You can increase it by changing SWAPSIZE=650000 or

. /opt/bitnami/scripts/init/functions

SWAPFILE=/mnt/.bitnami.swap
SWAPSIZE=650000
instance_type=`get_generic_instance_type`
if [ “x$instance_type” = “xmicro” ] || [ “x$1” = “x–force” ] ; then
if ! (swapon -s | grep -q $SWAPFILE) && test $SWAPSIZE -lt `df -k |grep -m1 -e ‘/$’|awk ‘{print $4}’`; then
rm -f $SWAPFILE
dd if=/dev/zero of=$SWAPFILE bs=1K count=$SWAPSIZE
mkswap $SWAPFILE
swapon $SWAPFILE
fi
else
rm -f $SWAPFILE
fi

or disable creation of this swap during start up by  taking -x from the init file

cd /opt/bitnami/scripts/init/functions

chmod -x swap_file

All done.

restart your VM and ‘dmesg’ to check that is not creating itself.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s