Last active
May 29, 2016 01:14
-
-
Save adastreamer/96198ab88847658a5c49b37c2e542de3 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 | |
DEVICE_NAME=$(lsblk -nldo NAME | sort -r | head -1) | |
USAGE_COUNT=$(sudo pvdisplay -c | grep -c /${DEVICE_NAME}) | |
MOUNT_POINT=$1 | |
if [ -z $MOUNT_POINT ]; then | |
echo "NO MOUNT POINT SPECIFIED" | |
exit 1 | |
fi | |
if [[ $USAGE_COUNT != 0 ]]; then | |
echo "NO FREE DEVICES HERE!" | |
exit 1 | |
fi | |
echo -e "n\n\n\n\n\nw\n" | sudo fdisk /dev/${DEVICE_NAME} | |
sudo pvcreate /dev/${DEVICE_NAME}1 | |
sudo vgextend vg0 /dev/${DEVICE_NAME}1 | |
sudo lvextend -l +100%FREE vg0${MOUNT_POINT} | |
sudo resize2fs /dev/vg0${MOUNT_POINT} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment