Created
January 25, 2013 19:27
-
-
Save javierwilson/4637104 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 | |
if [ -z $1 ]; then | |
echo "Usage: $0 <virtual_machine_name>" | |
exit | |
fi | |
VM=$1 | |
HOMEIMG=/home/$VM | |
OLDDISK=$HOMEIMG/$VM.img | |
NEWDISK=$HOMEIMG/$VM.new.img | |
PART=/dev/sda2 | |
LVPART=/dev/vg/lv_root | |
ADD="+70G" | |
# Look at current sizing | |
# virt-filesystems --long --parts --blkdevs -h -a $OLDDISK | |
# Create output disk. Virt-resize cannot do in-place disk modifications :( | |
echo "Creating $NEWDISK..." | |
truncate -r $OLDDISK $NEWDISK | |
truncate -s $ADD $NEWDISK | |
echo "Resizing..." | |
virt-resize --expand $PART --LV-expand $LVPART $OLDDISK $NEWDISK | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment