Skip to content

Instantly share code, notes, and snippets.

@DestyNova
Last active July 24, 2022 00:26
Show Gist options
  • Save DestyNova/c089f0204c8446358732b76dd6d63d8d to your computer and use it in GitHub Desktop.
Save DestyNova/c089f0204c8446358732b76dd6d63d8d to your computer and use it in GitHub Desktop.

Revisions

  1. DestyNova revised this gist Jul 24, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mount-hdi.sh
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,4 @@ OFFSET=$(expr `grep -Ebaom 1 "FAT1[2|6]" ${IMAGE} | sed -E 's/:FAT1[2|6]//g'` -

    LO_DEVICE=$(sudo losetup --show -fL -o ${OFFSET} ${IMAGE})

    sudo mount $LO_DEVICE mnt
    sudo mount -o rw $LO_DEVICE mnt
  2. DestyNova created this gist Jul 24, 2022.
    16 changes: 16 additions & 0 deletions mount-hdi.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/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 $LO_DEVICE mnt