Supported Features
With "weed mount", the files can be operated as a local file. The following operations are supported.
- file read / write
- create new file
- mkdir
- list
- remove
- rename
- chmod
- chown
- soft link
- display free disk space
Mount as FUSE
This uses seaweedfs/fuse, which enables writing FUSE file systems on Linux and OS X. On OS X, it requires OSXFUSE (http://osxfuse.github.com/).
- # assuming you already started weed master, weed volume and filer
- weed mount -filer=localhost:8888 -dir=/some/existing/dir -filer.path=/one/remote/folder
- weed mount -filer=localhost:8888 -dir=/some/existing/dir -filer.path=/
- # example: mount one collection and a folder to a local directory
- weed mount -filer=localhost:8888 -dir=~/folder_on_seaweedfs -filer.path=/home/chris -collection=chris
Now you can operate the SeaweedFS files, browsing or modifying directories and files, in local file system.To unmount, just shut it down the "weed mount".
Weed Mount Architecture
"weed mount" has a persistent client connecting to Master, to get the location updates of all volumes.There are no network round trip to lookup the volume id location.
For reads:
- Client Reads File Metadata => Weed Filer => Weed Filer database (LevelDB, Cassandra, Redis, Mysql, Postgres, etc)
- Client Reads File Chunks => Weed Volume Servers
For writes:
- Client uploads data to Weed Volume Servers, and breaks the large files into chunks.
- Client writes the metadata and chunk information into Filer and then into Filer database.
Weed Mount Performance Benchmark
"sysbench" is used here. If you have better benchmarking tools, please share your results.
$ brew install sysbench
$ cd /a/mounted/folder
$ sysbench --test=fileio --file-total-size=1G prepare
$ sysbench --test=fileio --file-total-size=1G --file-test-mode=rndrw --max-time=300 --max-requests=0 --num-threads=1 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 8MiB each
1GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 1246.96
writes/s: 831.31
fsyncs/s: 2660.22
Throughput:
read, MiB/s: 19.48
written, MiB/s: 12.99
General statistics:
total time: 300.0036s
total number of events: 1421441
Latency (ms):
min: 0.00
avg: 0.21
max: 175.59
95th percentile: 0.84
sum: 298364.02
Threads fairness:
events (avg/stddev): 1421441.0000/0.00
execution time (avg/stddev): 298.3640/0.00
The above is single-threaded. The following uses 32 threads.
$ sysbench --test=fileio --file-total-size=1G --file-test-mode=rndrw --max-time=300 --max-requests=0 --num-threads=32 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 32
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 8MiB each
1GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 7704.72
writes/s: 5136.55
fsyncs/s: 16450.24
Throughput:
read, MiB/s: 120.39
written, MiB/s: 80.26
General statistics:
total time: 300.0279s
total number of events: 8784212
Latency (ms):
min: 0.00
avg: 1.09
max: 188.01
95th percentile: 5.00
sum: 9582443.42
Threads fairness:
events (avg/stddev): 274506.6250/1270.81
execution time (avg/stddev): 299.4514/0.00
Common Problems
Unmount
Sometimes weed mount
can not start if the last mount process was not cleaned up.
You can clean up with these commands. Try any of them until it works:
// on mac
sudo umount /the/mounted/dir
diskutil unmount force /the/mounted/dir
sudo umount -f /the/mounted/dir
sudo umount -l /the/mounted/dir
// on linux
sudo umount -f /the/mounted/dir
sudo umount -l /the/mounted/dir
Still fail to mount on MacOS
From https://github.com/osxfuse/osxfuse/issues/358
FUSE needs to register a virtual device for exchanging messages between the kernel and the actual file system implementation running in user space. The number of available device slots is limited by macOS. So if you are using other software like VMware, VirtualBox, TunTap, Intel HAXM, …, that eat up all free device slots, FUSE will not be able to register its virtual device.
Samba share mounted folder
From https://github.com/chrislusf/seaweedfs/issues/936The issue is with samba.conf. If you see NT_STATUS_ACCESS_DENIED error, try to add force user
and force group
to your samba.conf file.
[profiles]
comment = Users profiles
path = /home/chris/mm
guest ok = yes
browseable = yes
create mask = 0775
directory mask = 0775
force user = root
force group = root