Created
February 20, 2025 06:23
-
-
Save hayamiz/c5683110078d7801d68d07f65595900c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
#Check if we're on an NVMe filesystem | |
if [ -b "/dev/xvda" ] && [ $(readlink -f /dev/xvda) = "/dev/xvda" ] | |
then | |
# Rewrite the partition table so that the partition takes up all the space that it can. | |
sudo growpart /dev/xvda 1 | |
# Expand the size of the file system. | |
# Check if we are on AL2 | |
STR=$(cat /etc/os-release) | |
SUB="VERSION_ID=\"2\"" | |
if [[ "$STR" == *"$SUB"* ]] | |
then | |
sudo xfs_growfs -d / | |
else | |
sudo resize2fs /dev/xvda1 | |
fi | |
else | |
# Rewrite the partition table so that the partition takes up all the space that it can. | |
sudo growpart /dev/nvme0n1 1 | |
# Expand the size of the file system. | |
# Check if we're on AL2 | |
STR=$(cat /etc/os-release) | |
SUB="VERSION_ID=\"2\"" | |
if [[ "$STR" == *"$SUB"* ]] | |
then | |
sudo xfs_growfs -d / | |
else | |
sudo resize2fs /dev/nvme0n1p1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment