Giter VIP home page Giter VIP logo

btrfs's Introduction

WinBtrfs v1.9

WinBtrfs is a Windows driver for the next-generation Linux filesystem Btrfs. A reimplementation from scratch, it contains no code from the Linux kernel, and should work on any version from Windows XP onwards. It is also included as part of the free operating system ReactOS.

If your Btrfs filesystem is on a MD software RAID device created by Linux, you will also need WinMD to get this to appear under Windows.

See also Quibble, an experimental bootloader allowing Windows to boot from Btrfs, and Ntfs2btrfs, a tool which allows in-place conversion of NTFS filesystems.

First, a disclaimer:

You use this software at your own risk. I take no responsibility for any damage it may do to your filesystem. It ought to be suitable for day-to-day use, but make sure you take backups anyway.

Everything here is released under the GNU Lesser General Public Licence (LGPL); see the file LICENCE for more info. You are encouraged to play about with the source code as you will, and I'd appreciate a note ([email protected]) if you come up with anything nifty.

See at the end of this document for copyright details of third-party code that's included here.

Features

  • Reading and writing of Btrfs filesystems
  • Basic RAID: RAID0, RAID1, and RAID10
  • Advanced RAID: RAID5 and RAID6
  • Caching
  • Discovery of Btrfs partitions, even if Windows would normally ignore them
  • Getting and setting of Access Control Lists (ACLs), using the xattr security.NTACL
  • Alternate Data Streams (e.g. :Zone.Identifier is stored as the xattr user.Zone.Identifier)
  • Mappings from Linux users to Windows ones (see below)
  • Symlinks and other reparse points
  • Shell extension to identify and create subvolumes, including snapshots
  • Hard links
  • Sparse files
  • Free-space cache
  • Preallocation
  • Asynchronous reading and writing
  • Partition-less Btrfs volumes
  • Per-volume registry mount options (see below)
  • zlib compression
  • LZO compression
  • LXSS ("Ubuntu on Windows") support
  • Balancing (including resuming balances started on Linux)
  • Device addition and removal
  • Creation of new filesystems with mkbtrfs.exe and ubtrfs.dll
  • Scrubbing
  • TRIM/DISCARD
  • Reflink copy
  • Subvol send and receive
  • Degraded mounts
  • Free space tree (compat_ro flag free_space_cache)
  • Shrinking and expanding
  • Passthrough of permissions etc. for LXSS
  • Zstd compression
  • Windows 10 case-sensitive directory flag
  • Oplocks
  • Metadata UUID incompat flag (Linux 5.0)
  • Three- and four-disk RAID1 (Linux 5.5)
  • New checksum types (xxhash, sha256, blake2) (Linux 5.5)
  • Block group tree (Linux 6.1)

Todo

  • Full fs-verity support (Linux 5.15)
  • Zoned support (Linux 5.11) (HM-SMR not supported on Windows?)
  • Defragmentation
  • Support for Btrfs quotas
  • Full transaction log support
  • Support for Windows transactions (TxF)

Installation

To install the driver, download and extract the latest release, right-click btrfs.inf, and choose Install. The driver is signed, so should work out of the box on modern versions of Windows.

If you using Windows 10 and have Secure Boot enabled, you may have to make a Registry change in order for the driver to be loaded - see below.

WinBtrfs is also available on the following package managers:

choco install winbtrfs
scoop bucket add nonportable
scoop install winbtrfs-np -g

Uninstalling

If you want to uninstall, from a command prompt run:

RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 btrfs.inf

You may need to give the full path to btrfs.inf.

You can also go to Device Manager, find "Btrfs controller" under "Storage volumes", right click and choose "Uninstall". Tick the checkbox to uninstall the driver as well, and let Windows reboot itself.

If you need to uninstall via the registry, open regedit and set the value of HKLM\SYSTEM\CurrentControlSet\services\btrfs\Start to 4, to disable the service. After you reboot, you can then delete the btrfs key and remove C:\Windows\System32\drivers\btrfs.sys.

Compilation

To compile with Visual C++ 2019, open the directory and let CMake do its thing. If you have the Windows DDK installed correctly, it should just work.

To compile with GCC on Linux, you will need a cross-compiler set up, for either i686-w64-mingw32 or x86_64-w64-mingw32. Create a build directory, then use either mingw-x86.cmake or mingw-amd64.cmake as CMake toolchain files to generate your Makefile.

Mappings

The user mappings are stored in the registry key HKLM\SYSTEM\CurrentControlSet\services\btrfs\Mappings. Create a DWORD with the name of your Windows SID (e.g. S-1-5-21-1379886684-2432464051-424789967-1001), and the value of your Linux uid (e.g. 1000). It will take effect next time the driver is loaded.

You can find your current SID by running wmic useraccount get name,sid.

Similarly, the group mappings are stored in under GroupMappings. The default entry maps Windows' Users group to gid 100, which is usually "users" on Linux. You can also specify user SIDs here to force files created by a user to belong to a certain group. The setgid flag also works as on Linux.

LXSS ("Ubuntu on Windows" / "Windows Subsystem for Linux")

The driver will passthrough Linux metadata to recent versions of LXSS, but you will have to let Windows know that you wish to do this. From a Bash prompt on Windows, edit /etc/wsl.conf to look like the following:

[automount]
enabled = true
options = "metadata"
mountFsTab = false

It will then take effect next time you reboot. Yes, you should be able to chroot into an actual Linux installation, if you wish.

Commands

The DLL file shellbtrfs.dll provides the GUI interface, but it can also be used with rundll32.exe to carry out some tasks from the command line, which may be useful if you wish to schedule something to run periodically.

Bear in mind that rundll32 provides no mechanism to return any error codes, so any of these commands may fail silently.

  • rundll32.exe shellbtrfs.dll,CreateSubvol <path>

  • rundll32.exe shellbtrfs.dll,CreateSnapshot <source> <destination>

  • rundll32.exe shellbtrfs.dll,ReflinkCopy <source> <destination> This also accepts wildcards, and any number of source files.

The following commands need various privileges, and so must be run as Administrator to work:

  • rundll32.exe shellbtrfs.dll,SendSubvol <source> [-p <parent>] [-c <clone subvol>] <stream file> The -p and -c flags are as btrfs send on Linux. You can specify any number of clone subvolumes.

  • rundll32.exe shellbtrfs.dll,RecvSubvol <stream file> <destination>

  • rundll32.exe shellbtrfs.dll,StartScrub <drive>

  • rundll32.exe shellbtrfs.dll,StopScrub <drive>

Troubleshooting

  • How do I debug this?

On the releases page, there's zip files to download containing the PDBs. Or you can try the symbols server http://symbols.burntcomma.com/ - in windbg, set your symbol path to something like this:

symsrv*symsrv.dll*C:\symbols*http://msdl.microsoft.com/download/symbols;symsrv*symsrv.dll*C:\symbols*http://symbols.burntcomma.com

  • The filenames are weird! or
  • I get strange errors on certain files or directories!

The driver assumes that all filenames are encoded in UTF-8. This should be the default on most setups nowadays - if you're not using UTF-8, it's probably worth looking into converting your files.

  • How do I get this working with Secure Boot turned on?

For the very latest versions of Windows 10, Microsoft introduced more onerous requirements for signing, which seemingly aren't available for open-source drivers.

To work around this, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CI\Policy in Regedit, create a new DWORD value called UpgradedSystem and set to 1, and reboot.

Or you could always just turn off Secure Boot in your BIOS settings.

  • The root of the drive isn't case-sensitive in LXSS

This is something Microsoft hardcoded into LXSS, presumably to stop people hosing their systems by running mkdir /mnt/c/WiNdOwS.

  • How do I change the drive letter?

With the shell extension installed, right-click the drive in Explorer, click Properties, and go to the Btrfs tab. There should be a button which allows you to change the drive letter.

  • I'm still having problems with drive letters

In Regedit, try deleting the relevant entries in HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices, then rebooting.

  • How do I format a partition as Btrfs?

Use the included command line program mkbtrfs.exe. We can't add Btrfs to Windows' own dialog box, unfortunately, as its list of filesystems has been hardcoded. You can also run format /fs:btrfs, if you don't need to set any Btrfs-specific options.

  • I can't reformat a mounted Btrfs filesystem

If Windows' Format dialog box refuses to appear, try running format.com with the /fs flag, e.g. format /fs:ntfs D:.

  • I can't mount a Synology NAS

Synology seems to use LVM for its block devices. Until somebody writes an LVM driver for Windows, you're out of luck.

  • I can't mount a Thecus NAS

Thecus uses Linux's MD raid for its block devices. You will need to install WinMD as well.

  • 64-bit Windows 7 won't load the driver

Make sure that you have KB3033929 installed. Or consider installing from an "escrow" ISO which includes all updates.

  • The drive doesn't show up and Paragon software has been installed

Paragon's filesystem-reading software is known to disable automount. Disable or uninstall Paragon, then re-enable automount by running diskpart and typing automount enable.

  • The drive doesn't show up on very old versions of Windows

On very old versions of Windows (XP, Server 2003?), Windows ignores Linux partitions entirely. If this is the case for you, try running fdisk on Linux and changing your partition type from 83 to 7.

Changelog

v1.9 (2024-03-15):

  • Added support for block group tree (Linux 6.1)
  • Fixed hang when system under heavy load
  • Added /blockgrouptree and /freespacetree options to mkbtrfs
  • Follow Linux in defaulting /noholes to on in mkbtrfs
  • Added support for CRC32C instructions on aarch64

v1.8.2 (2023-01-10):

  • Fixed UAC not working
  • Fixed Smartlocker crash on Windows 11 22H2
  • Rejigged INF file to work better on Windows 11
  • Files now signed with SHA256 hash rather than SHA1

v1.8.1 (2022-08-23):

  • Fixed use-after-free when flushing
  • Fixed crash when opening volume when AppLocker installed
  • Compression now disabled for no-COW files, as on Linux
  • Flushing now scales better on very fast drives
  • Fixed small files getting padded to 4,096 bytes by lazy writer
  • Added NoDataCOW registry option

v1.8 (2022-03-12):

  • Added minimal support for fs-verity
  • Added test suite
  • Fixed incorrect disk usage statistics
  • Fixed potential crashes when renaming stream to file or file to stream
  • Fixed potential crashes when querying hard links on file
  • Fixed potential hang when opening oplocked file
  • Fixed minor issues also uncovered by test suite

v1.7.9 (2021-10-02):

  • Fixed deadlock when mounting on Windows 11
  • Added support for BitLocker-encrypted volumes
  • Improved filename checks when renaming or creating hard links
  • Miscellaneous bug fixes

v1.7.8.1 (2021-06-13):

  • Fixed bug preventing new directories from appearing in listings
  • Fixed Release version of driver still not working on XP

v1.7.8 (2021-06-09):

  • Upgraded zstd to version 1.5.0
  • Fixed regression stopping driver from working under XP
  • Fixed compilation on clang
  • Fixed corruption issue when Linux mount option inode_cache had been used
  • Fixed recursion issue involving virtual directory \$Root

v1.7.7 (2021-04-12):

  • Fixed deadlock on high load
  • Fixed free space issue when installing Genshin Impact
  • Fixed issue when copying files with wildcards in command prompt
  • Increased speed of directory lookups

v1.7.6 (2021-01-14):

  • Fixed race condition when booting with Quibble
  • No longer need to restart Windows after initial installation
  • Forced maximum file name to 255 UTF-8 characters, to match Linux driver
  • Fixed issue where directories could be created with trailing backslash
  • Fixed potential deadlock when Windows calls NtCreateSection during flush
  • Miscellaneous bug fixes

v1.7.5 (2020-10-31):

  • Fixed text display issue in shell extension
  • Added support for mingw 8
  • Fixed LXSS permissions not working in new versions of Windows
  • Fixed issue where truncating an inline file wouldn't change its size
  • Fixed crash with Quibble where driver would try to use AVX2 before Windows had enabled it

v1.7.4 (2020-08-23):

  • Fixed issue when running compressed EXEs
  • Changed build system to cmake
  • Upgraded zstd to version 1.4.5
  • Added support for FSCTL_GET_RETRIEVAL_POINTERS
  • Miscellaneous bug fixes

v1.7.3 (2020-05-24):

  • Fixed crash when sending file change notifications
  • Improved symlink handling with LXSS
  • Added support for undocumented flag SL_IGNORE_READONLY_ATTRIBUTE
  • Fixed corruption caused by edge case, where address allocated and freed in same flush
  • Improved handling of free space tree
  • Improved handling of very full volumes
  • Fixed spurious warnings raised by GCC 10 static analyser
  • Replaced multiplications and divisions with bit shift operations where appropriate
  • Fixed combobox stylings in shell extension

v1.7.2 (2020-04-10):

  • Added more fixes for booting from Btrfs on Windows 10
  • Fixed occasional deadlock when deleting or closing files on Windows 10 1909
  • Fixed crash when reading large ADSes
  • Fixed occasional crash when writing files on RAID5/6
  • Miscellaneous bug fixes

v1.7.1 (2020-03-02):

  • Fixed crash when reading beyond end of file
  • Fixed spurious checksum errors when doing unaligned read

v1.7 (2020-02-26):

  • Added support for metadata_uuid incompat flag (Linux 5.0)
  • Added support for three- and four-disk RAID1 (Linux 5.5)
  • Added support for new checksum types: xxhash, sha256, blake2 (Linux 5.5)
  • Greatly increased checksumming speed
  • Greatly increased compression and decompression speed
  • Fixed bug causing incorrect free-space reporting when data is DUP
  • Fixed issue creating directories on LXSS when case=dir option set

v1.6 (2020-02-04):

  • Added experimental (i.e. untested) ARM support (thanks to DjArt for this)
  • Added fixes for booting from Btrfs on Windows 10
  • Volumes will now get remounted if changed while Windows is asleep or hibernating
  • Fixed corruption when mounting volume that hasn't been unmounted cleanly by Linux
  • Fixed crash when deleting subvolume

v1.5 (2019-11-10):

  • More fixes for booting from Btrfs
  • Added virtual $Root directory (see "NoRootDir" below)
  • Added support for Windows XP
  • Added support for renaming alternative data streams
  • Added oplock support
  • Fixed potential deadlock on boot
  • Fixed possible crash on shutdown
  • Fixed a bunch of memory leaks
  • Many other miscellaneous bug fixes

v1.4 (2019-08-31):

  • Added fragmentation percentage to property sheet
  • Added support for Windows Server 2003 and Windows Vista
  • Added pagefile support
  • Improved support for file locking
  • Added support for booting from Btrfs on Windows Server 2003 (see https://www.youtube.com/watch?v=-5E2CHmHEUs)
  • Fixed issue where driver could open same inode twice
  • Other miscellaneous bug fixes

v1.3 (2019-06-10):

  • Added support for new rename and delete functions introduced to Windows 10
  • Added support for Windows 10's flag for case-sensitive directories
  • Changed free-space calculation method to be more like that of the Linux driver
  • Added more support for 128-bit file IDs
  • Fixed bug causing outdated root items
  • Fixed bug preventing writing to VHDs

v1.2.1 (2019-05-06):

  • Reverted commit affecting the creation of streams

v1.2 (2019-05-05):

  • Dramatic speed increase when opening many small files, such as with a Git repository
  • Fixed crash on surprise removals of removable devices
  • Added ability to change drive letters easily
  • No longer creates free-space cache for very small chunks, so as not to confuse the Linux driver
  • Fixed corruption when very large file created and then immediately deleted
  • Minor bug fixes

v1.1 (2018-12-15):

  • Support for Zstd compression
  • Passthrough of Linux metadata to LXSS
  • Refactored shell extension
  • Fixed memory leaks
  • Many other bug fixes

v1.0.2 (2018-05-19):

  • Minor bug fixes

v1.0.1 (2017-10-15):

  • Fixed deadlock
  • Binaries now signed
  • Minor bug fixes

v1.0 (2017-09-04):

  • First non-beta release!
  • Degraded mounts
  • New free space cache (compat_ro flag free_space_cache)
  • Shrinking and expanding of volumes
  • Registry options now re-read when changed, rather than just on startup
  • Improved balancing on very full filesystems
  • Fixed problem preventing user profile directory being stored on btrfs on Windows 8 and above
  • Better Plug and Play support
  • Miscellaneous bug fixes

v0.10 (2017-05-02):

  • Reflink copy
  • Sending and receiving subvolumes
  • Group mappings (see Mappings section above)
  • Added commands for scripting etc. (see Commands section above)
  • Fixed an issue preventing mounting on non-PNP devices, such as VeraCrypt
  • Fixed an issue preventing new versions of LXSS from working
  • Fixed problem with the ordering of extent refs, which caused problems on Linux but wasn't picked up by btrfs check
  • Added support for reading compressed inline extents
  • Many miscellaneous bug fixes

v0.9 (2017-03-05):

  • Scrubbing
  • TRIM/DISCARD
  • Better handling of multi-device volumes
  • Performance increases when reading from RAID filesystems
  • No longer lies about being NTFS, except when it has to
  • Volumes will now go readonly if there is an unrecoverable error, rather than blue-screening
  • Filesystems can now be created with Windows' inbuilt format.com
  • Zlib upgraded to version 1.2.11
  • Miscellaneous performance increases
  • Miscellaneous bug fixes

v0.8 (2016-12-30):

  • Volume property sheet, for:
  • Balances
  • Adding and removing devices
  • Showing disk usage, i.e. the equivalent to btrfs fi usage
  • Checksums now calculated in parallel where appropriate
  • Creation of new filesystems, with mkbtrfs.exe
  • Plug and play support for RAID devices
  • Disk usage now correctly allocated to processes in taskmgr
  • Performance increases
  • Miscellaneous bug fixes

v0.7 (2016-10-24):

  • Support for RAID5/6 (incompat flag raid56)
  • Seeding support
  • LXSS ("Ubuntu on Windows") support
  • Support for Windows Extended Attributes
  • Improved removable device support
  • Better snapshot support
  • Recovery from RAID checksum errors
  • Fixed issue where creating a lot of new files was taking a long time
  • Miscellaneous speed increases and bug fixes

v0.6 (2016-08-21):

  • Compression support (both zlib and lzo)
  • Mixed groups support
  • No-holes support
  • Added inode property sheet to shell extension
  • Many more mount options (see below)
  • Better support for removable devices
  • Page file support
  • Many miscellaneous bug fixes

v0.5 (2016-07-24):

  • Massive speed increases (from "sluggish" to "blistering")
  • Massive stability improvements
  • RAID support: RAID0, RAID1, and RAID10
  • Asynchronous reading and writing
  • Partition-less Btrfs volumes
  • Windows sparse file support
  • Object ID support
  • Beginnings of per-volume mount options
  • Security improvements
  • Notification improvements
  • Miscellaneous bug fixes

v0.4 (2016-05-02):

  • Subvolume creation and deletion
  • Snapshots
  • Preallocation
  • Reparse points
  • Hard links
  • Plug and play
  • Free-space cache
  • Fix problems preventing volume from being shared over the network
  • Miscellaneous bug fixes

v0.3 (2016-03-25):

  • Bug fixes:
  • Fixed crashes when metadata blocks were SINGLE, such as on SSDs
  • Fixed crash when splitting an internal tree
  • Fixed tree traversal failing when first item in tree had been deleted
  • Fixed emptying out of whole tree (probably only relevant to checksum tree)
  • Fixed "incorrect local backref count" message appearing in btrfs check
  • Miscellaneous other fixes
  • Added beginnings of shell extension, which currently only changes the icon of subvolumes

v0.2 (2016-03-13):

  • Bug fix release:
  • Check memory allocations succeed
  • Check tree items are the size we're expecting
  • Added rollbacks, so failed operations are completely undone
  • Fixed driver claiming all unrecognized partitions (thanks Pierre Schweitzer)
  • Fixed deadlock within CcCopyRead
  • Fixed changing properties of a JPEG within Explorer
  • Lie about FS type, so UAC works
  • Many, many miscellaneous bug fixes
  • Rudimentary security support
  • Debug log support (see below)

v0.1 (2016-02-21):

  • Initial alpha release.

Debug log

WinBtrfs has three levels of debug messages: errors and FIXMEs, warnings, and traces. The release version of the driver only displays the errors and FIXMEs, which it logs via DbgPrint. You can view these messages via the Microsoft program DebugView, available at https://technet.microsoft.com/en-gb/sysinternals/debugview.

If you want to report a problem, it'd be of great help if you could also attach a full debug log. To do this, you will need to use the debug versions of the drivers; copy the files in Debug\x64 or Debug\x86 into x64 or x86. You will also need to set the registry entries in HKLM\SYSTEM\CurrentControlSet\Services\btrfs:

  • DebugLogLevel (DWORD): 0 for no messages, 1 for errors and FIXMEs, 2 for warnings also, and 3 for absolutely everything, including traces.
  • LogDevice (string, optional): the serial device you want to output to, such as \Device\Serial0. This is probably only useful on virtual machines.
  • LogFile (string, optional): the file you wish to output to, if LogDevice isn't set. Bear in mind this is a kernel filename, so you'll have to prefix it with "\??\" (e.g., "\??\C:\btrfs.log"). It probably goes without saying, but don't store this on a volume the driver itself is using, or you'll cause an infinite loop.

Mount options

The driver will create subkeys in the registry under HKLM\SYSTEM\CurrentControlSet\Services\btrfs for each mounted filesystem, named after its UUID. If you're unsure which UUID refers to which volume, you can check using btrfs fi show on Linux. You can add per-volume mount options to this subkey, which will take effect on reboot. If a value is set in the key above this, it will use this by default.

  • Ignore (DWORD): set this to 1 to tell the driver not to attempt loading this filesystem. With the Readonly flag, this is probably redundant.

  • Readonly (DWORD): set this to 1 to tell the driver not to allow writing to this volume. This is the equivalent of the ro flag on Linux.

  • Compress (DWORD): set this to 1 to tell the driver to write files as compressed by default. This is the equivalent of the compress flag on Linux.

  • CompressForce (DWORD): set this to 1 to force compression, i.e. to ignore the nocompress inode flag and even attempt compression of incompressible files. This isn't a good idea, but is the equivalent of the compress-force flag on Linux.

  • CompressType (DWORD): set this to 1 to prefer zlib compression, 2 to prefer lzo compression, or 3 to prefer zstd compression. The default is 0, which uses zstd or lzo compression if the incompat flags are set, and zlib otherwise.

  • FlushInterval (DWORD): the interval in seconds between metadata flushes. The default is 30, as on Linux - the parameter is called commit there.

  • ZlibLevel (DWORD): a number between -1 and 9, which determines how much CPU time is spent trying to compress files. You might want to fiddle with this if you have a fast CPU but a slow disk, or vice versa. The default is 3, which is the hard-coded value on Linux.

  • MaxInline (DWORD): the maximum size that will be allowed for "inline" files, i.e. those stored in the metadata. The default is 2048, which is also the default on modern versions of Linux - the parameter is called max_inline there. It will be clipped to the maximum value, which unless you've changed your node size will be a shade under 16 KB.

  • SubvolId (QWORD): the ID of the subvolume that we will attempt to mount as the root. If it doesn't exist, this parameter will be silently ignored. The subvolume ID can be found on the inode property sheet; it's in hex there, as opposed to decimal on the Linux tools. The default is whatever has been set via btrfs subvolume set-default; or, failing that, subvolume 5. The equivalent parameter on Linux is called subvolid.

  • SkipBalance (DWORD): set to 1 to tell the driver not to attempt resuming a balance which was running when the system last powered down. The default is 0. The equivalent parameter on Linux is skip_balance.

  • NoPNP (DWORD): useful for debugging only, this forces any volumes to appear rather than exposing them via the usual Plug and Play method.

  • ZstdLevel (DWORD): Zstd compression level, default 3.

  • NoTrim (DWORD): set this to 1 to disable TRIM support.

  • AllowDegraded (DWORD): set this to 1 to allow mounting a degraded volume, i.e. one with a device missing. You are strongly advised not to enable this unless you need to.

  • NoRootDir (DWORD): if you have changed your default subvolume, either natively or by a registry option, there will be a hidden directory called $Root which points to where the root would normally be. Set this value to 1 to prevent this appearing.

  • NoDataCOW (DWORD): set this to 1 to disable copy-on-write for new files. This is the equivalent of the nodatacow flag on Linux.

Contact

I'd appreciate any feedback you might have, positive or negative: [email protected].

Copyright

This code contains portions of the following software:

Zlib

Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

LZO

WinBtrfs contains portions of an early version of lzo, which is copyright 1996 Markus Oberhumer. Modern versions are licensed under the GPL, but this was licensed under the LGPL, so I believe it is okay to use.

Zstd

Copyright (c) 2016-present, Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name Facebook nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BLAKE2

https://github.com/BLAKE2/BLAKE2 (public domain)

SHA256

https://github.com/amosnier/sha-2 (public domain)

btrfs's People

Contributors

0xbadfca11 avatar ale5000-git avatar aminekhaldi avatar endoedgar avatar extravert-ir avatar heisspiter avatar itrooz avatar lesderid avatar lollilol avatar lordmike avatar maharmstone avatar sergegautherie avatar sitiom avatar thfabba avatar vanillajonathan avatar vocalfan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btrfs's Issues

Where is loader.exe in the latest release?

Forgive me if this is a stupid question, but the readme file says that to just run the driver, I should run loader.exe, but the latest release (0.10) doesn't include a loader.exe. Do I need to build the driver?

Also, right-clicking the inf file and clicking "install" doesn't seem to work either. It copies a file, but when I reboot, the btrfs partition isn't showing up.

Boot Windows?

It's just a crazy thought: is it (or will it be) possible to boot Windows from btrfs partition using your driver since it's highly-integrated and tries to be seamless from the Windows' point of view?

more dynamic uid<->sid mapping

It would be useful if the user mappings could be adjusted dynamically, without having to reload the driver/reboot.

For example, check the registry every n seconds for new entries (n=5? n=30? n configurable?)

Additionally, if the computer is in an Active Directory domain, it might be useful to pull the UNIX uid / gid for a specific user from there (and cache it locally for some time). I understand that this is not something that the driver itself should be doing, it probably needs a user-space companion that does the actual AD query and that replaces the uid on the file system as soon as they have been received from the AD

General suggestion related mainly to the DriverEntry routine

Last night I have tried to browse the code a little bit. Since the code base is quite large, I just scanned seveal routines, especially the DriverEntry, and would like to point to the problems.

  • In general, your DriverEntry does not perform any cleanup when it fails. You really should do that. Unlike in the usermode world, nobody cleans a mess (i.e. allocated memory, threads) after unloaded drivers. Well, there are probably some exceptions but I think it is a good habit not to rely on them too much. For example, when you call ExInitializeResourceLite you should also invoke the opposite (ExDeleteResourceLite) before your driver unloads (that includes a failure in the DriverEntry). Executive resources are linked into a list, so their state may be tracked by some WinDbg commands, such as !locks, that may be helpful when identifying deadlocks. So, if you do not delete the e. resource and unload your driver, its, now non-existent, memory remains in the list, so you get a BSOD when somebody touches it. Similar considerations apply to threads, timers, DPCs and other objects.

  • ExInitializeResourceLite may fail and you should check for that and take appropriate actions if such a thing happens. A general rule is that when a routine returns a NTSTATUS code, it may fail.

  • I have a good experience with wrapping memory allocation routines (ExAllocatePoolXxx) into my own memory allocator that tracks memory leaks and origins of individual allocations. AFAIK the kernel implements no such thing by itself. Similarly, I discovered that making wrappers for locking primitives has also its benefits, at leat for checking that the code runs on right IRQL. For example, acquiring an executive resource (ExAcquireResourceXxxLite) on DISPATCH_LEVEL does not crash the system if there is no need to block the caller, however, may have some terrible consequences later, masking the original cause of the problem.

Reflink support

Are there plans to implement an BTRFS_IOC_CLONE ioctl equivalent on Windows?

I am asking, because if this is implemented I would be able to have UrBackup Server run on Windows with btrfs :)

Windows reports drive not initialized, wants to create MBR/GPT

I'm on Windows 8.1 X64 build 9600. Test Mode is enabled. When I plug in my BTRFS drive, Windows tells me it's not initialized and wants to put a partition table on the drive. The drive mounts under Linux without issue. (It's an external USB 3.0 8TB drive. Single btrfs volume with LZO enabled. I've used this drive on the same windows computer, but formatted NTFS.)

I've tried both running loader.exe and installing with the inf and rebooting. I don't see the a service named 'btrfs' in Computer Management -> Services or Task Manager -> Services, however running loader.exe tells me the service already exists and is already running.

Thanks for any help. Can't wait to start using btrfs on Windows!

Question about compression

In btrfs properties you can set a compression flag. I have a file and a folder compressed with zlib but want to change it to lzo, so I set it via the flag option, but it seems like it has no effect. I also ran a balancing.

Compressiontype is now set to 2 in registry (was 0 before)

Am I doing something wrong?

Extend documentation

For starting users, it would be helpfull to note that the windows user ID can be found using:
wmic useraccount get name,sid

For Windows 10, it would be helpfull to have documentation on how to self-sign drivers:

Get New-SelfSignedCertificateEx.ps1

Run Powershell as administrator:

Set-ExecutionPolicy Unrestricted
Import-Module .\New-SelfSignedCertificateEx.ps1
$pw = convertto-securestring "secret" -asplaintext -force
New-SelfsignedCertificateEx -Subject "CN=Test Root CA2, OU=Sandbox" -IsCA $true -ProviderName "Microsoft Software Key Storage Provider" -Exportable -Path ssl.pfx -Password $pw -NotAfter $([datetime]::now.AddYears(50))

Install the certificate using right-click
Install the windows SDK
the start a command prompt in the cloned btrfs acrhive:

"C:\Program Files (x86)\Windows Kits\10\bin\x86\Inf2Cat.exe" /drv:. /os:7_X64,10_X64 /v
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\signtool.exe" sign /v /f ssl.pfx /p secret /t http://timestamp.comodoca.com/authenticode btrfs.cat
bcdedit /set testsigning on

Right-click on the btrfs.inf to install the driver.

mkbtrfs on existing btrfs volume

So I accidentally did a mkbtrfs on an existing volume which caused a bluescreen. After reboot the volume wasn't accessible anymore and I had problems creating new partitions. This was on Windows 7 x64 with version 0.8.
It also bluescreens if I delete a volume with btrfs on it in the volume manager.
Tell me if you need logs or stack straces. Thanks!

Add btrfs support to ReactOS

It seems there is some work being done by the people working on ReactOS to add this driver to it.
I'd like to see this happen, as I think it will likely be helpful both for ReactOS, and for btrfs, and specifically this btrfs for Windows implementation .
See Jira:CORE-10892 for what they have so far, and hopefully any changes required for ReactOS integration can be merged upstream (into this codebase) so that keeping it up-to-date in the ReactOS codebase is easy (meaning that it will be more likely to actually be updated when this implementation gets updates).

Thank you for making this, and please keep up the good work.

btrfs.sys?

I've cloned the repo onto windows, enabled test mode, and right-clicked the .inf to install, but it prompts me for btrfs.sys, which is nowhere to be found. Am I missing something?

Volume is not accessible.

After messing with x86 PAE patch (from wj32.org) and other lame "bcdedit /set pae ForceEnabled" stuff; getting "An internal error occured." message while selecting the drive within File Explorer.

// It happens after removing the PAE boot entry from within msconfig utility and reinstalling *.inf as well.

Driver status in Device Manager >>> Storage volumes says it's working properly.

Any hints much appreciated.

Disabled DUP PROFILE btrfs cause BSoD

Using Linux: SystemRescueCd 4.7.2(Linux sysresccd 3.18.29-std472-amd64)
Using Windows: Windows 10 1511 x86, Windows 7 SP1 x64

BSoD has occurred in a high probability the following procedure.

# mkfs.btrfs -f -m single /dev/sdb1
btrfs-progs v4.4.1
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM (125.73GiB) ...
Label:              (null)
UUID:               c26df1b0-1647-44cb-b23d-005fe53d0e05
Node size:          16384
Sector size:        4096
Filesystem size:    125.73GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         single            8.00MiB
  System:           single            4.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1   125.73GiB  /dev/sdb1

# mount -r /dev/sdb1 tmp
# ls /sys/fs/btrfs/*/features/
big_metadata extended_iref mixed_backref skinny_metadata

# reboot

Open elevated command prompt.
C:\btrfs> reg add HKLM\SYSTEM\CurrentControlSet\Services\btrfs /v DebugLogLevel /t REG_DWORD /d 2 /f
...
C:\btrfs> loader
...
C:\btrfs> fsutil file createnew D:\test 1073741824
Error: There is not enough space on the disk

Then, repeat copy file to btrfs volume or above fsutil.
Windows died with SYSTEM_THREAD_EXCEPTION_NOT_HANDLED or BAD_POOL_CALLER.

btrfs.log(10 x86, DebugLogLevel=2, I could not set DebugLogLevel=3, because cause KMODE_EXCEPTION_NOT_HANDLED at loading driver.)

Starting logging at 2016-05-24 14:25:22
0000009C:mount_vol:generation was 5, free-space cache generation was ffffffffffffffff; clearing cache...
00000B4C:insert_prealloc_extent:couldn't find any data chunks with 40000000 bytes free
00000B4C:extend_file:insert_prealloc_extent returned c000007f
00000B4C:set_end_of_file_information:error - extend_file failed
00000B28:mount_vol:error reading partition information: c0000010
00000B28:mount_vol:error reading partition information: c0000010
000006D0:open_file:SeAccessCheck failed, returning c0000061
000006D0:open_file:SeAccessCheck failed, returning c0000022
000006D0:open_file:SeAccessCheck failed, returning c0000022
000006D0:open_file:SeAccessCheck failed, returning c0000061
000006D0:drv_read:tried to read zero bytes
000006D0:open_file:SeAccessCheck failed, returning c0000022
000006D0:open_file:SeAccessCheck failed, returning c0000022
00000F0C:_find_item:find_item_in_tree returned c00000e5
00000F0C:_find_item:find_item_in_tree returned c00000e5
00000B28:open_file:SeAccessCheck failed, returning c0000022
00000B28:open_file:SeAccessCheck failed, returning c0000022
00000B00:open_file:SeAccessCheck failed, returning c0000022
00000B00:open_file:SeAccessCheck failed, returning c0000022
00000B7C:open_file:SeAccessCheck failed, returning c0000022
00000B7C:open_file:SeAccessCheck failed, returning c0000022
00000B64:open_file:SeAccessCheck failed, returning c0000022
00000B64:open_file:SeAccessCheck failed, returning c0000022
00000E8C:drv_device_control:STUB: device control
00000E8C:drv_device_control:control code = 4d0008
00000E8C:drv_device_control:STUB: device control
00000E8C:drv_device_control:control code = 4d0008
00000DE0:update_chunk_usage:could not find (1400000,c0,40000000) in extent_root

btrfs.log(7 x64, DebugLogLevel=3)

Starting logging at 2016-05-24 18:11:25
0000000000000038:DriverEntry:DriverEntry
0000000000000038:check_cpu:SSE4.2 is supported
0000000000000038:test_vol:HarddiskVolume1
0000000000000038:test_vol:\Device\HarddiskVolume1
0000000000000038:test_vol:volume found
0000000000000038:test_vol:FS uuid f19ed2f8-ee50-453c-997d-8b923c6d93b9
0000000000000038:test_vol:device uuid b9c1524f-df16-4f4b-87e6-6d480d3d9903
0000000000000038:test_vol:device number 1
0000000000000038:test_vol:HarddiskVolume2
0000000000000038:test_vol:\Device\HarddiskVolume2
0000000000000038:test_vol:HarddiskVolumeShadowCopy1
0000000000000038:test_vol:\Device\HarddiskVolumeShadowCopy1
0000000000000038:test_vol:HarddiskVolume3
0000000000000038:test_vol:\Device\HarddiskVolume3
0000000000000038:test_vol:HarddiskVolume4
0000000000000038:test_vol:\Device\HarddiskVolume4
0000000000000038:add_volume:found BTRFS volume
0000000000000038:add_volume:mmdlt = \Device\HarddiskVolume1
0000000000000038:add_volume:DriveLetterWasAssigned = 0, CurrentDriveLetter = D
0000000000000040:drv_file_system_control:file system control
0000000000000040:drv_file_system_control:IRP_MN_MOUNT_VOLUME
0000000000000040:mount_vol:mount_vol called
0000000000000040:mount_vol:partition length = 1857028096
0000000000000040:read_superblock:got superblock 0!
0000000000000040:read_superblock:got superblock 1!
0000000000000040:read_superblock:crc32 was 18c5c756, expected 18c5c756
0000000000000040:read_superblock:label is 
0000000000000040:mount_vol:btrfs magic found
0000000000000040:mount_vol:DeviceToMount = FFFFFA83030A6040
0000000000000040:mount_vol:Stack->Parameters.MountVolume.Vpb = FFFFFA83047BB5A0
0000000000000040:load_sys_chunks:bootstrap: 100,e4,0
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A002482010, FFFFF880039FBD80, FFFFF880039FBD40)
0000000000000040:_load_tree:(FFFFFA8302259180, 20000)
0000000000000040:find_device_from_uuid:device 0, uuid b9c1524f-df16-4f4b-87e6-6d480d3d9903
0000000000000040:find_device_from_uuid:returning device 0
0000000000000040:_load_tree:returning FFFFF8A001604010
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001604010, FFFFF880039FBD80, FFFFF880039FBD40, 0)
0000000000000040:load_chunk_root:(1,d8,1)
0000000000000040:load_chunk_root:(100,e4,0)
0000000000000040:find_device_from_uuid:device 0, uuid b9c1524f-df16-4f4b-87e6-6d480d3d9903
0000000000000040:find_device_from_uuid:returning device 0
0000000000000040:load_chunk_root:device 0 = FFFFF8A00180B010
0000000000000040:load_chunk_root:(100,e4,400000)
0000000000000040:find_device_from_uuid:device 0, uuid b9c1524f-df16-4f4b-87e6-6d480d3d9903
0000000000000040:find_device_from_uuid:returning device 0
0000000000000040:load_chunk_root:device 0 = FFFFF8A00180B010
0000000000000040:load_chunk_root:(100,e4,c00000)
0000000000000040:find_device_from_uuid:device 0, uuid b9c1524f-df16-4f4b-87e6-6d480d3d9903
0000000000000040:find_device_from_uuid:returning device 0
0000000000000040:load_chunk_root:device 0 = FFFFF8A00180B010
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814DE0, FFFFF880039FBD90, FFFFF880039FBD60)
0000000000000040:_load_tree:(FFFFFA8302259180, 404000)
0000000000000040:_load_tree:returning FFFFF8A001B461D0
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B461D0, FFFFF880039FBD90, FFFFF880039FBD60, 0)
0000000000000040:look_for_roots:(2,84,0)
0000000000000040:look_for_roots:root 2 - address 408000
0000000000000040:look_for_roots:(4,84,0)
0000000000000040:look_for_roots:root 4 - address 420000
0000000000000040:look_for_roots:(5,c,6)
0000000000000040:look_for_roots:(5,84,0)
0000000000000040:look_for_roots:root 5 - address 400000
0000000000000040:look_for_roots:(6,1,0)
0000000000000040:look_for_roots:(6,c,6)
0000000000000040:look_for_roots:(6,54,8dbfc2d2)
0000000000000040:look_for_roots:(7,84,0)
0000000000000040:look_for_roots:root 7 - address 424000
0000000000000040:look_for_roots:(fffffffffffffff7,84,0)
0000000000000040:look_for_roots:root fffffffffffffff7 - address 428000
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814BB0, FFFFF880039FBDA8, FFFFF880039FBD78)
0000000000000040:_load_tree:(FFFFFA8302259180, 408000)
0000000000000040:_load_tree:returning FFFFF8A0018483B0
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A0018483B0, FFFFF880039FBDA8, FFFFF880039FBD78, 0)
0000000000000040:find_chunk_usage:chunk 0 has 4000 bytes used
0000000000000040:load_free_space_cache:generating free space cache for chunk 0
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814BB0, FFFFF880039FBCD0, FFFFF880039FBC88)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A0018483B0, FFFFF880039FBCD0, FFFFF880039FBC88, 0)
0000000000000040:load_free_space_cache:(0,20000)
0000000000000040:load_free_space_cache:(24000,3dc000)
0000000000000040:load_free_space_cache:0,20000,0
0000000000000040:load_free_space_cache:20000,4000,1
0000000000000040:load_free_space_cache:24000,3dc000,0
0000000000000040:protect_superblocks:cut out superblock in chunk 0
0000000000000040:add_to_space_list:(FFFFF8A0018385C0, 10000, 10000, 1)
0000000000000040:add_to_space_list:0,20000,0
0000000000000040:add_to_space_list:20000,4000,1
0000000000000040:add_to_space_list:24000,3dc000,0
0000000000000040:add_to_space_list:0,10000,0
0000000000000040:add_to_space_list:10000,14000,1
0000000000000040:add_to_space_list:24000,3dc000,0
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814BB0, FFFFF880039FBDA8, FFFFF880039FBD78)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A0018483B0, FFFFF880039FBDA8, FFFFF880039FBD78, 0)
0000000000000040:find_chunk_usage:chunk 400000 has 18000 bytes used
0000000000000040:load_free_space_cache:generating free space cache for chunk 400000
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814BB0, FFFFF880039FBCD0, FFFFF880039FBC88)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A0018483B0, FFFFF880039FBCD0, FFFFF880039FBC88, 0)
0000000000000040:load_free_space_cache:(40c000,14000)
0000000000000040:load_free_space_cache:(42c000,7d4000)
0000000000000040:load_free_space_cache:400000,c000,1
0000000000000040:load_free_space_cache:40c000,14000,0
0000000000000040:load_free_space_cache:420000,c000,1
0000000000000040:load_free_space_cache:42c000,7d4000,0
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814BB0, FFFFF880039FBDA8, FFFFF880039FBD78)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A0018483B0, FFFFF880039FBDA8, FFFFF880039FBD78, 0)
0000000000000040:find_chunk_usage:chunk c00000 has 0 bytes used
0000000000000040:load_free_space_cache:generating free space cache for chunk c00000
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814BB0, FFFFF880039FBCD0, FFFFF880039FBC88)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A0018483B0, FFFFF880039FBCD0, FFFFF880039FBC88, 0)
0000000000000040:load_free_space_cache:(c00000,800000)
0000000000000040:load_free_space_cache:c00000,800000,0
0000000000000040:mount_vol:generation was 5, free-space cache generation was ffffffffffffffff; clearing cache...
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A001814DE0, FFFFF880039FBD90, FFFFF880039FBD50)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B461D0, FFFFF880039FBD90, FFFFF880039FBD50, 0)
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBF08, FFFFF880039FBE30)
0000000000000040:_load_tree:(FFFFFA8302259180, 400000)
0000000000000040:_load_tree:returning FFFFF8A001B11640
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBF08, FFFFF880039FBE30, 0)
0000000000000040:get_xattr:(FFFFFA8302259180, 5, 100, security.NTACL, 45922146, FFFFF8A00160CC98, FFFFF880039FBC68)
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBBC0, FFFFF880039FBB90)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBBC0, FFFFF880039FBB90, 0)
0000000000000040:get_xattr:could not find item (100,18,45922146)
0000000000000040:get_xattr:(FFFFFA8302259180, 5, 100, user.DOSATTRIB, 914f9939, FFFFF880039FBDA8, FFFFF880039FBDB0)
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBD20, FFFFF880039FBCF0)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBD20, FFFFF880039FBCF0, 0)
0000000000000040:get_xattr:could not find item (100,18,914f9939)
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0017E34C0, FFFFF880039FBD98, FFFFF880039FBD60)
0000000000000040:_load_tree:(FFFFFA8302259180, 420000)
0000000000000040:_load_tree:returning FFFFF8A00153E290
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A00153E290, FFFFF880039FBD98, FFFFF880039FBD60, 0)
0000000000000040:mount_vol:mount_vol done (status: 0)
0000000000000040:drv_create:create (flags = 884)
0000000000000040:drv_create:flags:
0000000000000040:drv_create:SL_STOP_ON_SYMLINK
0000000000000040:drv_create:file name: \System Volume Information\MountPointManagerRemoteDatabase
0000000000000040:drv_create:getting tree_lock 0->1
0000000000000040:debug_create_options:requested options:
0000000000000040:debug_create_options:    FILE_SYNCHRONOUS_IO_NONALERT
0000000000000040:debug_create_options:    FILE_NON_DIRECTORY_FILE
0000000000000040:open_file:requested disposition: FILE_OPEN
0000000000000040:open_file:(\System Volume Information\MountPointManagerRemoteDatabase)
0000000000000040:open_file:FileObject = FFFFFA830422F530
0000000000000040:open_fileref:(FFFFFA8302259180, FFFFF880039FBF38, 0000000000000000, 0, FFFFF880039FBEF8)
0000000000000040:find_file_in_dir:System Volume Information
0000000000000040:find_file_in_dir:crc32c(System Volume Information) = fdf4155f
0000000000000040:find_file_in_dir_with_crc32:(FFFFFA8302259180, System Volume Information, fdf4155f, FFFFF8A0011D3DE0, 100, FFFFF880039FBDD8, FFFFF880039FBDE8, FFFFF880039FBDE0)
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBBA0, FFFFF880039FBB50)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBBA0, FFFFF880039FBB50, 0)
0000000000000040:find_file_in_dir_with_crc32:found item 100,c,100
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBB88, FFFFF880039FBB50)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBB88, FFFFF880039FBB50, 0)
0000000000000040:find_file_in_dir_with_crc32:found item 100,c,100
0000000000000040:open_fileref:could not find System Volume Information
0000000000000040:open_fileref:returning c000003a
0000000000000040:open_file:open_fileref returned c000003a
0000000000000040:drv_create:releasing tree_lock 1->0
0000000000000040:drv_create:create returning c000003a
0000000000000040:drv_create:create (flags = 884)
0000000000000040:drv_create:flags: (none)
0000000000000040:drv_create:file name: \$Extend\$Reparse:$R:$INDEX_ALLOCATION
0000000000000040:drv_create:getting tree_lock 0->1
0000000000000040:debug_create_options:requested options:
0000000000000040:debug_create_options:    FILE_SYNCHRONOUS_IO_NONALERT
0000000000000040:open_file:requested disposition: FILE_OPEN
0000000000000040:open_file:(\$Extend\$Reparse:$R:$INDEX_ALLOCATION)
0000000000000040:open_file:FileObject = FFFFFA830422F530
0000000000000040:open_fileref:(FFFFFA8302259180, FFFFF880039FBE48, 0000000000000000, 0, FFFFF880039FBE08)
0000000000000040:find_file_in_dir:$Extend
0000000000000040:find_file_in_dir:crc32c($Extend) = a06478f2
0000000000000040:find_file_in_dir_with_crc32:(FFFFFA8302259180, $Extend, a06478f2, FFFFF8A0011D3DE0, 100, FFFFF880039FBCE8, FFFFF880039FBCF8, FFFFF880039FBCF0)
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBAB0, FFFFF880039FBA60)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBAB0, FFFFF880039FBA60, 0)
0000000000000040:find_file_in_dir_with_crc32:found item 100,c,100
0000000000000040:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880039FBA98, FFFFF880039FBA60)
0000000000000040:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880039FBA98, FFFFF880039FBA60, 0)
0000000000000040:find_file_in_dir_with_crc32:found item 100,c,100
0000000000000040:open_fileref:could not find $Extend
0000000000000040:open_fileref:returning c000003a
0000000000000040:open_file:open_fileref returned c000003a
0000000000000040:drv_create:releasing tree_lock 1->0
0000000000000040:drv_create:create returning c000003a
0000000000000700:drv_create:create (flags = 884)
0000000000000700:drv_create:flags: (none)
0000000000000700:drv_create:file name: \test
0000000000000700:drv_create:getting tree_lock (exclusive) 0->1
0000000000000700:drv_create:open tree count = 5
0000000000000700:debug_create_options:requested options:
0000000000000700:debug_create_options:    FILE_SYNCHRONOUS_IO_NONALERT
0000000000000700:debug_create_options:    FILE_NON_DIRECTORY_FILE
0000000000000700:debug_create_options:    FILE_DISALLOW_EXCLUSIVE
0000000000000700:open_file:requested disposition: FILE_CREATE
0000000000000700:open_file:(\test)
0000000000000700:open_file:FileObject = FFFFFA83047B7070
0000000000000700:open_fileref:(FFFFFA8302259180, FFFFF880043D92C8, 0000000000000000, 0, FFFFF880043D9288)
0000000000000700:find_file_in_dir:test
0000000000000700:find_file_in_dir:crc32c(test) = a41a2787
0000000000000700:find_file_in_dir_with_crc32:(FFFFFA8302259180, test, a41a2787, FFFFF8A0011D3DE0, 100, FFFFF880043D9168, FFFFF880043D9178, FFFFF880043D9170)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8F30, FFFFF880043D8EE0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8F30, FFFFF880043D8EE0, 0)
0000000000000700:find_file_in_dir_with_crc32:found item 100,c,100
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8F18, FFFFF880043D8EE0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8F18, FFFFF880043D8EE0, 0)
0000000000000700:find_file_in_dir_with_crc32:found item 100,c,100
0000000000000700:open_fileref:could not find test
0000000000000700:open_fileref:returning c0000034
0000000000000700:file_create:(FFFFFA8303CA2AB0, FFFFFA8302259180, FFFFFA83047B7070, \test, 2, 20060)
0000000000000700:open_fileref:(FFFFFA8302259180, FFFFF880043D90B0, 0000000000000000, 1, 0000000000000000)
0000000000000700:open_fileref:returning 00000000
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DE8, FFFFF880043D8DB0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DE8, FFFFF880043D8DB0, 0)
0000000000000700:file_create2:filename = test, crc = a41a2787, dirpos = 2
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8F20, FFFFF880043D8E70)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8F20, FFFFF880043D8E70, 0)
0000000000000700:delete_tree_item:deleting item 100,1,0 (ignore = FALSE)
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 100, 1, 0, FFFFF8A0018A4360, a0, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DA0, FFFFF880043D8D38)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DA0, FFFFF880043D8D38, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A001834220
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A001834220
0000000000000700:insert_tree_item:inserting 100,1,0 into tree beginning 100,1,0 (num_items 1)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DE0, FFFFF880043D8DB0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DE0, FFFFF880043D8DB0, 0)
0000000000000700:get_last_inode:moving on to 100,1,0
0000000000000700:get_last_inode:last inode for tree 5 is 100
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 100, 60, 2, FFFFF8A001848010, 22, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DA0, FFFFF880043D8D38)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DA0, FFFFF880043D8D38, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A001861D40
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A001861D40
0000000000000700:insert_tree_item:inserting 100,60,2 into tree beginning 100,1,0 (num_items 2)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DE8, FFFFF880043D8DC0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DE8, FFFFF880043D8DC0, 0)
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 100, 54, a41a2787, FFFFF8A001848070, 22, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8CF0, FFFFF880043D8C88)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8CF0, FFFFF880043D8C88, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A001861D40
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A001861D40
0000000000000700:insert_tree_item:inserting 100,54,a41a2787 into tree beginning 100,1,0 (num_items 3)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DC8, FFFFF880043D8DA0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DC8, FFFFF880043D8DA0, 0)
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 101, c, 100, FFFFF8A001619C00, e, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8CD0, FFFFF880043D8C68)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8CD0, FFFFF880043D8C68, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A0018A66A0
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A0018A66A0
0000000000000700:insert_tree_item:inserting 101,c,100 into tree beginning 100,1,0 (num_items 4)
0000000000000700:file_create2:requested attributes = 80
0000000000000700:file_create2:defda = 0
0000000000000700:set_xattr:(FFFFFA8302259180, 5, 101, user.DOSATTRIB, 914f9939, FFFFF880043D8F30, 4)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DC8, FFFFF880043D8DA0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DC8, FFFFF880043D8DA0, 0)
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 101, 18, 914f9939, FFFFF8A00072DFD0, 30, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8CD0, FFFFF880043D8C68)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8CD0, FFFFF880043D8C68, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A0020DB770
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A0020DB770
0000000000000700:insert_tree_item:inserting 101,18,914f9939 into tree beginning 100,1,0 (num_items 5)
0000000000000700:set_xattr:(FFFFFA8302259180, 5, 101, security.NTACL, 45922146, FFFFF8A0015F0980, 144)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DC8, FFFFF880043D8DA0)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DC8, FFFFF880043D8DA0, 0)
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 101, 18, 45922146, FFFFF8A0011BB660, bc, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8CD0, FFFFF880043D8C68)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8CD0, FFFFF880043D8C68, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A0020DB770
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A0020DB770
0000000000000700:insert_tree_item:inserting 101,18,45922146 into tree beginning 100,1,0 (num_items 6)
0000000000000700:insert_tree_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, 101, 1, 0, FFFFF8A001835690, a0, 0000000000000000, FFFFF880043D9438)
0000000000000700:_find_item:(FFFFFA8302259180, FFFFF8A0011D3DE0, FFFFF880043D8DA0, FFFFF880043D8D38)
0000000000000700:find_item_in_tree:(FFFFFA8302259180, FFFFF8A001B11640, FFFFF880043D8DA0, FFFFF880043D8D38, 1)
0000000000000700:insert_tree_item:tp.item = FFFFF8A0018A66A0
0000000000000700:insert_tree_item:tp.item->key = FFFFF8A0018A66A0
0000000000000700:insert_tree_item:inserting 101,1,0 into tree beginning 100,1,0 (num_items 7)
0000000000000700:file_create2:created new file \test in subvol 5, inode 101
0000000000000700:drv_create:releasing tree_lock 1->0
0000000000000700:drv_create:open tree count = 5
0000000000000700:drv_create:create returning 00000000
0000000000000700:drv_query_information:query information
0000000000000700:drv_query_information:getting tree_lock 0->1
0000000000000700:drv_query_information:fcb = FFFFF8A002474680
0000000000000700:drv_query_information:fcb->subvol = FFFFF8A0011D3DE0
0000000000000700:query_info:(FFFFFA8302259180, FFFFFA83047B7070, FFFFFA830341DC60)
0000000000000700:query_info:fcb = FFFFF8A002474680
0000000000000700:query_info:FileStandardLinkInformation
0000000000000700:fill_in_file_standard_link_information:FileStandardLinkInformation
0000000000000700:query_info:query_info returning 00000000
0000000000000700:drv_query_information:returning 00000000
0000000000000700:drv_query_information:releasing tree_lock 1->0
0000000000000020:drv_create:create (flags = 884)
0000000000000020:drv_create:flags: (none)
0000000000000020:drv_create:open operation for volume
0000000000000020:drv_create:create returning 00000000
0000000000000020:drv_query_volume_information:query volume information
0000000000000020:drv_query_volume_information:FileFsVolumeInformation
0000000000000020:drv_query_volume_information:max length = 24
0000000000000020:drv_query_volume_information:getting tree_lock 0->1
0000000000000020:drv_query_volume_information:label_len = 0
0000000000000020:drv_query_volume_information:releasing tree_lock 1->0
0000000000000020:drv_query_volume_information:query volume information returning 00000000
0000000000000020:drv_cleanup:cleanup
0000000000000020:drv_cleanup:cleanup called for FileObject FFFFFA8303478BD0

Windows10Pro-64 System Freezing

I managed to get this driver working for short periods of time using the loader.exe method but after trying to change permissions of files or loading disk management, or trying to use NexusModManager on the drive resulted in hard locking of the system.

The INF driver prevents windows from booting in any mode regardless of settings. This is a rather annoying issue because it even prevents error reporting due to the system wide lock up so I don't know what else to provide other then 'its broken'.

But thanks for making a driver non the less, perhaps if we can figure out why this hard lock happens it would be great, I even managed to get a game running off the drive but not for long.

Can't uninstall

How do I uninstall the driver? It gives me bluescreens and I can't find any uninstall information.

Include zstd compression format

There is a patch made for linux that adds support for zstd, it improves compression without compromise performance. Is much better than zlib but faster as lzo.

Here is the patch

I know that your driver has nothing to do with the linux code, so I don't know if it's possible to port support for zstd, but since it's a great alternative for transparent compression I believe it's worth to try it out.

Group mapping and preserving ownership/permissions

I noticed that editing (and saving) files with non-elevated privileges erases existing perms and ownership.
It sets the owner group to nobody and user according to the set mapping.
This doesn't happen with privileged editing and as we usually do edits in unprivileged programs like Sublime, it would be great if privileges and ownership data could be preserved.

Could you add a mapping for groups to the registry, too?

External SSD btrfs volume not detected

An btrfs volume created with the command:

mkfs -t btrfs /dev/sda1 (under a GPT filetable)

resulting in the following flags: big_metadata, extended_iref, mixed_backref, skinny_metadata from Arch Linux 4.6.2 x64 with btrfs-progs v4.6 cannot be read (no drive is displayed in explorer or mountvol) from my Microsoft Windows 10 x64 partition.

The drive is being detected in disk manager but does not indicate a partition type. A seperate USB memory stick loaded with btrfs under the same system can be loaded and interacted with with no problem. The drive also used to work (i.e. it was working at one point with btrfs) until one day detection failed (as such, I tried reformatting it to no avail). The drive is detectable when formatted with exFAT or NTFS in Windows.

Upon insertion, I've tried restarting explorer, starting explorer from a priveleged command prompt, mounting all the drives available in mountvol, refreshing explorer with F5 and removal and reinserting the drive.

The Arch Linux and the Windows system reside on the same hardware (dual boot) and the same USB slot was used (though I've tried different slots as well to no avail). The drive functions as intended in Arch. The drive has also been tested in another Microsoft Windows 10 x64 system with the same results (no drive detection).

Attached below is the btrfs kernel log as well as the debugview log, note that in the kernel log all events up to the last 0000000000000CC0 occurred prior to any btrfs volume was inserted to the system.

btrfs.txt
DebugView.txt

I can provide more information as necessary.

Some problems with auto repair of btrfs

I have an ordinary - but specific - file that causes a crash on Windows and a freeze on Linux. During the copy this file crashes at 434,8 MB of 725,3 MB with WinBtrfs from Windows and on Linux too.

This file is good, I can read it. Both Windows and Linux can read it and copying it without errors toward an ntfs partition.

On Windows I used WinBtrfs 0.7. I have Windows 8.1 32 bit and Debian testing with Xfce 32 bit. My HD is 298,1 GiB with 4 primary partitions.

I have to exclude an hard disk damage because I have tried 2 different hard disks and it rises up the same error.

Maybe WinBtrfs is innocent because the same error rises up on Linux. But this means that there is a very basilar bug.

This file is correctly copied from ntfs partition to another ntfs partition. Windows and Linux can do this correct copy, but when the file is copied from ntfs partition to btrfs partition Windows rises up a death screen and Linux freezes.

The copy is executed by usb and from internal partition to another internal partition. This doesn't make a difference.

Blue screen on Windows 10

Windows 10 Pro 64-bit 1709
Intel Core i7 4770K
Gigabyte Technology Co. Ltd. Z97X-Gaming GT

Kingston DTIG4/32GB DataTraveler

Put file in btrfs pen drive get a blue screen.
Remove btrfs pen drive cause a different blue screen.
Unable to create btrfs file system with format and also with mkbtrfs (FormatEx failed).

Writing to volume hangs after some time

Whether copying with Total Commander or Explorer, the copying process just stops and becomes non-responding.

Additional information:
It seems to happen at the end of copying a file, i.e. that some files are transferred without issue, but then all of a sudden the copying stops. I tested this with different files, so the source does not seem to be the problem.
The copying processes (either Total Commander or Explorer) are not killable ('access denied' in task manager). When trying to restart, the processes are noted as preventing restart. 'Restart anyway' continues but leads to a spinner spinning for at least 3 minutes (after which I performed a hard reset). If my knowledge of such behavior is correct, this is generally an indicator of the processes waiting for a kernel space component.

System information:
Winbtrfs 1.0
Windows 10 Pro
Build 15063.rs2_release.170317-1834
Volume is a ~2,9GB partition on a GPT drive, created with mkbtrfs.exe. The first partition on that drive is a 30GB Linux (swap) partition.

I will update this issue later with information from DebugView and the logs.

Implement cleanup for mount_vol and fix error code for non-btrfs volumes

Can you reorganize the code a bit to move the lock initializations later in function, so that if mount_vol is called for non-btrfs volume, there is no need to release them.
Also if mount_vol is called for non-btrfs volume it returns STATUS_INTERNAL_ERROR from read_superblock instead of STATUS_UNRECOGNIZED_VOLUME.
Basically to implement cleanup for mount_vol if error occurs (it happens if called for non-btrfs volumes).
You should be able to hit this in windows if you present unrecognized volume (not fat, not ntfs, not udfs, etc) in the system when driver is loaded. Strange formatted (or unformatted) USB flash drive should do the trick I guess.

Updating svn on btrfs partition crash

I have a svn (subversion) directory on my btrfs. I just tried to update that folder through windows. And I received an instant BSOD crash.

From the event log:
The computer has rebooted from a bugcheck. The bugcheck was: 0x0000003b (0x00000000c0000005, 0xfffff800f1819d34, 0xffffd001fdcdad10, 0x0000000000000000). A dump was saved in: C:\WINDOWS\MEMORY.DMP. Report Id: ebee2170-776d-4fac-9304-e3b36e6f2494.

Is there a way to force it to mount readonly?

Sorry if this is the wrong forum to ask questions, but I couldn't find anything else.

  • Is there a way to force it to mount readonly?
  • If the answer is yes, would that make it less likely to get corrupted?

I just need read-only access to my storage from windows for the most part.

Crash when deleting snapshot of subvolume having subvolume

Windows 10 v1703 x64
btrfs volume was created with mkbtrfs.exe without options.

Create a subvolume and create a subvolume in previous subvolume.

\  
└───New subvolume  
    └───New subvolume  

Create a snapshot of the upper subvolume in the above state.

\
├───New subvolume
│   └───New subvolume
└───Snapshot of New subvolume (2017-04-06)
    └───New subvolume

Delete snapshot, then crash.
Sometimes it does not crash, but at that time the lower subvolume disappears.

Log file(DebugLogLevel=3) of v0.9 btrfs1.txt
This log file is the one when crashed with the binary I built from source code at 7c208a4. btrfs2.txt

Performance - NTFS vs WinBtrfs

I couldn't find any benchmarks or any information about the performance of WinBtrfs, so I made a quick test with CrystalDiskMark 5. It seems that winbtrfs has better random writes/reads but lower seq. write/read performance.

Have you made similar observations?

OS : Windows 10 Professional [10.0 Build 16299] (x64)
WinBtrfs v1.0.1 on HDD

WinBTRFS with LZO
Sequential Read (Q= 32,T= 1) : 119.619 MB/s
Sequential Write (Q= 32,T= 1) : 93.616 MB/s
Random Read 4KiB (Q= 32,T= 1) : 1.381 MB/s [ 337.2 IOPS]
Random Write 4KiB (Q= 32,T= 1) : 1.874 MB/s [ 457.5 IOPS]
Sequential Read (T= 1) : 117.870 MB/s
Sequential Write (T= 1) : 122.909 MB/s
Random Read 4KiB (Q= 1,T= 1) : 0.672 MB/s [ 164.1 IOPS]
Random Write 4KiB (Q= 1,T= 1) : 4.304 MB/s [ 1050.8 IOPS]

NTFS
Sequential Read (Q= 32,T= 1) : 152.757 MB/s
Sequential Write (Q= 32,T= 1) : 145.346 MB/s
Random Read 4KiB (Q= 32,T= 1) : 0.951 MB/s [ 232.2 IOPS]
Random Write 4KiB (Q= 32,T= 1) : 1.098 MB/s [ 268.1 IOPS]
Sequential Read (T= 1) : 154.369 MB/s
Sequential Write (T= 1) : 146.380 MB/s
Random Read 4KiB (Q= 1,T= 1) : 0.395 MB/s [ 96.4 IOPS]
Random Write 4KiB (Q= 1,T= 1) : 1.153 MB/s [ 281.5 IOPS]

btrfs

Blue screens with IRQL_NOT_LESS_OR_EQUAL and SYSTEM_THREAD_EXCEPTION_NOT_HANDLED

A few days ago I've started to get BSODs IRQL_NOT_LESS_OR_EQUAL and SYSTEM_THREAD_EXCEPTION_NOT_HANDLED. If I remember correctly it started to happened after I upgraded to v0.10. I even got unbootable system and wasn't able to get it to live with the last restore point. At the end I've managed to get my system alive, but sometimes I'm still getting BSODs. WhoCrashed tells that the reason is btrfs.sys, but I can't be sure for 100% as I get problems with my Apple Magic Keyboard \ Magic Trackpad at the same time and it's pretty tough to make them work again. It can be some kind of incompatibility with Apple drivers and ExtraMagic Trackpad driver. I'm ready to send the latest crash dump but it's 1 GB length, so I'll send a link to it via email soon.

ARM build

Adding official ARM support for Winbtrfs, it works already after adding an ARM sln config

Using an encrypted partition

Hi,

is it possible, or is intended to become possible to have WinBtrfs use a partition, which is encrypted by a typical corporate disk encryption solution like PGP Desktop, or McAffee Disk Encryption?

Thanks,

Jochen

Cannot Format Partition As BTRFS: FormatEx Fail

Btrfs version: v1.0.1
OS: win7 x64
Security Software: Commodo Firewall 10, ESET NOD32 v4.2.76.1, GlassWire Lite v1.2.118
Partition: 2nd main partition on a USB harddisk

I tried the following commands, they both said: FormatEx failed

format /fs:btrfs s:

and

mkbtrfs s:

Dokan?

Hey, have you considered implementing the driver in userspace using Dokan? It provides both its own callback API and FUSE API. It might make the development easier (or not, I can't make a qualified guess here).

https://github.com/dokan-dev/dokany

Can't go deeper into the btrfs partition under WSL

Hello!

I'm trying to use WinBtrfs with Windows 10 Home, build 14393.-.170327-1835. While it seems to work perfectly within Explorer, I can't get access to the partition from WSL. Every time I'm trying to cd into /mnt/d/root I get "Permission denied". I've tried to run bash as Administrator, I've tried to sudo -i first: it doesn't help.
BTRFS partition is a partition on the same drive, the root partition of the installed Fedora Linux.

Did I miss something, could you please point me to the right direction?

Thanks!

Disk stops being allowed to be written to because of Write Protection.

I've gotten two new hard drives, and decided to give your Windows port of btrfs a try. It was working really well, up until a point I stored around 1.75TB on a 3TB drive. At this point Windows stopped letting me write anything to these drives, but data was still readable. If I try to transfer or copy anything to these drives, the action will be interrupted, and Windows will notify me that the Btrfs formatted disk is write-protected. To fix this, I open up diskpart, select the btrfs partition, and clear it's attributes, to apply this I also have to reboot the computer entirely, and then the drive seems to be writable for a few files or a few kilobytes (Can't tell because Steam always opens up and writes to it too quickly).

OS: Windows 10, Redstone 3

While I'm only storing games on this drive, the fact it stood up this long is impressive. Looking forward to seeing how this project evolves as I'd really like to use this daily on all of my drives.

Can't create\copy files larger than certain size

It seems that I was overconfident when told before that in normal mode (in Explorer) everything works perfectly.

Don't know how to explain it, but I can create\copy\edit files with size less than around 58MB. If I'm trying to copy a bigger file to a btrfs partition I get message "You need XXX MB to copy this object. Delete or move files to free space". And actual amount of needed space varies depending on the file size (I mean, it can ask for 77MB more if file size is 77MB and for 686MB if file size is 707MB or 702MB).

I know nothing about btrfs internals and its windows implementation but I would suppose that the biggest free space block on my btrfs partition is around 58MB and FS driver can't split data into chunks. But it's a shot in the dark. :)

WinBtrfs 0.9 with Windows 10 Home, build 14393.-.170327-1835

Windows 7 Pro x64 bluescreen in FsDepends.sys

I tried WinBTRFS in the following scenario:

  • Windows 7 x64 Build 7601 (latest SP, all patches up to May 2nd 2016)
  • Since I didn't have a pre-existing disk with btrfs (and since there's no mkfs.btrfs for Windows yet) I created a new 4gb VHD in the disk management
  • I attached the VHD file to a Ubuntu 14.10 VM running in VMware Workstation 11 as "physical disk"
  • I booted the VM, partitioned the VHD file and created a (default) btrfs on it and shut down the VM again
  • I then removed the VHD from it and did a rescan in the Windows disk manager
  • The partition did show up in Disk Management almost immediately
  • When clicking on the (newly partitioned) VHD disk I got a bluescreen. Here's the dump log
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - Die Anweisung in 0x%08lx verweist auf Speicher 0x%08lx. Der Vorgang %s konnte nicht im Speicher durchgef hrt werden.

FAULTING_IP: 
FsDepends!DepFSInstanceSetup+25f
fffff880`09feda17 488b4110        mov     rax,qword ptr [rcx+10h]

CONTEXT:  fffff8800d942960 -- (.cxr 0xfffff8800d942960)
rax=fffffa80068babb0 rbx=fffff8800d943410 rcx=0000000000000000
rdx=0000000000000000 rsi=0000000000000001 rdi=0000000000000000
rip=fffff88009feda17 rsp=fffff8800d943340 rbp=0000000000000005
 r8=0000000080000005  r9=fffff80003e0f000 r10=fffff88003507be0
r11=fffff8800d943240 r12=0000000000000078 r13=0000000000000000
r14=0000000000000000 r15=0000000000000008
iopl=0         nv up ei pl zr na po nc
cs=0010  ss=0018  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
FsDepends!DepFSInstanceSetup+0x25f:
fffff880`09feda17 488b4110        mov     rax,qword ptr [rcx+10h] ds:002b:00000000`00000010=????????????????
Resetting default scope

DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT

BUGCHECK_STR:  0x3B

PROCESS_NAME:  vds.exe

CURRENT_IRQL:  0

LAST_CONTROL_TRANSFER:  from fffff88001500116 to fffff88009feda17

STACK_TEXT:  
fffff880`0d943340 fffff880`01500116 : fffffa80`0e441a40 fffffa80`07172cb0 00000000`00000005 fffff880`0d9435e8 : FsDepends!DepFSInstanceSetup+0x25f
fffff880`0d9433f0 fffff880`014ff11b : 00000000`00000000 fffffa80`0e206810 00000000`00000000 fffffa80`0e441a40 : fltmgr!FltpDoInstanceSetupNotification+0x86
fffff880`0d943450 fffff880`014ffed1 : fffff8a0`183733d0 ffffffff`80003940 fffff8a0`00000005 00000000`000007ff : fltmgr!FltpInitInstance+0x27b
fffff880`0d9434c0 fffff880`01500dab : fffff8a0`1cab8200 00000000`00000000 00000000`00000050 00000000`0000001a : fltmgr!FltpCreateInstanceFromName+0x1d1
fffff880`0d943590 fffff880`014fedbc : fffffa80`07172cc0 fffffa80`07515ac0 fffffa80`07172cc0 00000000`00000022 : fltmgr!FltpEnumerateRegistryInstances+0x15b
fffff880`0d943630 fffff880`014fa3f0 : fffffa80`0e206810 fffffa80`00000000 fffffa80`07172cc0 fffffa80`07515ac0 : fltmgr!FltpDoFilterNotificationForNewVolume+0xec
fffff880`0d9436a0 fffff800`0418643b : 00000000`00000025 00000000`00000040 fffffa80`0cab92c0 00000000`00000000 : fltmgr!FltpCreate+0x3e0
fffff880`0d943750 fffff800`0418244e : fffffa80`0b0154f0 00000000`00000000 fffffa80`0d0a4010 00000000`00000001 : nt!IopParseDevice+0x14e2
fffff880`0d9438b0 fffff800`04182f36 : 00000000`00000000 fffff880`0d943a30 fffff880`00000040 fffffa80`066598e0 : nt!ObpLookupObjectName+0x784
fffff880`0d9439b0 fffff800`0418483c : 00000000`00000000 00000000`00000000 fffffa80`0c49e201 ffffffff`ffffffff : nt!ObOpenObjectByName+0x306
fffff880`0d943a80 fffff800`0418feb4 : 00000000`0230f678 00000000`80100080 00000000`0230f6c8 00000000`0230f688 : nt!IopCreateFile+0x2bc
fffff880`0d943b20 fffff800`03e82313 : 00000000`00000000 0000007f`ffffffff 00000000`00000000 00000980`00000000 : nt!NtCreateFile+0x78
fffff880`0d943bb0 00000000`76ebd90a : 000007fe`fcc348b6 00000000`00000000 00000000`80000000 00000000`00000000 : nt!KiSystemServiceCopyEnd+0x13
00000000`0230f5f8 000007fe`fcc348b6 : 00000000`00000000 00000000`80000000 00000000`00000000 00000000`00000000 : ntdll!ZwCreateFile+0xa
00000000`0230f600 00000000`76c60dad : 00000000`0230fad0 00000000`80000000 00000000`00000003 000007fe`fec3b52b : KERNELBASE!CreateFileW+0x2cd
00000000`0230f760 000007fe`e2fb978d : 00000000`00000000 00000000`003388f0 00000000`00000003 00000000`0230fad0 : kernel32!CreateFileWImplementation+0x7d
00000000`0230f7c0 000007fe`e2fb9aa9 : 00000000`00000000 00000000`00000000 00000000`003388f0 00000000`0230fc68 : vdsdyn!DynOpenDevice+0x13d
00000000`0230fa80 000007fe`e2fe70fc : 00000000`00000000 00000000`00000000 00000000`00000000 000007fe`e2fe7014 : vdsdyn!DynGetVolumeDeviceNumber+0x7d
00000000`0230fc50 00000000`76c659ed : 00000000`00000000 00000000`000f423f 00000000`00000000 00000000`00000000 : vdsdyn!g_ProcessPnpNotification+0xe8
00000000`0230fcc0 00000000`76e9b371 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0xd
00000000`0230fcf0 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x1d


FOLLOWUP_IP: 
FsDepends!DepFSInstanceSetup+25f
fffff880`09feda17 488b4110        mov     rax,qword ptr [rcx+10h]

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  FsDepends!DepFSInstanceSetup+25f

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: FsDepends

IMAGE_NAME:  FsDepends.sys

DEBUG_FLR_IMAGE_TIMESTAMP:  4a5bc295

STACK_COMMAND:  .cxr 0xfffff8800d942960 ; kb

FAILURE_BUCKET_ID:  X64_0x3B_FsDepends!DepFSInstanceSetup+25f

BUCKET_ID:  X64_0x3B_FsDepends!DepFSInstanceSetup+25f

Followup: MachineOwner
---------

Please don't track builds in source control

Hi!

First up, thanks for all the work you've done on this driver - it makes using BTRFS partitions on Windows a real breeze.

I've noticed that you track built versions of the driver in this repository - it is highly unrecommended to check in binary files into git.

I suggest that you use GitHub's releases feature to upload the prebuilt binaries - it will help keep the repository cleaner.

Bluescreen when iterating over files with Explorer (properties)

Version 0.8 on Windows 7 x64:

DUMP_CLASS: 1
DUMP_QUALIFIER: 0
BUILD_VERSION_STRING: 7601.18741.amd64fre.win7sp1_gdr.150202-1526
WRONG_SYMBOLS_TIMESTAMP: 54d0317d
WRONG_SYMBOLS_SIZE: 5e7000
FAULTING_MODULE: fffff8000285a000 nt
DEBUG_FLR_IMAGE_TIMESTAMP: 54d0317d
DUMP_TYPE: 0
BUGCHECK_P1: ffffffffc0000005
BUGCHECK_P2: fffff88002caf3e2
BUGCHECK_P3: fffff8800420d4f8
BUGCHECK_P4: fffff8800420cd50
EXCEPTION_CODE: (NTSTATUS) 0x54d0317d -
FAULTING_IP:
btrfs!update_tree_extents+602 [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 793]
fffff880`02caf3e2 8b402c mov eax,dword ptr [rax+2Ch]

EXCEPTION_RECORD: fffff8800420d4f8 -- (.exr 0xfffff8800420d4f8)
ExceptionAddress: fffff88002caf3e2 (btrfs!update_tree_extents+0x0000000000000602)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: 000000000000002c
Attempt to read from address 000000000000002c

CONTEXT: fffff8800420cd50 -- (.cxr 0xfffff8800420cd50)
rax=0000000000000000 rbx=fffffa80056d2060 rcx=fffff8a010bf0b83
rdx=fffff8a010bf0b83 rsi=fffffa8003fd8450 rdi=0000000000000001
rip=fffff88002caf3e2 rsp=fffff8800420d730 rbp=0000000000000080
r8=fffff8800420d6b8 r9=0000000000000001 r10=fffffa8003f40148
r11=fffff8a010bf0aa0 r12=fffffa8006745050 r13=fffff88002cbd7a0
r14=0000000000000000 r15=fffff80000b94080
iopl=0 nv up ei pl nz na pe nc
cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b efl=00010202
btrfs!update_tree_extents+0x602:
fffff88002caf3e2 8b402c mov eax,dword ptr [rax+2Ch] ds:002b:000000000000002c=????????
Resetting default scope

CPU_COUNT: 2
CPU_MHZ: d4b
CPU_VENDOR: GenuineIntel
CPU_FAMILY: 6
CPU_MODEL: 3a
CPU_STEPPING: 9
CURRENT_IRQL: 0
ANALYSIS_SESSION_HOST: URPC
ANALYSIS_SESSION_TIME: 01-11-2017 13:26:30.0205
ANALYSIS_VERSION: 10.0.10586.567 amd64fre
LAST_CONTROL_TRANSFER: from fffff88002caecc6 to fffff88002caf3e2
STACK_TEXT:
fffff8800420d730 fffff88002caecc6 : fffffa80067451a0 fffff8a003605bd0 0000000000000000 fffff8800420db80 : btrfs!update_tree_extents+0x602 [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 793]
fffff8800420d980 fffff88002cadb54 : fffffa80067451a0 0000000000000000 fffff8800420db80 fffff8800420db80 : btrfs!allocate_tree_extents+0x2f6 [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 1116]
fffff8800420da00 fffff88002cbd93b : fffffa80067451a0 0000000000000000 fffff8800420db80 0000000000000001 : btrfs!do_write+0x764 [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 5502]
fffff8800420db60 fffff88002cbd873 : fffffa80067451a0 fffffa8000000000 fffffa8000000000 fffff8800420dc00 : btrfs!do_flush+0x5b [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 5662]
fffff8800420dba0 fffff80002b6db8a : fffffa8006745050 fffff80002a4be80 fffff8800420dc70 fffffa80056d2060 : btrfs!flush_thread+0xd3 [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 5693]
fffff8800420dc00 fffff800028c08e6 : fffff80002a4be80 fffffa80056d2060 fffffa800401bb50 0000000000000000 : nt!PsCreateSystemThread+0x1da
fffff8800420dc40 0000000000000000 : fffff8800420e000 fffff88004208000 fffff8800420cca0 0000000000000000 : nt!KeInitializeSemaphore+0x25a
THREAD_SHA1_HASH_MOD_FUNC: 0bd7c172bee0e06aa4acb424ebc1375d875c8368
THREAD_SHA1_HASH_MOD_FUNC_OFFSET: 434b67b48b834ff5a6464515b05028d3f918ce26
THREAD_SHA1_HASH_MOD: d8536f19397b300fcb041d1189453fb65a43a6b1
FOLLOWUP_IP:
btrfs!update_tree_extents+602 [z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c @ 793]
fffff880`02caf3e2 8b402c mov eax,dword ptr [rax+2Ch]
FAULT_INSTR_CODE: 892c408b
FAULTING_SOURCE_LINE: z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c
FAULTING_SOURCE_FILE: z:\home\hellas\desktop\wine\fs\btrfs\src\flushthread.c
FAULTING_SOURCE_LINE_NUMBER: 793
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: nt_wrong_symbols!54D0317D5E7000
FOLLOWUP_NAME: MachineOwner
STACK_COMMAND: .cxr 0xfffff8800420cd50 ; kb
BUGCHECK_STR: 54D0317D
EXCEPTION_CODE_STR: 54D0317D
FAILURE_EXCEPTION_CODE: 54D0317D
EXCEPTION_STR: WRONG_SYMBOLS
PROCESS_NAME: ntoskrnl.wrong.symbols.exe
IMAGE_NAME: ntoskrnl.wrong.symbols.exe
MODULE_NAME: nt_wrong_symbols
BUCKET_ID: WRONG_SYMBOLS_X64_7601.18741.amd64fre.win7sp1_gdr.150202-1526_TIMESTAMP_150203-022501
DEFAULT_BUCKET_ID: WRONG_SYMBOLS_X64_7601.18741.amd64fre.win7sp1_gdr.150202-1526_TIMESTAMP_150203-022501
PRIMARY_PROBLEM_CLASS: WRONG_SYMBOLS
FAILURE_BUCKET_ID: WRONG_SYMBOLS_X64_7601.18741.amd64fre.win7sp1_gdr.150202-1526_TIMESTAMP_150203-022501_54D0317D_nt_wrong_symbols!54D0317D5E7000
TARGET_TIME: 2017-01-11T12:26:00.000Z
OSBUILD: 7601
OSSERVICEPACK: 1000
SERVICEPACK_NUMBER: 0
OS_REVISION: 0
SUITE_MASK: 272
PRODUCT_TYPE: 1
OSPLATFORM_TYPE: x64
OSNAME: Windows 7
OSEDITION: Windows 7 WinNt (Service Pack 1) TerminalServer SingleUserTS
OS_LOCALE:
USER_LCID: 0
OSBUILD_TIMESTAMP: 2015-02-03 03:25:01
BUILDDATESTAMP_STR: 150202-1526
BUILDLAB_STR: win7sp1_gdr
BUILDOSVER_STR: 6.1.7601.18741.amd64fre.win7sp1_gdr.150202-1526
ANALYSIS_SESSION_ELAPSED_TIME: 3c
ANALYSIS_SOURCE: KM
FAILURE_ID_HASH_STRING: km:wrong_symbols_x64_7601.18741.amd64fre.win7sp1_gdr.150202-1526_timestamp_150203-022501_54d0317d_nt_wrong_symbols!54d0317d5e7000
FAILURE_ID_HASH: {c3603831-0fe3-e90c-bda5-7cc3bb41a047}
Followup: MachineOwner

Allow to mount different subvolumes of one btrfs simultaniously

The current approach only allows for one subvolume mount per UUID. It would be nice if it was somehow possible to mount more then one subvolume per UUID.
e.g. my btrfs partition (subvolid 5) with the following subvolumes:
/@root (default subvolume)
/@home

for me on linux
@root gets mounted to /
@home gets mounted to /home

it would be nice if it was possible on windows to either replicate this in similar fashion
e.g. @root to X:/ and @home to X:/home
or @root to X:/ and @home to Y:/

Currently I have to set subvolid 5 explicitly so i can access both subvolumes.

Volume unaccessible after copying big files

v1.0.1 with lzo compression enabled.
After writing a file (via LXSS) with dd (or other bigger files) the Volume becomes unaccessible / unavailable. It says F:\ path not found ... bcs another process is using it.

Everything is ok after rebooting.

Debug (level 2) Log:

Starting logging at 2017-11-03 01:17:04
FFFFBD808888A700:fsctl_request:STUB: FSCTL_GET_NTFS_VOLUME_DATA
FFFFBD808633C080:fsctl_request:unknown control code 94264 (DeviceType = 9, Access = 1, Function = 99, Method = 0)
FFFFBD808B792700:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808B792700:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6B0080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C419700:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C2AB040:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C2AB040:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C2AB040:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C2AB040:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C2AB040:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6CD080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD808C6CD080:fsctl_request:STUB: FSCTL_REQUEST_OPLOCK
FFFFBD8087505700:query_info:unknown FileInformationClass 68

Issue relocating "Users" folder to Btrfs partition

When the partition is Btrfs, Windows fails to move the Users folder to that partition. There is no issue when the partition is NTFS.

Tested with Windows 10 Pro (both 32 bit and 64 bit). I have not tried other versions of Windows.
The issue is present with both 0.5 and 0.6 Btrfs driver versions

Steps to reproduce the issue (works on both hardware and VM):
(based on http://www.tenforums.com/tutorials/1964-users-folder-move-location-windows-10-a.html )

  1. Fresh install Windows 10
  2. At the first install wizard:
    • Remove Windows install media
    • Insert Linux Live CD
    • hit Ctrl Shift F3 to enter Audit mode
  3. When it restarts, boot into Linux Live CD
    • (To make things easier for multiple tests, you might want to shutdown the VM at this point and archive it so you can extract it and come back to this point later)
  4. Create a new "shared" partition (Either NTFS or Btrfs)
  5. Restart and continue into Audit mode
  6. Enable Testing mode, restart
    • run as admin: bcdedit -set TESTSIGNING ON
  7. Install Btrfs driver, restart
  8. Still in audit mode, use sysprep with an unattend file to move C:\Users to (for example) F:\Users
    • run as admin:
    • %windir%\system32\sysprep\sysprep.exe /oobe /reboot /unattend:F:\relocate.xml
  9. System restarts and comes back to the first install wizard

If at step 4 you created an NTFS partition, walking through the first install wizard ends with creating a new user account and works as it should.

If you created a Btrfs partition, it will not get to creating a new user. Instead, it will get stuck in a first wizard loop. A difference between 0.5 and 0.6: with 0.5 Windows does not successfully move all files to the Btrfs partition. Looks like with 0.6 it does successfully move everything.

Here's an example relocate.xml file to relocate the Users folder:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FolderLocations>
<ProfilesDirectory>F:\Users</ProfilesDirectory>
</FolderLocations>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:E:\sources\install.wim#Windows 10 Pro" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

There are 3 things you may need to change to reflect your setup:

  • processorArchitecture="amd64" may need to be processorArchitecture="x86" if using 32bit
  • <ProfilesDirectory>F:\Users</ProfilesDirectory> will need to have the drive letter of the target partition
  • cpi:source="wim:E:\sources\install.wim#Windows 10 Pro"
    • The #Windows 10 Pro needs to be the correct edition
    • E:\sources\install.win path needs to point to an accessible install.wim file

Let me know if you need clarification on anything, or if there's anything I can do to help.

Create a btrfs volume

On Win7, I wanted to try out the btrfs driver without repartitioning. As it already worked with an ext3 volume, I tried a VHD again:

  • Created a virtual disk (VHD) (it's dynamicly growing if it matters).
  • Attach it.
  • Disk manager shows volume with MBR but no partitions.

But how do I create a btrfs volume in it?

Installed 1.0 on top of old install, nothing works.

After running the v1.0 install inf file (While still having the old one installed) I tried to open my btrfs volume, but I was met with a bluescreen. After trying to uninstall the old one and also trying to install the new one again, I think I just broke everything. I disabled and removed the btrfs key in regedit, deleted the btrfs file in C:/Windows. Now when I try to install the 1.0 inf file I get an error saying installation failed and then a pop-up saying operation completed successfully but even then my btrfs partition doesn't open. Any advice on how I fucked up would be appreciated.

Mount read-only by default

Hi,

when I install the driver and reboot, all btrfs partitions are mounted read/write by default. As far as I am aware, the only way to prevent this is to either

  1. know the subkey of HKLM\SYSTEM\CurrentControlSet\Services\btrfs corresponding to my partition and set HKLM\SYSTEM\CurrentControlSet\Services\btrfs\<SUBKEY>\Readonly to 1 prior to activating the driver, or
  2. alter the source code of the driver.

Arguably, making read/write access opt-in rather than opt-out makes for a more sensible default:

  1. Windows creates the /$RECYCLE.BIN and /System Volume Information directories at all the mounted partitions. You generally don't want these in the root directory of your linux btrfs partitions.
  2. After a test boot with the driver installed, I found that my root btrfs filesystem was corrupted (all safely backed up) to the point where it would not mount on linux 4.9.30 given the following /etc/fstab line
/dev/sdXY / btrfs discard,relatime,compress 0 0

without running btrfs check --repair /dev/sdXY first. Attached is the output of btrfs check:

$ btrfs --version
btrfs-progs v4.12
$ btrfs check sdXY.img
Checking filesystem on sdXY.img
UUID: 0c71059e-c962-4709-8db9-664684cca639
checking extents
checksum verify failed on 25861799936 found E4E3BDB6 wanted 00000000
checksum verify failed on 25861799936 found E4E3BDB6 wanted 00000000
bytenr mismatch, want=25861799936, have=0
ERROR: errors found in extent allocation tree or chunk allocation
root item for root 511, current bytenr 25861799936, current gen 323909, current level 2, new bytenr 25925255168, new gen 323915, new level 2
Found 1 roots with an outdated root item.
Please run a filesystem check with the option --repair to fix them.

I can provide parts of the image should you wish to investigate further.

For the above reasons, I suggest the driver should create HKLM\SYSTEM\CurrentControlSet\Services\btrfs\<SUBKEY>\Readonly with the value of 1 for all the new btrfs partitions it detects and that read/write access should become opt-in rather than opt-out.

Registry groups mapping

There is no mention of groups mappings, only user mapping.
If groups mappings are supported, please update readme, if not, please consider this as a feature suggestion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.