-
-
Save snallami/ddd598917cf60fcc6c2856a75235e439 to your computer and use it in GitHub Desktop.
Mount i3 ephermal disk
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
create_cachefs() { | |
echo "${FUNCNAME[0]}" | |
BLOCK_DEVICE='/dev/nvme0n1' | |
NVME_CACHE_MOUNT_POINT='/cache-fs' | |
SERVICE_USER_NAME='tooladmin' | |
# Only set this up if we have an nvme ephemeral | |
if [[ ! -e ${BLOCK_DEVICE} ]] ; then | |
echo "FAILURE: Service needs a specific amazon instance type" | |
return 1 | |
fi | |
# g create a new empty GPT partition table | |
# n creates a new partition. | |
# p indicates that it's a primary partition being created. | |
# 1 indicates that it should be primary partition | |
# the following blank line accepts the default end sector | |
# w writes changes to disk. | |
(echo g; echo n; echo p; echo 1; echo ; echo; echo w) | fdisk ${BLOCK_DEVICE} || return 1 | |
sleep 10 | |
#create file system | |
mkfs.ext4 -F ${BLOCK_DEVICE} || return 1 | |
mkdir "${NVME_CACHE_MOUNT_POINT}" || return 1 | |
mount ${BLOCK_DEVICE} "${NVME_CACHE_MOUNT_POINT}" || return 1 | |
# Create required folders | |
mkdir -p ${NVME_CACHE_MOUNT_POINT}/tmp | |
chmod 777 "${NVME_CACHE_MOUNT_POINT}" || return 1 | |
chown -R "${SERVICE_USER_NAME}":"${SERVICE_USER_NAME}" "${NVME_CACHE_MOUNT_POINT}" || return 1 | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment