Last active
April 13, 2016 07:56
-
-
Save drolfe/86f865d9fc2bab25224a1d44f30ae501 to your computer and use it in GitHub Desktop.
kvm disk form
This file contains 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/sh | |
### BEGIN INIT INFO | |
# Provides: form_disk | |
### END INIT INFO | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
case "$1" in | |
start) | |
/path/to/update/script | |
;; | |
stop|restart|reload) | |
;; | |
esac | |
##### below in seperate file ##### | |
before_reboot(){ | |
rm -f /etc/udev/rules.d/70-persistent-net.rules | |
(echo d; echo 2; echo n; echo p; echo 2; echo 1018 ; echo; echo t; echo 2; echo 8e; echo w ) | sudo fdisk /dev/vda | |
touch /var/run/rebooting-for-table-update | |
update-rc.d form_disk defaults | |
reboot | |
} | |
after_reboot(){ | |
pvresize /dev/vda2 | |
lvresize /dev/vg_centos6/lv_root /dev/vda2 | |
resize2fs /dev/mapper/vg_centos6-lv_root | |
rm /var/run/rebooting-for-table-update | |
update-rc.d form_disk remove | |
} | |
if [ -f /var/run/rebooting-for-table-update ]; then | |
after_reboot | |
else | |
before_reboot | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment