Created
June 28, 2016 08:09
-
-
Save Strae/8c23e43ac097ae088dd633e72d17dd6c to your computer and use it in GitHub Desktop.
Cloudatcost CloudPro resize hard disk (Debian)
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
lastpart=`fdisk -l /dev/sda | grep sda |tail -1 |awk '{ print $1 }' |grep -o "[0-9]"` | |
newpart=`expr $lastpart + 1` | |
startsec=`parted /dev/sda unit s print free |tail -2 |grep Free |awk '{ print $1 }'` | |
endsec=`parted /dev/sda unit s print free |tail -2 |grep Free |awk '{ print $2 }'` | |
parted /dev/sda mkpart primary ext2 $startsec $endsec | |
parted /dev/sda set $newpart lvm on | |
partx -v -a /dev/sda | |
pvcreate /dev/sda$newpart | |
vgname=`vgdisplay |grep "VG Name" |awk '{ print $3 }'` | |
vgextend $vgname /dev/sda$newpart | |
lvPath=`lvdisplay |grep "LV Path" |grep -v swap |awk '{ print $3 } '` | |
lvextend -l+100%FREE $lvPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source
THIS ONE WORKS