Last active
July 8, 2022 19:22
-
-
Save drewyangdev/99b991c80a57931e18c85126ef186704 to your computer and use it in GitHub Desktop.
Deal with EC2 GPT volumes that can resize to more than 2TB
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 | |
## Use lsblk check device, usually e.g "/dev/xvdf", "/dev/nvme1n1" | |
## Partition will be "/dev/xvdf1", "/dev/nvme1n1p1" | |
## e.g sudo bash linux_gpt_volume.sh "/dev/nvme1n1" "/dev/nvme1n1p1" "/mnt/gpt-volume" | |
export DEVICE=$1 | |
export PARTITION=$2 | |
export MOUNT_DIR=$3 | |
parted $DEVICE --script mklabel gpt | |
parted $DEVICE --script mkpart primary 2048s 100% | |
mkfs -t ext4 $PARTITION | |
mkdir -p $MOUNT_DIR | |
mount $PARTITION $MOUNT_DIR | |
df -Th |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment