Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect whether filesystem has been expanded #64

Open
wtluke opened this issue May 28, 2016 · 1 comment
Open

Detect whether filesystem has been expanded #64

wtluke opened this issue May 28, 2016 · 1 comment

Comments

@wtluke
Copy link

wtluke commented May 28, 2016

Hi,

On my Pi setup/installation script, I use raspi-config --expand-rootfs but would like to tell whether or not the filesystem has been expanded, so that it doesn't repeatedly try to do it (when it has already been done).

Trawled through github without luck. I could create a temp file when it's been done, before rebooting, but wondered if anyone could help with something more comprehensive using df

Ideas welcome

Thanks

@remisarrailh
Copy link

I don't know if it is the correct way to do this but here is a script I made to check if a SD card is resized. If someone has a better method, i'm interested :-)

# Check if there is free space on the SD card
unusedDisk=$(parted /dev/mmcblk0 unit GB print free | grep 'Free Space' | tail -n1 | awk '{print $3}')
if [[ ! $unusedDisk == "0.00GB" ]];then
        raspi-config --expand-rootfs #If not run raspi-config unattended
else
        echo "SD card already resized"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants