dboonthego Posted February 17, 2017 Share Posted February 17, 2017 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? Quote Link to comment
itimpi Posted February 17, 2017 Share Posted February 17, 2017 The normal thing would be to go into the settings for the VM and assign the vdisk file as an additional drive. Quote Link to comment
dboonthego Posted February 17, 2017 Author Share Posted February 17, 2017 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. Quote Link to comment
itimpi Posted February 18, 2017 Share Posted February 18, 2017 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. Quote Link to comment
dboonthego Posted February 18, 2017 Author Share Posted February 18, 2017 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? Quote Link to comment
Solution dboonthego Posted February 19, 2017 Author Solution Share Posted February 19, 2017 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 5 3 Quote Link to comment
Dav3 Posted February 1, 2020 Share Posted February 1, 2020 (edited) Automating mounting disk images would be a nice addition to a plugin like Unassigned Devices... @dlandon Edited February 1, 2020 by Dav3 1 1 Quote Link to comment
Ymetro Posted April 28, 2021 Share Posted April 28, 2021 (edited) 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, 2021 by Ymetro forgot to mention Windows Terminal to SSH into Unraid server from my Windows 10 PC Quote Link to comment
Recommended Posts
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.