Skip to content

Instantly share code, notes, and snippets.

@WillNilges
Last active June 18, 2020 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillNilges/ec34a1c6eaff2040dc6464e65bf4628f to your computer and use it in GitHub Desktop.
Save WillNilges/ec34a1c6eaff2040dc6464e65bf4628f to your computer and use it in GitHub Desktop.
This simple script will mount a raspberry pi image on your computer so you can mess with it.
#!/bin/bash
headstart=$(sudo fdisk -l $1 | grep img2 | awk -F" " '{ print $2 }')
echo $headstart
if [ -z ${2+x} ]; then
mountpoint='/mnt/raspberry'
else
mountpoint=$2
fi
sudo mkdir $mountpoint
sudo mount -v -o offset=$(expr 512 \* $headstart) -t ext4 $1 $mountpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment