Skip to content

Instantly share code, notes, and snippets.

@srs81
Created December 5, 2012 18:17
Show Gist options
  • Save srs81/4218104 to your computer and use it in GitHub Desktop.
Save srs81/4218104 to your computer and use it in GitHub Desktop.
Attach, format and mount a new EBS volume on an EC2 instance
# Variables
VOLUME=/dev/sdf
DIRECTORY=/var/www/html/
USER=apache
GROUP=apache
# Commands
mkfs -t ext4 $VOLUME
mount $VOLUME $DIRECTORY
echo "$VOLUME $DIRECTORY ext4 noatime 0 0" | sudo tee -a /etc/fstab
sudo chown -R $USER:$GROUP $DIRECTORY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment