Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remounting BTRFS file system requires a reboot (after a successful dismount) #665

Open
sskras opened this issue Jun 11, 2024 · 3 comments
Open

Comments

@sskras
Copy link

sskras commented Jun 11, 2024

(everything CLI done from the elevated MSYS2 environment in this report)

I have a spare partition formatted to NTFS and mounted as E:.

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DriveLetter = 'E:'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity      DeviceID                                           DriveLetter  FileSystem  Label
244047671296  \\?\Volume{b653c32e-f770-4464-a9aa-d04dc6425286}\  E:           NTFS        skirsnis

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{b653c32e-f770-4464-a9aa-d04dc6425286}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity      DeviceID                                           DriveLetter  FileSystem  Label
244047671296  \\?\Volume{b653c32e-f770-4464-a9aa-d04dc6425286}\  E:           NTFS        skirsnis
I can dismount it and then remount it successfully.

  • dismounting NTFS volume is OK:
saukrs@DESKTOP-O7JE7JE MSYS ~
$ mountvol E: /P
The volume is still in use.  A force dismount was issued and current handles
to the volume have been invalidated.

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{b653c32e-f770-4464-a9aa-d04dc6425286}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity  DeviceID                                           DriveLetter  FileSystem  Label
          \\?\Volume{b653c32e-f770-4464-a9aa-d04dc6425286}\
  • remounting NTFS volume is OK:
saukrs@DESKTOP-O7JE7JE MSYS ~
$ mountvol E: '\\?\Volume{b653c32e-f770-4464-a9aa-d04dc6425286}\'

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{b653c32e-f770-4464-a9aa-d04dc6425286}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity      DeviceID                                           DriveLetter  FileSystem  Label
244047671296  \\?\Volume{b653c32e-f770-4464-a9aa-d04dc6425286}\  E:           NTFS        skirsnis


saukrs@DESKTOP-O7JE7JE MSYS ~
$ cmd /c dir /s E:
 Volume in drive E is skirsnis
 Volume Serial Number is 66F6-8D31

 Directory of E:\System Volume Information

11/06/2024  10:42                76 IndexerVolumeGuid
11/06/2024  10:42                12 WPSettings.dat
               2 File(s)             88 bytes

     Total Files Listed:
               2 File(s)             88 bytes
               0 Dir(s)  243,940,261,888 bytes free
But if I format it to Btrfs ...

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{b653c32e-f770-4464-a9aa-d04dc6425286}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity      DeviceID                                           DriveLetter  FileSystem  Label
244047671296  \\?\Volume{b653c32e-f770-4464-a9aa-d04dc6425286}\  E:           NTFS        skirsnis


saukrs@DESKTOP-O7JE7JE MSYS ~
$ format.com E: /q /fs:btrfs
The type of the file system is NTFS.
The new file system is BTRFS.
Enter current volume label for drive E: skirsnis

WARNING, ALL DATA ON NON-REMOVABLE DISK
DRIVE E: WILL BE LOST!
Proceed with Format (Y/N)? Y
QuickFormatting 227.3 GB

Format cannot run because the volume is in use by another
process.  Format may run if this volume is dismounted first.
ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
Would you like to force a dismount on this volume? (Y/N) Y
Volume dismounted.  All opened handles to this volume are now invalid.
BitLocker encryption and the encrypted data on the volume has been removed.
You may enable BitLocker again after formatting is complete.


saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DriveLetter = 'E:'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity      DeviceID                                           DriveLetter  FileSystem  Label
244047675392  \\?\Volume{0869fa25-bd66-7074-6498-7f4d08d64db0}\  E:           Btrfs

(please note the changed volume UUID)

.... this sequence breaks,

  • dismounting Btrfs volume is OK:
saukrs@DESKTOP-O7JE7JE MSYS ~
$ mountvol E: /P

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{0869fa25-bd66-7074-6498-7f4d08d64db0}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity  DeviceID                                           DriveLetter  FileSystem  Label
          \\?\Volume{0869fa25-bd66-7074-6498-7f4d08d64db0}\
  • remounting Btrfs volume fails:
saukrs@DESKTOP-O7JE7JE MSYS ~
$ mountvol E: '\\?\Volume{0869fa25-bd66-7074-6498-7f4d08d64db0}\'

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{0869fa25-bd66-7074-6498-7f4d08d64db0}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity  DeviceID                                           DriveLetter  FileSystem  Label
          \\?\Volume{0869fa25-bd66-7074-6498-7f4d08d64db0}\

saukrs@DESKTOP-O7JE7JE MSYS ~
$ cmd /c dir /s E:
The device is not ready.

The result I see in File Explorer:

BTRFS-ghost-drive-letter-after-volume-dismount-v2


Looks like WinBtrfs doesn't receive / fails to handle some mounting request.

@sskras
Copy link
Author

sskras commented Jun 11, 2024

Now if I try to reformat it to NTFS, this fails too:

saukrs@DESKTOP-O7JE7JE MSYS ~
$ format.com E: /q /fs:ntfs
The type of the file system is RAW.
The new file system is NTFS.

WARNING, ALL DATA ON NON-REMOVABLE DISK
DRIVE E: WILL BE LOST!
Proceed with Format (Y/N)? Y
QuickFormatting 227.3 GB
Volume label (32 characters, ENTER for none)? ntfs-vol
Creating file system structures.
Incorrect write at offset 0x0 for 0x20000 bytes but wrote 0x0 bytes.
Format failed.
Incorrect write at offset 0x3221225472 for 0x4000 bytes but wrote 0x0 bytes.
Incorrect write at offset 0x244047671296 for 0x1000 bytes but wrote 0x0 bytes.
Format failed.

But that might already be an issue of Windows itself, not related to WinBtrfs.

@sskras
Copy link
Author

sskras commented Jun 11, 2024

Of course, after I reboot the OS, the file system is back:

saukrs@DESKTOP-O7JE7JE MSYS ~
$ systeminfo | grep -i boot
System Boot Time:          11/06/2024, 12:40:38
Boot Device:               \Device\HarddiskVolume3

saukrs@DESKTOP-O7JE7JE MSYS ~
$ wmic volume where "DeviceID LIKE '_%{0869fa25-bd66-7074-6498-7f4d08d64db0}_%'" get Capacity,DeviceId,DriveLetter,FileSystem,Label
Capacity      DeviceID                                           DriveLetter  FileSystem  Label
244047675392  \\?\Volume{0869fa25-bd66-7074-6498-7f4d08d64db0}\  E:           Btrfs


saukrs@DESKTOP-O7JE7JE MSYS ~
$ cmd /c dir /a /s E:
 Volume in drive E has no label.
 Volume Serial Number is 08D6-4DB0

 Directory of E:\

11/06/2024  11:57    <DIR>          System Volume Information
               0 File(s)             62 bytes

     Total Files Listed:
               0 File(s)             62 bytes
               1 Dir(s)  244,047,036,416 bytes free

@sskras
Copy link
Author

sskras commented Jun 11, 2024

Now if I try dismounting + remounting Btrfs volume again, my w10 crashes with NO_MORE_IRP_STACK_LOCATIONS:
061124-14437-01.dmp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant