Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sent workaround for swap file creation at boot #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions extensions/util_ms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,18 @@ echo "net.ipv4.tcp_keepalive_time = 120
" >> /etc/sysctl.conf
}

# Update waagent.conf to setup swap on boot (32G)
cat << EOF >> /etc/waagent.conf
ResourceDisk.Format=y
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=32768
EOF
# restart waagentlinux to make changes active
systemctl restart walinuxagent.service

formatDataDisk ()
{
# This script formats and mounts the drive on lun0 as /datadisk
# It also sets the swap file to 32GB on /mnt which is the temporary disk on /dev/sdb

SWAPFILE="/mnt/swapFile.swap"

echo "Creating and formating a new swap file ..."

fallocate -l 1g ${SWAPFILE}
chmod 600 ${SWAPFILE}
echo "Formating the swap file ..."
mkswap ${SWAPFILE}
echo "Enabling the swap file ..."
swapon ${SWAPFILE}
echo "${SWAPFILE} swap swap defaults 0 0" | sudo tee -a /etc/fstab

DISK="/dev/disk/azure/scsi1/lun0"
PARTITION="/dev/disk/azure/scsi1/lun0-part1"
MOUNTPOINT="/datadisk"
Expand Down