Created
June 10, 2015 13:34
-
-
Save ricfeatherstone/3f87ad1c70bfa887a21f to your computer and use it in GitHub Desktop.
Automate expanding a mounted partition
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
#!/bin/bash | |
dir=$1 | |
device=$2 | |
partition=$3 | |
start=$4 | |
end=$5 | |
umount /$dir | |
parted /dev/$device <<EOF | |
rm $partition | |
mkpart primary $start $end | |
quit | |
EOF | |
xfs_repair /dev/$device$partition | |
mount /dev/$device$partition /$dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the CIS RHEL base image in AWS to expand /tmp to new EBS volume size
/tmp is mounted on xvdj1 which starts at 1049kb.
expand_mounted_partition tmp xvdj 1 1 100%