Menu

#40 Allow multiple instances to read from the same image

Next
open
nobody
None
2019-03-28
2019-02-11
david_a00
No

As an easier way to support writing to multiple targets at the same time (feature 32), how about allowing multiple instances of Win32DiskImager to read from the same file? Right now it seems to lock the file for exclusive reads so two instances can't write the same file to two different drives. I only need to write to two USB drives at a time so a fancier solution isn't needed for my use case.

Discussion

  • Gabriel Espinoza

    yes you should remove the file lock, my computers has 4 usb ports and I can only write with one at a time, what a waste

     
  • Tobin Davis

    Tobin Davis - 2019-03-28

    Unfortunately, I have to put a lock on it otherwise Windows will be updating the filesystem as I am trying to read from the raw device (and Windows won't allow that). It would be like trying to read a file as you are formatting the media the file is sitting on.

    This is more of a Windows limitation, not an app limitation.

    The other part of this is that the mechanism to read from an image file vs a raw device is not separate code. The program passes a file handle to the read function. That handle can be either a file or a device. Even reading a file, the OS updates it (last access time). As we are doing a continuously streaming read/write (or verify), we need to ensure that the file doesn't change (hence the lock). If not locked, there is nothing to stop the user or the OS from changing/deleting the file while it is being read. This causes at a minimum stale file handles which are a PITA to clear up. Worst case is that the image will become corrupted mid write, or the filesystem that the file is sitting on could become dirty (requiring Windows to run a checkdisk to fix during reboot).

    While I hate to use this term, this is the 'simpler' way to do it.

     

    Last edit: Tobin Davis 2019-03-28

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.