Skip to content

Instantly share code, notes, and snippets.

@sou
Last active February 15, 2018 11:33
Show Gist options
  • Save sou/53bdde24a6fbbe5bdc8a6a276294b09a to your computer and use it in GitHub Desktop.
Save sou/53bdde24a6fbbe5bdc8a6a276294b09a to your computer and use it in GitHub Desktop.
#!/bin/bash
FS=$(dumpe2fs /dev/xvdf | awk '/Filesystem magic number*/ { print $4 }')
if [ -z "$FS" ] || [ "$FS" != "0xEF53" ]; then
mkfs -t ext4 /dev/xvdf
fi
if [ -z "$(cat /etc/fstab | grep '/dev/xvdf')" ]; then
echo '/dev/xvdf /data ext4 defaults 1 1' >> /etc/fstab
mount -a
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment