20 lines
407 B
Bash
Executable file
20 lines
407 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# requires nbd kernel module and qemu-nbd program from qemu-utils package
|
|
|
|
export IFS=$'\t\n'
|
|
|
|
export MOUNT_DIR="/mnt/extract"
|
|
|
|
export IMAGE="$1"
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "No input provided. Provide a virtualbox .vdi as first parameter"
|
|
exit 1
|
|
fi
|
|
|
|
sudo modprobe nbd max_part=16
|
|
sudo qemu-nbd -c /dev/nbd0 "$IMAGE"
|
|
|
|
sudo mkdir -p "$MOUNT_DIR"
|
|
sudo mount -o ro /dev/nbd0p2 "$MOUNT_DIR"
|