Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ build/
test/manual_scripts/create1000.go
test/manual_scripts/cachetest.go
lint.log

# Windows binaries
*.exe

# Log files
common/log/logfile.txt*
azure-storage-fuse
bfusemon
test/scripts/dirIterate.go
Expand Down
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Blobfuse2 - A Microsoft supported Azure Storage FUSE driver
## About
Blobfuse2 is an open source project developed to provide a virtual filesystem backed by the Azure Storage. It uses the libfuse open source library (fuse3) to communicate with the Linux FUSE kernel module, and implements the filesystem operations using the Azure Storage REST APIs.
# Blobfuse2 - A Microsoft supported Azure Storage FUSE driver

## About
Blobfuse2 is an open source project developed to provide a virtual filesystem backed by the Azure Storage. It uses the libfuse open source library (fuse3) to communicate with the Linux FUSE kernel module, and implements the filesystem operations using the Azure Storage REST APIs. **Windows support** is available through WinFsp integration.

This is the next generation [blobfuse](https://github.com/Azure/azure-storage-fuse).

## About Data Consistency and Concurrency
Expand Down Expand Up @@ -30,17 +32,20 @@ Please submit an issue [here](https://github.com/azure/azure-storage-fuse/issues
## Blobfuse2 Benchmarks
[This](https://azure.github.io/azure-storage-fuse/) page lists various benchmarking results for HNS and FNS Storage account.

## Supported Platforms
Visit [this](https://github.com/Azure/azure-storage-fuse/wiki/Blobfuse2-Supported-Platforms) page to see list of supported linux distros.

## Features
- Mount an Azure storage blob container or datalake file system on Linux.
- Basic file system operations such as mkdir, opendir, readdir, rmdir, open,
read, create, write, close, unlink, truncate, stat, rename
- Local caching to improve subsequent access times
- Block-Cache to support reading AND writing large files
- Parallel downloads and uploads to improve access time for large files
- Multiple mounts to the same container for read-only workloads
## Supported Platforms
Visit [this](https://github.com/Azure/azure-storage-fuse/wiki/Blobfuse2-Supported-Platforms) page to see list of supported linux distros.

**Windows support** is available through WinFsp integration. See [Windows Support Documentation](./doc/windows-support.md) for details.

## Features
- Mount an Azure storage blob container or datalake file system on Linux and Windows.
- Basic file system operations such as mkdir, opendir, readdir, rmdir, open,
read, create, write, close, unlink, truncate, stat, rename
- Local caching to improve subsequent access times
- Block-Cache to support reading AND writing large files
- Parallel downloads and uploads to improve access time for large files
- Multiple mounts to the same container for read-only workloads
- Cross-platform support: Linux (via libfuse) and Windows (via WinFsp)

## _New BlobFuse2 Health Monitor_
One of the biggest BlobFuse2 features is our brand new health monitor. It allows customers gain more insight into how their BlobFuse2 instance is behaving with the rest of their machine. Visit [here](https://github.com/Azure/azure-storage-fuse/blob/main/tools/health-monitor/README.md) to set it up.
Expand Down
65 changes: 65 additions & 0 deletions common/dynlib.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
_____ _____ _____ ____ ______ _____ ------
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| --- | | | | |-----| |---- | | |-----| |----- ------
| | | | | | | | | | | | |
| ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____


Licensed under the MIT License <http://opensource.org/licenses/MIT>.

Copyright © 2020-2025 Microsoft Corporation. All rights reserved.
Author : <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
*/

package common

import "unsafe"

// DynamicLibrary represents a handle to a dynamically loaded library
type DynamicLibrary struct {
handle uintptr
}

// LoadLibrary loads a dynamic library from the given path
func LoadLibrary(path string) (*DynamicLibrary, error) {
handle, err := loadLibrary(path)
if err != nil {
return nil, err
}
return &DynamicLibrary{handle: handle}, nil
}

// GetSymbol retrieves a symbol (function pointer) from the library
func (dl *DynamicLibrary) GetSymbol(name string) (unsafe.Pointer, error) {
return getSymbol(dl.handle, name)
}

// Close closes the dynamic library
func (dl *DynamicLibrary) Close() error {
if dl.handle == 0 {
return nil
}
err := closeLibrary(dl.handle)
dl.handle = 0
return err
}
77 changes: 77 additions & 0 deletions common/dynlib_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//go:build !windows

/*
_____ _____ _____ ____ ______ _____ ------
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| --- | | | | |-----| |---- | | |-----| |----- ------
| | | | | | | | | | | | |
| ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____


Licensed under the MIT License <http://opensource.org/licenses/MIT>.

Copyright © 2020-2025 Microsoft Corporation. All rights reserved.
Author : <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
*/

package common

/*
#include <dlfcn.h>
#include <stdlib.h>
*/
import "C"
import (
"errors"
"unsafe"
)

func loadLibrary(path string) (uintptr, error) {
cPath := C.CString(path)
defer C.free(unsafe.Pointer(cPath))

handle := C.dlopen(cPath, C.RTLD_LAZY)
if handle == nil {
return 0, errors.New("failed to load library: " + path)
}

return uintptr(handle), nil
}

func getSymbol(handle uintptr, name string) (unsafe.Pointer, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))

symbol := C.dlsym(unsafe.Pointer(handle), cName)
if symbol == nil {
return nil, errors.New("failed to get symbol: " + name)
}

return symbol, nil
}

func closeLibrary(handle uintptr) error {
if C.dlclose(unsafe.Pointer(handle)) != 0 {
return errors.New("failed to close library")
}
return nil
}
84 changes: 84 additions & 0 deletions common/dynlib_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
//go:build windows

/*
_____ _____ _____ ____ ______ _____ ------
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| --- | | | | |-----| |---- | | |-----| |----- ------
| | | | | | | | | | | | |
| ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____


Licensed under the MIT License <http://opensource.org/licenses/MIT>.

Copyright © 2020-2025 Microsoft Corporation. All rights reserved.
Author : <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
*/

package common

import (
"syscall"
"unsafe"
)

var (
kernel32dll = syscall.NewLazyDLL("kernel32.dll")
procLoadLibrary = kernel32dll.NewProc("LoadLibraryW")
procGetProcAddress = kernel32dll.NewProc("GetProcAddress")
procFreeLibrary = kernel32dll.NewProc("FreeLibrary")
)

func loadLibrary(path string) (uintptr, error) {
pathPtr, err := syscall.UTF16PtrFromString(path)
if err != nil {
return 0, err
}

ret, _, err := procLoadLibrary.Call(uintptr(unsafe.Pointer(pathPtr)))
if ret == 0 {
return 0, err
}

return ret, nil
}

func getSymbol(handle uintptr, name string) (unsafe.Pointer, error) {
namePtr, err := syscall.BytePtrFromString(name)
if err != nil {
return nil, err
}

ret, _, err := procGetProcAddress.Call(handle, uintptr(unsafe.Pointer(namePtr)))
if ret == 0 {
return nil, err
}

return unsafe.Pointer(ret), nil
}

func closeLibrary(handle uintptr) error {
ret, _, err := procFreeLibrary.Call(handle)
if ret == 0 {
return err
}
return nil
}
51 changes: 51 additions & 0 deletions common/fsstat.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
_____ _____ _____ ____ ______ _____ ------
| | | | | | | | | | | | |
| | | | | | | | | | | | |
| --- | | | | |-----| |---- | | |-----| |----- ------
| | | | | | | | | | | | |
| ____| |_____ | ____| | ____| | |_____| _____| |_____ |_____


Licensed under the MIT License <http://opensource.org/licenses/MIT>.

Copyright © 2020-2025 Microsoft Corporation. All rights reserved.
Author : <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
*/

package common

// FilesystemStat represents cross-platform filesystem statistics
type FilesystemStat struct {
Blocks uint64 // Total blocks
Bfree uint64 // Free blocks
Bavail uint64 // Available blocks for non-root users
Bsize uint64 // Block size
Frsize uint64 // Fragment size
Files uint64 // Total inodes
Ffree uint64 // Free inodes
Flags uint64 // Mount flags
}

// GetFilesystemStat gets filesystem statistics for the given path
func GetFilesystemStat(path string) (*FilesystemStat, error) {
return getFilesystemStat(path)
}
Loading