Skip to content

Instantly share code, notes, and snippets.

@robertlabrie
Created July 5, 2016 15:15
Show Gist options
  • Save robertlabrie/c70cb9cd3bf3975dc19b147bb1a9e99f to your computer and use it in GitHub Desktop.
Save robertlabrie/c70cb9cd3bf3975dc19b147bb1a9e99f to your computer and use it in GitHub Desktop.
A bash script to automatically resize a disk ... because Centos6
#!/bin/bash
parted /dev/xvdf unit s print
#todo: detect OS type
start=`parted /dev/xvdf unit s print | grep primary | awk '{print $2}'`
echo $start
parted /dev/xvdf rm 1
parted /dev/xvdf mkpart primary ext4 2048s 100%
parted /dev/xvdf set 1 boot on
parted /dev/xvdf unit s print
e2fsck -f /dev/xvdf1
resize2fs -p /dev/xvdf1
mount /dev/xvdf1 /mnt
df -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment