Created
April 25, 2015 13:21
-
-
Save dreamcat4/853032af79d063f4ee3e to your computer and use it in GitHub Desktop.
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/bash | |
fdisk_first() { | |
p2_start=`fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{print $2}'` | |
echo "Found the start point of mmcblk0p2: $p2_start" | |
fdisk /dev/mmcblk0 << __EOF__ >> /dev/null | |
d | |
2 | |
n | |
p | |
2 | |
$p2_start | |
p | |
w | |
__EOF__ | |
sync | |
touch /root/.resize | |
echo "Ok, Partition resized, please reboot now" | |
echo "Once the reboot is completed please run this script again" | |
} | |
resize_fs() { | |
echo "Activating the new size" | |
resize2fs /dev/mmcblk0p2 >> /dev/null | |
echo "Done!" | |
echo "Enjoy your new space!" | |
rm -rf /root/.resize | |
} | |
if [ -f /root/.resize ]; then | |
resize_fs | |
else | |
fdisk_first | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment