Script to mount volumes on aws instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# note - /dev/xvdh that is what /dev/sdh is mapped to | |
devpath=$(readlink -f /dev/xvdh) | |
MNTPOINT=/images | |
sudo file -s $devpath | grep -q ext4 | |
if [[ 1 == $? && -b $devpath ]]; then | |
sudo mkfs -t ext4 $devpath | |
fi | |
sudo mkdir $MNTPOINT | |
#sudo chown riak:riak $MNTPOINT | |
sudo chmod 0775 $MNTPOINT | |
echo "$devpath $MNTPOINT ext4 defaults,nofail,noatime,nodiratime,barrier=0,data=writeback 0 2" | sudo tee -a /etc/fstab > /dev/null | |
sudo mount $MNTPOINT | |
echo deadline | sudo tee /sys/block/$(basename "$devpath")/queue/scheduler | |
echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment