My disk image won't mount in Win 10 unless I use OSFMount


  1. Posts : 44
    Windows 10 Pro (Version 20H2, Build 19042.867 )
       #1

    My disk image won't mount in Win 10 unless I use OSFMount


    Hello,

    I have followed all the guides on the internet about how to make Windows 10 mount a disk image but it won't mount MY own disk image I made myself.

    Just to illustrate what I am doing to make the.img file, here is a bash script I run in Linux:
    Code:
    #!/bin/bash
    #
    # Script to make a disk image file
    # Partition it and write a fat32 file system to it
    #
    
    
    cd /home/flex/scripts
    dd if=/dev/zero of=disk.img bs=1M count=100
    
    losetup -fP disk.img
    loopdevice=$(losetup -a | grep disk.img | awk '{print $1;}' | cut -f1 -d ":")
    echo $loopdevice
    echo $loopdevice"p1"
    
    parted -s $loopdevice mklabel msdos
    parted -s $loopdevice mkpart primary fat32 2048s 100%
    mkdosfs -F 32 $loopdevice"p1"
    
    gparted $loopdevice
    #losetup -d $loopdevice
    Basically I make a blank disk image and partition it and format it as fat32.

    Now if I put that disk.img file in Windows 10 and right click on it and go Open - With Windows Explorer I get the message: "Sorry, There was a problem mounting the file". I found this other tool: OSFMount and I can open the .img file with that just fine in Win 10.

    I also have the same problem if I use the linux dd command to copy a hard drive partition to a .img file. e.g:

    Code:
    dd if=/dev/sda1 of=partition1.img bs=1M status=progress
    I also can't just open that .img file in Windows by double clicking it or right clicking on it then Open-with Explorer Or selecting "Mount" from the menu. I just get an error message saying it could not be opened or it is corrupt or something. Whereas it WILL open in Win 10 with OSFMount and double clicking on it in Linux DOES open it just fine.

    Is there some special format I need to follow to author a disk image file so that I don't need to use OSFMount but instead
    just maybe double clicking on it will mount and open it in Windows 10 Explorer? Basically I want to put a load of files in a disk image and share it with someone but make it as simple as possible.

    Cheers,

    Flex
      My Computer


  2. Posts : 14,018
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #2

    It may depend upon the program used to make the .img file. I use only the .iso format and Roxio Easy CD & DVD Creator to do it and to burn .iso files to disc such as the Linux LiveDVD, GPARTED LiveCD, etc.
      My Computers


  3. Posts : 11,247
    Windows / Linux : Arch Linux
       #3

    Hi there

    @flexmcmurphy

    Arch Linux example (but should be similar in any distro)

    1) create a file of desired size e.g here 1GB and verify it

    [root@hestur hrafn]# dd if=/dev/zero of=loopbackfile.img bs=100M count=10
    10+0 records in
    10+0 records out
    1048576000 bytes (1.0 GB, 1000 MiB) copied, 0.894873 s, 1.2 GB/s
    [root@hestur hrafn]# du -sh loopbackfile.img
    1000M loopbackfile.img

    2) create the loopback device

    root@hestur hrafn]# losetup -a
    /dev/loop1: [2115]:2180 (/home/hrafn/loopbackfile.img) <===== example I'm using
    /dev/loop0: [2114]:33596511 (/root/file.img)
    [root@hestur hrafn]#

    3) create a file system on it

    mkdir /loopfs

    [root@hestur hrafn]# mkfs.xfs /home/hrafn/loopbackfile.img <======= using XFS but any file system is OK use fat32 if you like (mkfs.vfat -F32)
    meta-data=/home/hrafn/loopbackfile.img isize=512 agcount=4, agsize=64000 blks
    = sectsz=512 attr=2, projid32bit=1
    = crc=1 finobt=1, sparse=1, rmapbt=0
    = reflink=1 bigtime=0
    data = bsize=4096 blocks=256000, imaxpct=25
    = sunit=0 swidth=0 blks
    naming =version 2 bsize=4096 ascii-ci=0, ftype=1
    log =internal log bsize=4096 blocks=1566, version=2
    = sectsz=512 sunit=0 blks, lazy-count=1
    realtime =none

    4) Mount it and verify

    root@hestur hrafn]# mount -o loop /dev/loop1 /loopfs

    root@hestur hrafn]# df -hP /loopfs/
    Filesystem Size Used Avail Use% Mounted on
    /dev/loop0 994M 40M 955M 4% /loopfs

    root@hestur hrafn]# mount | grep loopfs
    /dev/loop1 on /loopfs type xfs (rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)

    Then you should be able to share that via SAMBA / SSH / FILEZILLA or whatever.

    However if you just want to share files why not simply attach an external HDD in Windows and enable sharing or share a directory on an existing Disk. You can copy an ISO to a disk directory if you need to share ISO type files anyway.

    If other people have Linux they can use SAMBA , FileZIlla or OPENSSH (service sshd). You may need to enable SMB1 as well on Windows depending on what the remote systems use / need.

    Note though if SENDING files from a Windows system i.e the remote (Linux) system is requesting files from you rather than you sending files to the remote system you need to install openssh server from the install optional features and enable the service to start automatically at boot.

    I'm not sure what creating a loopback device actually does for you for just sharing files.

    Cheers
    jimbo
    Last edited by jimbo45; 18 May 2021 at 04:20. Reason: Added parmeters for creating FAT32 file system
      My Computer


  4. Posts : 44
    Windows 10 Pro (Version 20H2, Build 19042.867 )
    Thread Starter
       #4

    Thanks alot Jimbo.

    Can Windows 10 open that .img file natively for you? Or do you have to use some other tool?

    That's what I am interested in. I don't understand why my Windows 10 does not natively mount a .img file I make myself as described in my initial post.

    Cheers,

    Flex
      My Computer


  5. Posts : 14,018
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #5

    Can you open the .img file in WinZip or 7-Zip?

    This may be of help even though it's for previous versions of Windows:
    https://www.techwalla.com/articles/h...les-in-windows
      My Computers


  6. Posts : 44
    Windows 10 Pro (Version 20H2, Build 19042.867 )
    Thread Starter
       #6

    My problem is not: how to open a .img file in Windows 10. I know how to do that with winzip or via these methods.

    My problem is: why does Windows 10 not open my .img file natively?

    According to that link it should be possible but it does not. Yes I can open my .img file with WinZip and like I said in my first post I can also use OSFMount. But my goal is not to open the .img file by any means, my goal is that Windows 10 will open the .img file so I don't need to use any other tools or preferably any method other than just double clicking on the file.

    I was asking @jimbo45 there if he had any luck opening his .img file in his Windows 10 or if his Windows 10 is unable to open that .img file he made even though it supposedly can do this natively... but can't actually.

    Cheers,

    Flex
    Last edited by flexmcmurphy; 19 May 2021 at 04:08.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:59.
Find Us




Windows 10 Forums