Skip to content

Instantly share code, notes, and snippets.

@DestyNova
Last active July 24, 2022 00:26
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 DestyNova/c089f0204c8446358732b76dd6d63d8d to your computer and use it in GitHub Desktop.
Save DestyNova/c089f0204c8446358732b76dd6d63d8d to your computer and use it in GitHub Desktop.
Mount PC-98 hard disk image (.hdi) in ./mnt
#!/usr/bin/env bash
# Commands taken from this very helpful guide:
# https://github.com/drojaazu/pc98_disks_in_linux/blob/main/README.md#mounting-hard-disks
set -euo pipefail
IMAGE=$1
mkdir mnt
OFFSET=$(expr `grep -Ebaom 1 "FAT1[2|6]" ${IMAGE} | sed -E 's/:FAT1[2|6]//g'` - 54)
LO_DEVICE=$(sudo losetup --show -fL -o ${OFFSET} ${IMAGE})
sudo mount -o rw $LO_DEVICE mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment