Created
October 10, 2024 14:06
-
-
Save dakhnod/11f34b9fd033e6688b312881ce6103f9 to your computer and use it in GitHub Desktop.
Utility to mount a partition from a disk image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [[ ! "$1" || ! "$2" || ! "$3" ]]; then | |
| echo "Usage: mount_file IMAGE PARTITION_NUMBER MOUNTPOINT" | |
| exit 1 | |
| fi | |
| line=(`fdisk -l "$1" | tr -d '*' | grep "$1$2"`) | |
| mount -o loop,offset=$((512 * ${line[1]})),sizelimit=$((512 * ${line[3]})) $1 $3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment