Skip to content

Instantly share code, notes, and snippets.

@ricfeatherstone
Created June 10, 2015 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricfeatherstone/3f87ad1c70bfa887a21f to your computer and use it in GitHub Desktop.
Save ricfeatherstone/3f87ad1c70bfa887a21f to your computer and use it in GitHub Desktop.
Automate expanding a mounted partition
#!/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
@ricfeatherstone
Copy link
Author

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%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment