Skip to content

Instantly share code, notes, and snippets.

@badboy
Created November 27, 2012 07:07
Show Gist options
  • Save badboy/4152865 to your computer and use it in GitHub Desktop.
Save badboy/4152865 to your computer and use it in GitHub Desktop.
smartos-vmtools rc.local script for hdd-resizing.
reformat_disk() {
size=$(mdata-get sdc:disks.0.size)
swapsize=$(mdata-get swap_size)
size=$(echo ${size}-${swapsize} | bc)
cat <<EOF | fdisk /dev/vda
d
n
p
1
+${size}M
n
p
2
w
EOF
partprobe
}
# after reboot:
resize2fs /dev/vda1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment