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/).

  1. # assuming you already started weed master, weed volume and filer
  2. weed mount -filer=localhost:8888 -dir=/some/existing/dir -filer.path=/one/remote/folder
  3. weed mount -filer=localhost:8888 -dir=/some/existing/dir -filer.path=/
  4. # example: mount one collection and a folder to a local directory
  5. 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 ServersMount - 图1

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.Mount - 图2

Weed Mount Performance Benchmark

"sysbench" is used here. If you have better benchmarking tools, please share your results.

  1. $ brew install sysbench
  2. $ cd /a/mounted/folder
  3. $ sysbench --test=fileio --file-total-size=1G prepare
  4. $ sysbench --test=fileio --file-total-size=1G --file-test-mode=rndrw --max-time=300 --max-requests=0 --num-threads=1 run
  5. WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
  6. WARNING: --max-time is deprecated, use --time instead
  7. sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)
  8. Running the test with following options:
  9. Number of threads: 1
  10. Initializing random number generator from current time
  11. Extra file open flags: (none)
  12. 128 files, 8MiB each
  13. 1GiB total file size
  14. Block size 16KiB
  15. Number of IO requests: 0
  16. Read/Write ratio for combined random IO test: 1.50
  17. Periodic FSYNC enabled, calling fsync() each 100 requests.
  18. Calling fsync() at the end of test, Enabled.
  19. Using synchronous I/O mode
  20. Doing random r/w test
  21. Initializing worker threads...
  22. Threads started!
  23. File operations:
  24. reads/s: 1246.96
  25. writes/s: 831.31
  26. fsyncs/s: 2660.22
  27. Throughput:
  28. read, MiB/s: 19.48
  29. written, MiB/s: 12.99
  30. General statistics:
  31. total time: 300.0036s
  32. total number of events: 1421441
  33. Latency (ms):
  34. min: 0.00
  35. avg: 0.21
  36. max: 175.59
  37. 95th percentile: 0.84
  38. sum: 298364.02
  39. Threads fairness:
  40. events (avg/stddev): 1421441.0000/0.00
  41. execution time (avg/stddev): 298.3640/0.00

The above is single-threaded. The following uses 32 threads.

  1. $ sysbench --test=fileio --file-total-size=1G --file-test-mode=rndrw --max-time=300 --max-requests=0 --num-threads=32 run
  2. WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
  3. WARNING: --num-threads is deprecated, use --threads instead
  4. WARNING: --max-time is deprecated, use --time instead
  5. sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2)
  6. Running the test with following options:
  7. Number of threads: 32
  8. Initializing random number generator from current time
  9. Extra file open flags: (none)
  10. 128 files, 8MiB each
  11. 1GiB total file size
  12. Block size 16KiB
  13. Number of IO requests: 0
  14. Read/Write ratio for combined random IO test: 1.50
  15. Periodic FSYNC enabled, calling fsync() each 100 requests.
  16. Calling fsync() at the end of test, Enabled.
  17. Using synchronous I/O mode
  18. Doing random r/w test
  19. Initializing worker threads...
  20. Threads started!
  21. File operations:
  22. reads/s: 7704.72
  23. writes/s: 5136.55
  24. fsyncs/s: 16450.24
  25. Throughput:
  26. read, MiB/s: 120.39
  27. written, MiB/s: 80.26
  28. General statistics:
  29. total time: 300.0279s
  30. total number of events: 8784212
  31. Latency (ms):
  32. min: 0.00
  33. avg: 1.09
  34. max: 188.01
  35. 95th percentile: 5.00
  36. sum: 9582443.42
  37. Threads fairness:
  38. events (avg/stddev): 274506.6250/1270.81
  39. 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:

  1. // on mac
  2. sudo umount /the/mounted/dir
  3. diskutil unmount force /the/mounted/dir
  4. sudo umount -f /the/mounted/dir
  5. sudo umount -l /the/mounted/dir
  6. // on linux
  7. sudo umount -f /the/mounted/dir
  8. 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.

  1. [profiles]
  2. comment = Users profiles
  3. path = /home/chris/mm
  4. guest ok = yes
  5. browseable = yes
  6. create mask = 0775
  7. directory mask = 0775
  8. force user = root
  9. force group = root