Skip to content

Instantly share code, notes, and snippets.

@rakor
Last active February 3, 2018 20:09
Show Gist options
  • Save rakor/3aec8c23a61f36734bbe20bdd637351f to your computer and use it in GitHub Desktop.
Save rakor/3aec8c23a61f36734bbe20bdd637351f to your computer and use it in GitHub Desktop.
#!/bin/sh
DEVICE=mmcblk0
PARTITIONNUMBER=2
ROOTPART="$DEVICE"p"$PARTITIONNUMBER"
DEVMAXSIZE=$(cat "/sys/block/$DEVICE/size")
ROOTEND=$((DEVMAXSIZE -1))
parted -m "/dev/$DEVICE" u s resizepart $PARTITIONNUMBER yes "$ROOTEND"
partprobe "/dev/$DEVICE"
resize2fs "/dev/$ROOTPART"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment