Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Last active November 12, 2015 22:56
Show Gist options
  • Save raspberrypisig/db240138116c7806f46b to your computer and use it in GitHub Desktop.
Save raspberrypisig/db240138116c7806f46b to your computer and use it in GitHub Desktop.
Expand filesystem to fill up SD card on raspberry pi on non-raspbian distros like kali linux
sudo su
cat <<EOF > /etc/init.d/resize2fs_once
#!/bin/sh
### BEGIN INIT INFO
# Provides: resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5 S
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
# Description:
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting resize2fs_once" &&
resize2fs /dev/root &&
rm /etc/init.d/resize2fs_once &&
update-rc.d resize2fs_once remove &&
log_end_msg $?
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac
EOF
chmod +x /etc/init.d/resize2fs_once
update-rc.d resize2fs_once defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment