Skip to content

Commit

Permalink
Up memory to 1024 and add swap to low-memory systems
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Nov 22, 2018
1 parent a395dd9 commit b47a0a9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Vagrant.configure("2") do |config|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Customize the amount of memory on the VM:
vb.memory = "768"
vb.memory = "1024"
end

# Provision
Expand Down Expand Up @@ -181,5 +181,21 @@ Vagrant.configure("2") do |config|
echo "================================================================================"
service --status-all
# Creates a swap file if necessary
RAM=`awk '/MemTotal/ {print $2}' /proc/meminfo`
if [ $RAM -lt 1000000 ] && [ ! -f /swap/swapfile ]; then
echo "================================================================================"
echo "Adding swap"
echo "================================================================================"
echo "This process may take a few minutes. Please wait..."
mkdir /swap
dd if=/dev/zero of=/swap/swapfile bs=1024 count=1000000
mkswap /swap/swapfile
chmod 600 /swap/swapfile
swapon /swap/swapfile
echo "/swap/swapfile swap swap defaults 0 0" >> /etc/fstab
echo "Done."
fi
SHELL
end

0 comments on commit b47a0a9

Please sign in to comment.