btrfs icon indicating copy to clipboard operation
btrfs copied to clipboard

Mounting iso images causes all btrfs volumes being unreachable till reboot

Open ohno1052 opened this issue 1 year ago • 24 comments

Mounting ANY iso from ANY location (not only btrfs) causes this behavior. Volumes instantly disappear from win and i found no way of recovering access to them besides rebooting. Also, when you mount an iso from btrfs its content is still readable and completely fine even after volumes disappear. This behavior was noticed on w10 23h2 ltsc and w11 2263x.xxxx.

ohno1052 avatar May 15 '24 15:05 ohno1052

The same Windows 11: 22631.3958

vlad196 avatar Jul 27 '24 20:07 vlad196

@ohno1052, @vlad196: what software do you use to mount .iso files on your setups?

With the help of FileTypesMan v2.00 tool I get these verbs on my setup:

F:\Downloads\filetypesman-x64> FileTypesMan /SelectedExt .iso /stabular .iso.txt

F:\Downloads\filetypesman-x64> type .iso.txt
# Name               Caption              Default              Disabled             LastModified         CommandLine                                        ProcessFilename                             In_SysFileAssoc  RegKey     Extended   ProductName          ProductVersion       ProductDescription   CompanyName          RegKeyOwner

burn                 burn                 No                   No                   07/12/2019 12:17:46  %SystemRoot%\System32\isoburn.exe "%1"             C:\Windows\System32\isoburn.exe             No               HKEY_CLASS No         Microsoft® Windows®  10.0.19041.1 (WinBui Windows Disc Image B Microsoft Corporatio NT AUTHORITY\SYSTEM
mount                mount                Yes                  No                   07/12/2019 12:17:46  %SystemRoot%\Explorer.exe                          C:\Windows\Explorer.exe                     No               HKEY_CLASS No         Microsoft® Windows®  10.0.19041.2311 (Win Windows Explorer     Microsoft Corporatio NT AUTHORITY\SYSTEM
open                 open                 No                   No                   23/07/2024 12:48:03  "F:\Program Files (x86)\WinCDEmu\vmnt64.exe" "%1"  F:\Program Files (x86)\WinCDEmu\vmnt64.exe  No               HKEY_CLASS No         WinCDEmu             4.0                  WinCDEmu mounter     Sysprogs OU          BUILTIN\Administrato

(I added the # Name ... line by hand to make the output more clear)

To reproduce the bug, it would help to know the exact verb / command line that is engaged on your machines.

sskras avatar Jul 28 '24 09:07 sskras

In my case I double click an .iso file, and the Microsoft Virtual DVD-ROM with drive letter D: gets created:

C:\Windows\System32> wmic cdrom list brief
Caption                    Drive  Manufacturer              VolumeName
Microsoft Virtual DVD-ROM  D:     (Standard CD-ROM drives)  CR0SCD2_EN

Do you do the same?

sskras avatar Jul 28 '24 09:07 sskras

In my case I double click an .iso file, and the Microsoft Virtual DVD-ROM with drive letter D: gets created:

C:\Windows\System32> wmic cdrom list brief
Caption                    Drive  Manufacturer              VolumeName
Microsoft Virtual DVD-ROM  D:     (Standard CD-ROM drives)  CR0SCD2_EN

Do you do the same?

The same, default ISO virtual DVD-driver: My FileTypesMan output:

burn                 burn                 No                   No                   5/7/2022 7:28:03 AM  %SystemRoot%\System32\isoburn.exe "%1"                                                                                                                                                                                                                                                                                                        C:\Windows\System32\isoburn.exe                                                                      No         HKEY_CLASS No 
mount                mount                Yes                  No                   5/7/2022 7:28:03 AM  %SystemRoot%\Explorer.exe                                                                                                                                                                                                                                                                                                                     C:\Windows\Explorer.exe                                                                              No         HKEY_CLASS No 

I noticed that btrfs volume disappears regardless of where .iso file is. That is, if I open .iso from a non-BTRFS disk (ntfs, disk C;), the BTRFS disk will still disappear (disk D:). It's not a problem with one .iso, I've tried different images for the test. I think the problem is not related to the files on the btrfs disk, it is somewhere at the level of running a virtual DVD

Do you know how to check it?

vlad196 avatar Jul 28 '24 10:07 vlad196

The same, default ISO virtual DVD-driver: My FileTypesMan output:

Thanks for confirmation.

I noticed that btrfs volume disappears regardless of where .iso file is. That is, if I open .iso from a non-BTRFS disk (ntfs, disk C;), the BTRFS disk will still disappear (disk D:).

OK, that doesn't happen on my w10 21H2.

It's not a problem with one .iso, I've tried different images for the test. I think the problem is not related to the files on the btrfs disk, it is somewhere at the level of running a virtual DVD

Do you know how to check it?

Not really, I am just another user.

Looks like cdrom.sys or some upper driver is to blame. On my machine cdrom.sys version is 10.0.19041.1 (WinBuild.160101.0800):

image

Versions could be inspected using CLI too. Just in case, I checked versions of both cdrom.sys and cdfs.sys:

Microsoft Windows [Version 10.0.19044.3086]
(c) Microsoft Corporation. All rights reserved.

C:\Users\saukrs> powershell "gwmi Win32_SystemDriver | where {$_.Name -eq 'cdrom' -or $_.Name -eq 'cdfs' -or $_.Name -eq 'btrfs' } | select Name,Caption,@{n='Version';e={(gi $_.pathname).VersionInfo.FileVersion}},Pathname"

Name  Caption                   Version                                Pathname
----  -------                   -------                                --------
btrfs btrfs                     1.9.0                                  C:\Windows\system32\drivers\btrfs.sys
cdfs  CD/DVD File System Reader 10.0.19041.2130 (WinBuild.160101.0800) C:\Windows\system32\DRIVERS\cdfs.sys
cdrom CD-ROM Driver             10.0.19041.1 (WinBuild.160101.0800)    C:\Windows\system32\drivers\cdrom.sys

(They look pretty similar to me)

Knowing earliest failing versions might help to narrow down the regression. Especially if it comes from w10 23h2 ltsc as mentioned by @ohno1052.

EDIT: Updated the command to include version of btrfs.sys too. On my machine it's 1.9.0, and I think it's latest one.

sskras avatar Jul 28 '24 11:07 sskras

Not really, I am just another user. Then thank you for trying to help me understand what the problem is!

In my case, the driver versions are:

Name  Caption                   Version                                Pathname
----  -------                   -------                                --------
btrfs btrfs                     1.9.0                                  C:\Windows\system32\drivers\btrfs.sys
cdfs  CD/DVD File System Reader 10.0.22621.2506 (WinBuild.160101.0800) C:\Windows\system32\DRIVERS\cdfs.sys
cdrom CD-ROM Driver             10.0.22621.1 (WinBuild.160101.0800)    C:\Windows\system32\drivers\cdrom.sys

UPD I also have external DVD-rom, and when i unplug his, btrfs don't fall, when i open ISO image.

I hope this information will be useful for identifying the issue :)

vlad196 avatar Jul 28 '24 19:07 vlad196

I took driver versions and used the following pages to identify Windows builds reported in this issue:

(The build of @ohno1052 is seemingly very new and missing from the first page)

Build 19041 of my drivers corresponds with Windows 10, Version 2004. But I run Windows 10, Version 21H2 myself, so the drivers seemingly came here from this earlier build.

Name / Description Version Build Number Public Release
Windows 10, Version 21H2 10.0 19044 2021-11-16
Windows 11, Version 22H2 10.0 22621 2022-09-20
...
Windows 10, Version 23H2 10.0 19046.4236 2024-03-20

@vlad196, so the minimal known difference between working and affected Windows builds seems to be ~10 months.

sskras avatar Jul 29 '24 14:07 sskras

@sskras Great table, thank you!

I would make a disclaimer that in my case, the external DVD-ROM that was connected was to blame These two key points (connected physical DVD-ROM and launching a virtual DVD) are what break btrfs.

Unfortunately, @ohno1052 has not yet joined us and has not shared additional information. For example, does he have a DVD-ROM? Perhaps I have a different case, but with a similar outcome. Perhaps.

vlad196 avatar Jul 29 '24 14:07 vlad196

in my case, the external DVD-ROM that was connected was to blame These two key points (connected physical DVD-ROM and launching a virtual DVD) are what break btrfs.

Please excuse me for misunderstanding part of your previous reply. And thank you for kindly reminding.

For the sake of completeness, could you plug it back and share the output of wmic cdrom list brief (to see if it's present here), please?

sskras avatar Jul 29 '24 16:07 sskras

Please excuse me

Thank you for helping me understand the issue! 😊

For the sake of completeness, could you plug it back and share the output of wmic cdrom list brief (to see if it's present here), please?

Sure!

Caption                       Drive  Manufacturer                                                   VolumeName  

ASUS SDRW-08D2S-U USB Device         (Стандартные устройства чтения CD)              

vlad196 avatar Jul 29 '24 19:07 vlad196

What I find the most strange is that image content remains completely fine even when btrfs where it is actually located becomes completely inaccessible

Sure, but cdrom.sys + cdfs.sys + btrfs.sys already have the "coordinates" of your iso file (opened in the kernel mode) in the context of your hard disk. This is my guess why your access continues.

(in fact, this is the only way i found to actually retrieve things from isos, for example with game repacks: mount iso, copy all its contents to another drive, reboot and voilà).

In the meantime, may I suggest you to try another ODD emulator ?

  • https://wincdemu.sysprogs.org/ [*]
  • https://alternativeto.net/software/imdisk-virtual-disk-driver/about/ [*]
  • https://arsenalrecon.com/products/arsenal-image-mounter [*]
  • https://www.gburner.com/online-help/virtual-drive.htm
  • https://www.daemon-tools.cc/products/dtLite
  • https://www.elby.ch/en/products/vcd.html

[*] The open source projects !

sskras avatar Jul 30 '24 17:07 sskras

  • https://wincdemu.sysprogs.org/ [*]

Note that the project is long-dead and has become buggier by the month.

rautamiekka avatar Jul 30 '24 19:07 rautamiekka

(semi-offtopic about bugs in optical disk emulators)

@rautamiekka, true, WinCDEmu is not developed for 6y already. Still on my Microsoft Windows [Version 10.0.19044.3086] it works just fine. Just avoid the portable version (which has a minor bug re volume unload) – the installer version works just fine.

Also last version of ImDisk is 3y old too. But it still does fine on my PC.

I mounted 5 different ISO files (four of them have .img extensions, but I doubt it's significant) on 5 different optical disk emulators:

Microsoft Windows [Version 10.0.19044.3086]
(c) Microsoft Corporation. All rights reserved.

C:\Users\saukrs> wmic cdrom list brief
Caption                            Drive  Manufacturer              VolumeName
Microsoft Virtual DVD-ROM          E:     (Standard CD-ROM drives)  CRMSEVL_EN
WinCDEmu drive                     V:     (Standard CD-ROM drives)  CRMSXEVL_EN
Arsenal Virtual SCSI CdRom Device  H:     (Standard CD-ROM drives)  CR0SCD2_EN
gBurner Virtual DVD-ROM0000        D:     (Standard CD-ROM drives)  ReactOS

ImDisk doesn't emulate the optical drive, it works on the logical volume level, thus it's letter G: is absent here.

And my BTRFS volume stays perfectly mounted:

image

Now I start guessing if that has to do with my BTRFS volume staying on the system disk?

image

diskmgmt.msc shows no drive letter for the BTRFS volume, but that's probably a known issue.


(PS. I also fixed my previous comment about nearest working Windows build)

sskras avatar Jul 31 '24 06:07 sskras

(TL;DR) @ohno1052, @vlad196: does your BTRFS volume reside on a system disk & if not, is that disk drive removable?

sskras avatar Jul 31 '24 10:07 sskras

@sskras no, my disk instal like disk D for documents, movie, etc. And no, my disk not removable, plug trough SATA interface (even in UEFI turn off sata plug-and-play)

vlad196 avatar Jul 31 '24 11:07 vlad196

@vlad196 commented 8 hours ago:

my disk instal like disk D for documents, movie, etc. And no, my disk not removable, plug trough SATA interface

So you have two physical drives, and BTRFS volume(s) reside on the 2nd one – do I get it right? A screenshot of Disk Management window would probably help.

Alternatively you could just provide a built-in BTRFS-assigned partitions list (5) via BTRFS devices button (4) present on the Btrfs tab (3) of drive properties (2) window of any drive letter present by WinBtrfs (1), eg:

image

In my case it's a single partition. I guess your configuration will differ from mine and from configuration of @ohno1052.

sskras avatar Jul 31 '24 20:07 sskras

@sskras Here Disk Management and BTRFS-assigned partitions list: image image Disk 2 (Диск 2) it's another disk with the linux system.

vlad196 avatar Jul 31 '24 22:07 vlad196

OK, so in both problematic cases BTRFS occupies the whole disk having no partitions.

sskras avatar Jul 31 '24 23:07 sskras

@ohno1052, are all your BTRFS partitions aggregated into a single volume? If so, what is the data profile on that volume? This could be retrieved via button Show usage from properties page:

image

sskras avatar Aug 01 '24 00:08 sskras

this is a single partition i created it with mkfs.btrfs /dev/sda and then btrfs device add /dev/sdb /mnt btrfs device add /dev/sdc /mnt if this is easier to understand

Thanks. Was that done on Linux? (I would only argue about the terminology, and say the result is called not a partition, but a filesystem / a volume)

So setup of @vlad196 is simpler. I'll try to reproduce it once I get unused SATA drive.

sskras avatar Aug 01 '24 06:08 sskras