Last active
May 28, 2017 16:36
-
-
Save fragolinux/eeed40da305c93014847ed077ba0bbec to your computer and use it in GitHub Desktop.
expand the root partition and then its filesystem
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
# first part, enlarge partition to 100% | |
sudo apt-get install -y -qq parted | |
ROOT_DISK=$(sudo lsblk -s|grep -A1 \/$|grep -v \/$|tr -d "└─"|cut -d\ -f 1) | |
PART_NUM=$(sudo parted -l $ROOT_DISK|grep ext4|sed "s/^[ \t]*//"|cut -d\ -f 1) | |
sudo parted -s /dev/$ROOT_DISK unit % resizepart $PART_NUM 100% || sudo parted /dev/$ROOT_DISK unit % resizepart $PART_NUM Yes 100% | |
touch /forcefsck | |
sudo reboot | |
# second part, enlarge inside filesystem | |
ROOT_PART=$(sudo mount | sed -n 's|^/dev/\(.*\) on / .*|\1|p') | |
#sudo e2fsck -f /dev/$ROOT_PART | |
sudo resize2fs /dev/$ROOT_PART | |
sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment