February 17, 20179 yr I'm playing with VM's and would like to access a disk image file directly. The VM is Windows 7. The filesystem should be NTFS. If I use Windows 10 file explorer and right click vdisk1.img and select "Mount" I receive the error message "The disc image file is corrupted." If I try to mount from the unRAID console: mount -r -t ntfs -o loop /mnt/disks/Windows/vdisk1.img /mnt/test I get NTFS signature is missing. Failed to mount '/dev/loop2': Invalid argument What am I doing wrong?
February 17, 20179 yr The normal thing would be to go into the settings for the VM and assign the vdisk file as an additional drive.
February 17, 20179 yr Author Wouldn't I need to setup a 2nd VM using a different vdisk to do that? I'd rather mount the vdisk.img if I can get the syntax correct.
February 18, 20179 yr Wouldn't I need to setup a 2nd VM using a different vdisk to do that? I'd rather mount the vdisk.img if I can get the syntax correct. you can have multiple vdisk files assigned to a VM (just like you can have multiple physical disks on a physical PC). Trying to mount it the way you have been trying is not that easy as the mount process has to be one that understands the internal structure of the vdisk.
February 18, 20179 yr Author I understand multiple vdisks. I guess what I am saying is this vdisk holds the OS. In order to add it as an additional drive, I need to create another VM and use a different bootable vdisk, then add the secondary. With VMware, I would do something like this to map the disk to Z:\ allowing me to directly read/write data: vmware-mount /m:w z: "c:\vm\win7\win7.vmdk" Obviously we're not dealing with VMware here, but I'm looking to achieve a similar solution. Trying to mount it the way you have been trying is not that easy as the mount process has to be one that understands the internal structure of the vdisk. How do I approach getting them to understand each other?
February 19, 20179 yr Author Solution I figured it out. I needed to specify the byte offset of where the partition begins. For anyone who might have the same question in the future, here is what I did. From the unRAID command console, display partition information of the vdisk: fdisk -l /mnt/disks/Windows/vdisk1.img I was after the values in red. The output will looks something like this: [pre]Disk vdisk1.img: 20 GiB, 21474836480 bytes, 41943040 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xda00352d Device Boot Start End Sectors Size Id Type vdisk1.img1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT vdisk1.img2 206848 41940991 41734144 19.9G 7 HPFS/NTFS/exFAT[/pre] To find the offset in bytes, multiply the sector start value by the sector size to get the offset in bytes. In this case, I wanted to mount vdisk1.img2. 206848 * 512 = 105906176 Final command to mount the vdisk NTFS partition as read-only: mount -r -t ntfs -o loop,offset=105906176 /mnt/disks/Windows/vdisk1.img /mnt/test
February 1, 20206 yr Automating mounting disk images would be a nice addition to a plugin like Unassigned Devices... @dlandon Edited February 1, 20206 yr by Dav3
April 28, 20215 yr On 2/1/2020 at 1:15 AM, Dav3 said: Automating mounting disk images would be a nice addition to a plugin like Unassigned Devices... @dlandon +1 / bump Yes it would 😉 I am using: expr [sector size value] \* [start sector value] in Windows Terminal when ssh-ing into my Unraid server. I doubleclick on the values, richtclick to quickly copy and again rightclick to quickly paste on the cursor spot for quickly calculating and copying the result with all those quickclicks I just mentioned for the offset part of the ``mount`` command line. It's the quickest way I know. - and I sound like a duck right now 🤣 It would be nice to have a GUI to mount an img file and select the disks in the vdisk img without doing the procedure above. Edited April 28, 20215 yr by Ymetro forgot to mention Windows Terminal to SSH into Unraid server from my Windows 10 PC
February 6, 20251 yr I have taken a script from https://www.howtogeek.com/devops/how-to-mount-a-qemu-virtual-disk-image/ and modified it so it works with my disk image: #!/bin/bash # set -x # Set debug mode image=/mnt/disks/WSC2LFGJ/Backups/Me/PC/Drives/c.img mount=/mnt/disks/c partition_offset=240123904 # Get partition information echo "=== Partition Information ===" fdisk -l "$image" start=$(fdisk -l "$image" | grep '^/'"$image"'3' | awk '{print $2}') # Get NTFS partition start sector (partition 3) echo "\nNTFS Partition Start Sector: $start" sectors=$(fdisk -l "$image" | grep '^Units:' | awk '{print $5}' | cut -d',' -f1) # Show sector size echo "Sector size: $sectors" offset=$((start * sectors)) # Calculate offset echo "Calculated offset: $offset" mkdir $mount # Try mounting with verbose output # mount -v -r -o loop,offset=$offset "$image" $mount mount -r -t ntfs -o loop,offset=$partition_offset "$image" $mount Edited February 6, 20251 yr by Bluscream
July 29, 2025Jul 29 Okay, with the help of cursor, ive modified this even further; find the scripts here:https://github.com/Bluscream/Scripts/blob/7f71d301da15391585264c1ca6e7ed8ef7f82b79/unraid/config/plugins/user.scripts/scripts/image-disk/script https://github.com/Bluscream/Scripts/blob/7f71d301da15391585264c1ca6e7ed8ef7f82b79/unraid/config/plugins/user.scripts/scripts/mount-image/scripthttps://github.com/Bluscream/Scripts/blob/7f71d301da15391585264c1ca6e7ed8ef7f82b79/unraid/config/plugins/user.scripts/scripts/mount-images/scriptbasically#!/bin/bash SCRIPT_PATH="/boot/config/plugins/user.scripts/scripts/mount-image/script" if [[ ! -f "$SCRIPT_PATH" ]]; then echo "Error: Mount script not found at $SCRIPT_PATH" exit 1 fi if [[ $EUID -ne 0 ]]; then echo "Error: This script must be run as root (use sudo)" exit 1 fi mount_image() { echo "=== Mounting $1 ===" # bash "$SCRIPT_PATH" info --image "$1" bash "$SCRIPT_PATH" mount --image "$1" --partition "$2" --readonly & echo " Background process started (PID: $!)" echo } bash "$SCRIPT_PATH" unmount rm -rf /mnt/images/*/ # Mount specific partitions using their actual labels mount_image "/mnt/user/backups/xxx/PC/Drives/xxx-pc.img" "Win 11 Pro" mount_image "/mnt/user/backups/xxx/Laptop/drives/xxx-laptop.img" "Windows" mount_image "/mnt/user/backups/xxx/Server/HomeAssistant/HASS_USB.img" "hassos-data" # mount_image "/mnt/user/backups/xxx/Server/HomeAssistant/hass-sd_broken.img" "HomeAssistant SD" echo "=== All mount operations started in background ===" echo "Each mount process is waiting for Enter key to unmount" echo "To unmount all disks at once, run: $SCRIPT_PATH unmount" echo "To check mounted disks, run: $SCRIPT_PATH list" echo echo "Background processes:" jobs Edited July 29, 2025Jul 29 by Bluscream
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.