aboutsummaryrefslogtreecommitdiffstats
path: root/tools/resize_root.sh
blob: 59a961f0edaeb38d7275ffd58ada32f768cceffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

DEVICE="/dev/mmcblk0"
ROOT_PARTITION="${DEVICE}p1"
ROOT_PARTITION="1"

echo "Warning : this an early version to resize the root partition. Check the source code to ensure what you are doing."
if [ ${1} = "force" ]; then
    #Check dependency
    hash growpart
    if [ ${?} -ne 0 ]; then
        echo "install cloud-utils-growpart first. Hint : dnf install cloud-utils-growpart"
        exit 1
    fi

    #Check the partition :
    e2fsck -f ${ROOT_PARTITION}

    #Change the size : BUG: app doesn't support "octet".
    LC_ALL=C growpart ${DEVICE} ${ROOT_PARTITION}

    #Resize the partition with the new size :
    resize2fs ${ROOT_PARTITION} 

    #Sync (just to be sure)
    sync
else
    echo "If you read the source code, you should not have read that message... Exiting with out touching the partition."
fi

#Quit
exit 0