How to refresh DVD's directory listing after burning files onto the DVD?

gyoungdahl

Distinguished
Jul 26, 2011
19
0
18,510
I have an app (a Perl script that I wrote) that writes files to a DVD/RW disk on a recurring (daily) basis. The idea is that the data is collected and a new file is burned each day. On my old computer (a desktop system) I had to use an eject and then a load command to "refresh" Windows' directory data for the disk and see the latest directory content. Without the eject/load cycle (where the disk tray is pushed out and then drawn back in) the prior directory of the disk (when first inserted) continues to display after the burn. That worked fine, but now I have a new laptop with the "pop out" DVD drive, and it can't draw the disk back in after ejecting it without manual assistance. Since the objective is to have unattended collection for several days, the need for a manual assist to push the disk back in doesn't work.
So, my question is whether there is some command (or sequence of commands) that can perform the same effect as ejecting the disk and loading it again, so that I can see the latest files on the disk and know what files are there and how much space is left on the disk? I would expect that there should be some way to accomplish this, but after much research I don't seem to come up with any clue. I gather that there is data cached in Windows somewhere about the directory information, and it doesn't get updated without the physical "replacement" of the disk. So perhaps there is a Windows function that I need to kick to get it to reread the disk without physically moving the tray?
I've tried the -reset option, but apparently that is just a reset to the "SCSI bus". It doesn't change anything about the directory listing.
In case it matters, I'm using cygwin and its wodim disk burning application. I burn the new file to the disk. The burn is successful, but if I do a DIR on the drive it reports the previous file list/sizes. If I manually eject the DVD and insert it again, then the newly burned file shows up. If I needed to write some little app that could tickle Windows into re-reading the disk's data, and call that at the appropriate time from my Perl script, that would be a fine solution. A friend suggested that perhaps uninstalling/reinstalling the drive might accomplish it, but that seems like an extreme way to attack what seems like should be a common problem with an "obvious" (?) solution.

Thanks,
--
Greg
 

gyoungdahl

Distinguished
Jul 26, 2011
19
0
18,510
No, didn't realize that could be an option - in a Unix/Linux environment I might have thought of that, but presumably (given your suggestion) with cygwin it can happen with Windows. I will try it and report back. Thanks for the suggestion.
 

gyoungdahl

Distinguished
Jul 26, 2011
19
0
18,510
I tried several ways of specifying what I wanted unmounted (D:, D:/, D:\, /cygdrive/d, /cygdrive/d/ to name a few), all of which result in an "Invalid argument" error response.

Typing just mount (to see what is mounted), I get several lines. The line for the DVD drive is:

D: on /cygdrive/d type iso9660 (binary,posix=0,user,noumount,auto)

There are a handfull of /cygdrive mounted drives (including C:, of course, and a couple others), all with similar options. Particularly "noumount" seems like it might be problematic.

If I manually eject the drive (with the pushbutton on the drive) that entry goes away, and it comes back after the drive door is closed.

I'm trying this from an administrative user account, but not the administrator account. Perhaps that can help me to have permission to do the umount. Or perhaps there is some override option or something. I'll continue trying. If someone knows the umount magic incantation, or of another avenue to try, I'm still interested.

Thanks,
--
Greg
 

gyoungdahl

Distinguished
Jul 26, 2011
19
0
18,510
Thanks, those links have some thorough descriptions. However, neither mentions the "noumount" mounting option. It does show up in their outputs of mount commands, but no mention of that option in the descriptive text. My current theory is that the noumount option is foiling my unmounting attempts.

It does seem like this has some potential for resolving my problem (it certainly seems promising if I can get it figured out), but I just want to reiterate my issue in case there may be some other resolution (before this just turns into a mount/umount discussion).

The core issue I need is to somehow see (at least, and possibly access) the files burned onto the DVD after the burn has completed. Currently there is an eject and load cycle pushing the tray out and pulling it back in, but my laptop can't automatically pull the tray back in without human intervention. It would seem that there should be a way to access the files after they are burned, that's what I need to figure out.

I'm not giving up yet on umount/mount - but if there are other options I'd still consider them.

Thanks,
--
Greg
 

gyoungdahl

Distinguished
Jul 26, 2011
19
0
18,510
I generally use Linux in a non-virtual environment. Unfortunately there are times when I must resort to Windows, so I want a coherent toolset there. Hence cygwin. The idea of running a "virtual" Linux on top of a Windows installation makes me crazy :) Lets take something stable and secure and run it on top of something erratic and insecure. Seems backward to me.

Back to the point... My /etc/fstab has only a single line to set up /cygdrive. I do have mtab that shows all the mounts, but of course that is just a status of what is mounted, not a configuration file of what is to be mounted. I will have to discover what is mounting the D: drive (my DVD burner). Perhaps I can expunge the noumount there and see if an unmounting followed by a mounting will update the DVD's directory listing.
 

gyoungdahl

Distinguished
Jul 26, 2011
19
0
18,510
OK, well I'm still not sure where the noumount option is being specified, but I've tried using some Windows operations. There is a Windows (not cygwin) mountvol command that allows listing of Windows idea of the "Volume ID":

mountvol D: /L

The /L option (maybe "list"?) returns some giberish which Windows apparently thinks of as the DVD's (on drive D:) Volume ID...

\\?\Volume{8650b018-4047-11e5-94cc-806e6f6e6963}\

So once you have that result (I saved it as VOLID) you can then use the /D option to "dismount" (un-mount) the DVD drive...

mountvol D: /D

and then mount it again:

mountvol D: %VOLID%

(where VOLID is set to the string of giberish Volume ID from the first step).

So, those steps above unmount the drive (I verified that it no longer shows up in Windows Explorer), and then mounts it again (and it is back in Windows Explorer). But still it has the old directory data! I even changed the remount step to specify a free drive letter (I used 'M') to mount it, and it shows up as M: with the old directory information!!!

But once I "eject" (release) the drive and push it back in I get the proper (new) directory list.

I don't know, but it almost seems like the drive is caching the directory information and won't recognize the new content until a physical eject occurs. I assumed that remounting it as M: ought to result in a fresh version of the drive's content. Since it didn't, I'm wondering if I need to somehow instruct the drive to refresh its directory information. A way that doesn't require a physical ejection of the DVD.

I guess I still need to chase down where the "noumount" option is coming from, but I fear that it isn't going to be my silver bullet, since even using mountvol (which presumably doesn't have any inkling of cygwin's mounting parameters) to mount the device as a different drive letter didn't get a fresh directory list.