You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3206 lines
117 KiB

7 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
3 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
9 years ago
6 years ago
9 years ago
9 years ago
9 years ago
9 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
3 years ago
9 years ago
4 years ago
7 years ago
7 years ago
9 years ago
9 years ago
9 years ago
  1. .\"t
  2. .\" Automatically generated by Pandoc 2.9.2.1
  3. .\"
  4. .TH "mergerfs" "1" "" "mergerfs user manual" ""
  5. .hy
  6. .SH NAME
  7. .PP
  8. mergerfs - a featureful union filesystem
  9. .SH SYNOPSIS
  10. .PP
  11. mergerfs -o<options> <branches> <mountpoint>
  12. .SH DESCRIPTION
  13. .PP
  14. \f[B]mergerfs\f[R] is a union filesystem geared towards simplifying
  15. storage and management of files across numerous commodity storage
  16. devices.
  17. It is similar to \f[B]mhddfs\f[R], \f[B]unionfs\f[R], and
  18. \f[B]aufs\f[R].
  19. .SH FEATURES
  20. .IP \[bu] 2
  21. Configurable behaviors / file placement
  22. .IP \[bu] 2
  23. Ability to add or remove filesystems at will
  24. .IP \[bu] 2
  25. Resistance to individual filesystem failure
  26. .IP \[bu] 2
  27. Support for extended attributes (xattrs)
  28. .IP \[bu] 2
  29. Support for file attributes (chattr)
  30. .IP \[bu] 2
  31. Runtime configurable (via xattrs)
  32. .IP \[bu] 2
  33. Works with heterogeneous filesystem types
  34. .IP \[bu] 2
  35. Moving of file when filesystem runs out of space while writing
  36. .IP \[bu] 2
  37. Ignore read-only filesystems when creating files
  38. .IP \[bu] 2
  39. Turn read-only files into symlinks to underlying file
  40. .IP \[bu] 2
  41. Hard link copy-on-write / CoW
  42. .IP \[bu] 2
  43. Support for POSIX ACLs
  44. .IP \[bu] 2
  45. Misc other things
  46. .SH HOW IT WORKS
  47. .PP
  48. mergerfs logically merges multiple paths together.
  49. Think a union of sets.
  50. The file/s or directory/s acted on or presented through mergerfs are
  51. based on the policy chosen for that particular action.
  52. Read more about policies below.
  53. .IP
  54. .nf
  55. \f[C]
  56. A + B = C
  57. /disk1 /disk2 /merged
  58. | | |
  59. +-- /dir1 +-- /dir1 +-- /dir1
  60. | | | | | |
  61. | +-- file1 | +-- file2 | +-- file1
  62. | | +-- file3 | +-- file2
  63. +-- /dir2 | | +-- file3
  64. | | +-- /dir3 |
  65. | +-- file4 | +-- /dir2
  66. | +-- file5 | |
  67. +-- file6 | +-- file4
  68. |
  69. +-- /dir3
  70. | |
  71. | +-- file5
  72. |
  73. +-- file6
  74. \f[R]
  75. .fi
  76. .PP
  77. mergerfs does \f[B]not\f[R] support the copy-on-write (CoW) or whiteout
  78. behaviors found in \f[B]aufs\f[R] and \f[B]overlayfs\f[R].
  79. You can \f[B]not\f[R] mount a read-only filesystem and write to it.
  80. However, mergerfs will ignore read-only filesystems when creating new
  81. files so you can mix read-write and read-only filesystems.
  82. It also does \f[B]not\f[R] split data across filesystems.
  83. It is not RAID0 / striping.
  84. It is simply a union of other filesystems.
  85. .SH TERMINOLOGY
  86. .IP \[bu] 2
  87. branch: A base path used in the pool.
  88. .IP \[bu] 2
  89. pool: The mergerfs mount.
  90. The union of the branches.
  91. .IP \[bu] 2
  92. relative path: The path in the pool relative to the branch and mount.
  93. .IP \[bu] 2
  94. function: A filesystem call (open, unlink, create, getattr, rmdir, etc.)
  95. .IP \[bu] 2
  96. category: A collection of functions based on basic behavior (action,
  97. create, search).
  98. .IP \[bu] 2
  99. policy: The algorithm used to select a file when performing a function.
  100. .IP \[bu] 2
  101. path preservation: Aspect of some policies which includes checking the
  102. path for which a file would be created.
  103. .SH BASIC SETUP
  104. .PP
  105. If you don\[cq]t already know that you have a special use case then just
  106. start with one of the following option sets.
  107. .SS You need \f[C]mmap\f[R] (used by rtorrent and many sqlite3 base software)
  108. .PP
  109. \f[C]cache.files=partial,dropcacheonclose=true,category.create=mfs\f[R]
  110. .SS You don\[cq]t need \f[C]mmap\f[R]
  111. .PP
  112. \f[C]cache.files=off,dropcacheonclose=true,category.create=mfs\f[R]
  113. .SS Command Line
  114. .PP
  115. \f[C]mergerfs -o cache.files=partial,dropcacheonclose=true,category.create=mfs /mnt/hdd0:/mnt/hdd1 /media\f[R]
  116. .SS /etc/fstab
  117. .PP
  118. \f[C]/mnt/hdd0:/mnt/hdd1 /media fuse.mergerfs cache.files=partial,dropcacheonclose=true,category.create=mfs 0 0\f[R]
  119. .SS systemd mount
  120. .PP
  121. https://github.com/trapexit/mergerfs/wiki/systemd
  122. .IP
  123. .nf
  124. \f[C]
  125. [Unit]
  126. Description=mergerfs service
  127. [Service]
  128. Type=simple
  129. KillMode=none
  130. ExecStart=/usr/bin/mergerfs \[rs]
  131. -f \[rs]
  132. -o cache.files=partial \[rs]
  133. -o dropcacheonclose=true \[rs]
  134. -o category.create=mfs \[rs]
  135. /mnt/hdd0:/mnt/hdd1 \[rs]
  136. /media
  137. ExecStop=/bin/fusermount -uz /media
  138. Restart=on-failure
  139. [Install]
  140. WantedBy=default.target
  141. \f[R]
  142. .fi
  143. .PP
  144. See the mergerfs wiki for real world
  145. deployments (https://github.com/trapexit/mergerfs/wiki/Real-World-Deployments)
  146. for comparisons / ideas.
  147. .SH OPTIONS
  148. .PP
  149. These options are the same regardless of whether you use them with the
  150. \f[C]mergerfs\f[R] commandline program, in fstab, or in a config file.
  151. .SS mount options
  152. .IP \[bu] 2
  153. \f[B]config\f[R]: Path to a config file.
  154. Same arguments as below in key=val / ini style format.
  155. .IP \[bu] 2
  156. \f[B]branches\f[R]: Colon delimited list of branches.
  157. .IP \[bu] 2
  158. \f[B]minfreespace=SIZE\f[R]: The minimum space value used for creation
  159. policies.
  160. Can be overridden by branch specific option.
  161. Understands `K', `M', and `G' to represent kilobyte, megabyte, and
  162. gigabyte respectively.
  163. (default: 4G)
  164. .IP \[bu] 2
  165. \f[B]moveonenospc=BOOL|POLICY\f[R]: When enabled if a \f[B]write\f[R]
  166. fails with \f[B]ENOSPC\f[R] (no space left on device) or
  167. \f[B]EDQUOT\f[R] (disk quota exceeded) the policy selected will run to
  168. find a new location for the file.
  169. An attempt to move the file to that branch will occur (keeping all
  170. metadata possible) and if successful the original is unlinked and the
  171. write retried.
  172. (default: false, true = mfs)
  173. .IP \[bu] 2
  174. \f[B]inodecalc=passthrough|path-hash|devino-hash|hybrid-hash\f[R]:
  175. Selects the inode calculation algorithm.
  176. (default: hybrid-hash)
  177. .IP \[bu] 2
  178. \f[B]dropcacheonclose=BOOL\f[R]: When a file is requested to be closed
  179. call \f[C]posix_fadvise\f[R] on it first to instruct the kernel that we
  180. no longer need the data and it can drop its cache.
  181. Recommended when
  182. \f[B]cache.files=partial|full|auto-full|per-process\f[R] to limit double
  183. caching.
  184. (default: false)
  185. .IP \[bu] 2
  186. \f[B]symlinkify=BOOL\f[R]: When enabled and a file is not writable and
  187. its mtime or ctime is older than \f[B]symlinkify_timeout\f[R] files will
  188. be reported as symlinks to the original files.
  189. Please read more below before using.
  190. (default: false)
  191. .IP \[bu] 2
  192. \f[B]symlinkify_timeout=UINT\f[R]: Time to wait, in seconds, to activate
  193. the \f[B]symlinkify\f[R] behavior.
  194. (default: 3600)
  195. .IP \[bu] 2
  196. \f[B]nullrw=BOOL\f[R]: Turns reads and writes into no-ops.
  197. The request will succeed but do nothing.
  198. Useful for benchmarking mergerfs.
  199. (default: false)
  200. .IP \[bu] 2
  201. \f[B]lazy-umount-mountpoint=BOOL\f[R]: mergerfs will attempt to
  202. \[lq]lazy umount\[rq] the mountpoint before mounting itself.
  203. Useful when performing live upgrades of mergerfs.
  204. (default: false)
  205. .IP \[bu] 2
  206. \f[B]ignorepponrename=BOOL\f[R]: Ignore path preserving on rename.
  207. Typically rename and link act differently depending on the policy of
  208. \f[C]create\f[R] (read below).
  209. Enabling this will cause rename and link to always use the non-path
  210. preserving behavior.
  211. This means files, when renamed or linked, will stay on the same
  212. filesystem.
  213. (default: false)
  214. .IP \[bu] 2
  215. \f[B]security_capability=BOOL\f[R]: If false return ENOATTR when xattr
  216. security.capability is queried.
  217. (default: true)
  218. .IP \[bu] 2
  219. \f[B]xattr=passthrough|noattr|nosys\f[R]: Runtime control of xattrs.
  220. Default is to passthrough xattr requests.
  221. `noattr' will short circuit as if nothing exists.
  222. `nosys' will respond with ENOSYS as if xattrs are not supported or
  223. disabled.
  224. (default: passthrough)
  225. .IP \[bu] 2
  226. \f[B]link_cow=BOOL\f[R]: When enabled if a regular file is opened which
  227. has a link count > 1 it will copy the file to a temporary file and
  228. rename over the original.
  229. Breaking the link and providing a basic copy-on-write function similar
  230. to cow-shell.
  231. (default: false)
  232. .IP \[bu] 2
  233. \f[B]statfs=base|full\f[R]: Controls how statfs works.
  234. `base' means it will always use all branches in statfs calculations.
  235. `full' is in effect path preserving and only includes branches where the
  236. path exists.
  237. (default: base)
  238. .IP \[bu] 2
  239. \f[B]statfs_ignore=none|ro|nc\f[R]: `ro' will cause statfs calculations
  240. to ignore available space for branches mounted or tagged as `read-only'
  241. or `no create'.
  242. `nc' will ignore available space for branches tagged as `no create'.
  243. (default: none)
  244. .IP \[bu] 2
  245. \f[B]nfsopenhack=off|git|all\f[R]: A workaround for exporting mergerfs
  246. over NFS where there are issues with creating files for write while
  247. setting the mode to read-only.
  248. (default: off)
  249. .IP \[bu] 2
  250. \f[B]branches-mount-timeout=UINT\f[R]: Number of seconds to wait at
  251. startup for branches to be a mount other than the mountpoint\[cq]s
  252. filesystem.
  253. (default: 0)
  254. .IP \[bu] 2
  255. \f[B]follow-symlinks=never|directory|regular|all\f[R]: Turns symlinks
  256. into what they point to.
  257. (default: never)
  258. .IP \[bu] 2
  259. \f[B]link-exdev=passthrough|rel-symlink|abs-base-symlink|abs-pool-symlink\f[R]:
  260. When a link fails with EXDEV optionally create a symlink to the file
  261. instead.
  262. .IP \[bu] 2
  263. \f[B]rename-exdev=passthrough|rel-symlink|abs-symlink\f[R]: When a
  264. rename fails with EXDEV optionally move the file to a special directory
  265. and symlink to it.
  266. .IP \[bu] 2
  267. \f[B]readahead=UINT\f[R]: Set readahead (in kilobytes) for mergerfs and
  268. branches if greater than 0.
  269. (default: 0)
  270. .IP \[bu] 2
  271. \f[B]posix_acl=BOOL\f[R]: Enable POSIX ACL support (if supported by
  272. kernel and underlying filesystem).
  273. (default: false)
  274. .IP \[bu] 2
  275. \f[B]async_read=BOOL\f[R]: Perform reads asynchronously.
  276. If disabled or unavailable the kernel will ensure there is at most one
  277. pending read request per file handle and will attempt to order requests
  278. by offset.
  279. (default: true)
  280. .IP \[bu] 2
  281. \f[B]fuse_msg_size=UINT\f[R]: Set the max number of pages per FUSE
  282. message.
  283. Only available on Linux >= 4.20 and ignored otherwise.
  284. (min: 1; max: 256; default: 256)
  285. .IP \[bu] 2
  286. \f[B]threads=INT\f[R]: Number of threads to use.
  287. When used alone (\f[C]process-thread-count=-1\f[R]) it sets the number
  288. of threads reading and processing FUSE messages.
  289. When used together it sets the number of threads reading from FUSE.
  290. When set to zero it will attempt to discover and use the number of
  291. logical cores.
  292. If the thread count is set negative it will look up the number of cores
  293. then divide by the absolute value.
  294. ie.
  295. threads=-2 on an 8 core machine will result in 8 / 2 = 4 threads.
  296. There will always be at least 1 thread.
  297. If set to -1 in combination with \f[C]process-thread-count\f[R] then it
  298. will try to pick reasonable values based on CPU thread count.
  299. NOTE: higher number of threads increases parallelism but usually
  300. decreases throughput.
  301. (default: 0)
  302. .IP \[bu] 2
  303. \f[B]read-thread-count=INT\f[R]: Alias for \f[C]threads\f[R].
  304. .IP \[bu] 2
  305. \f[B]process-thread-count=INT\f[R]: Enables separate thread pool to
  306. asynchronously process FUSE requests.
  307. In this mode \f[C]read-thread-count\f[R] refers to the number of threads
  308. reading FUSE messages which are dispatched to process threads.
  309. -1 means disabled otherwise acts like \f[C]read-thread-count\f[R].
  310. (default: -1)
  311. .IP \[bu] 2
  312. \f[B]process-thread-queue-depth=UINT\f[R]: Sets the number of requests
  313. any single process thread can have queued up at one time.
  314. Meaning the total memory usage of the queues is queue depth multiplied
  315. by the number of process threads plus read thread count.
  316. 0 sets the depth to the same as the process thread count.
  317. (default: 0)
  318. .IP \[bu] 2
  319. \f[B]pin-threads=STR\f[R]: Selects a strategy to pin threads to CPUs
  320. (default: unset)
  321. .IP \[bu] 2
  322. \f[B]flush-on-close=never|always|opened-for-write\f[R]: Flush data cache
  323. on file close.
  324. Mostly for when writeback is enabled or merging network filesystems.
  325. (default: opened-for-write)
  326. .IP \[bu] 2
  327. \f[B]scheduling-priority=INT\f[R]: Set mergerfs\[cq] scheduling
  328. priority.
  329. Valid values range from -20 to 19.
  330. See \f[C]setpriority\f[R] man page for more details.
  331. (default: -10)
  332. .IP \[bu] 2
  333. \f[B]fsname=STR\f[R]: Sets the name of the filesystem as seen in
  334. \f[B]mount\f[R], \f[B]df\f[R], etc.
  335. Defaults to a list of the source paths concatenated together with the
  336. longest common prefix removed.
  337. .IP \[bu] 2
  338. \f[B]func.FUNC=POLICY\f[R]: Sets the specific FUSE function\[cq]s
  339. policy.
  340. See below for the list of value types.
  341. Example: \f[B]func.getattr=newest\f[R]
  342. .IP \[bu] 2
  343. \f[B]func.readdir=seq|cosr|cor|cosr:INT|cor:INT\f[R]: Sets
  344. \f[C]readdir\f[R] policy.
  345. INT value sets the number of threads to use for concurrency.
  346. (default: seq)
  347. .IP \[bu] 2
  348. \f[B]category.action=POLICY\f[R]: Sets policy of all FUSE functions in
  349. the action category.
  350. (default: epall)
  351. .IP \[bu] 2
  352. \f[B]category.create=POLICY\f[R]: Sets policy of all FUSE functions in
  353. the create category.
  354. (default: epmfs)
  355. .IP \[bu] 2
  356. \f[B]category.search=POLICY\f[R]: Sets policy of all FUSE functions in
  357. the search category.
  358. (default: ff)
  359. .IP \[bu] 2
  360. \f[B]cache.open=UINT\f[R]: `open' policy cache timeout in seconds.
  361. (default: 0)
  362. .IP \[bu] 2
  363. \f[B]cache.statfs=UINT\f[R]: `statfs' cache timeout in seconds.
  364. (default:
  365. .RS 2
  366. .RE
  367. .IP \[bu] 2
  368. \f[B]cache.attr=UINT\f[R]: File attribute cache timeout in seconds.
  369. (default: 1)
  370. .IP \[bu] 2
  371. \f[B]cache.entry=UINT\f[R]: File name lookup cache timeout in seconds.
  372. (default: 1)
  373. .IP \[bu] 2
  374. \f[B]cache.negative_entry=UINT\f[R]: Negative file name lookup cache
  375. timeout in seconds.
  376. (default: 0)
  377. .IP \[bu] 2
  378. \f[B]cache.files=libfuse|off|partial|full|auto-full|per-process\f[R]:
  379. File page caching mode (default: libfuse)
  380. .IP \[bu] 2
  381. \f[B]cache.files.process-names=LIST\f[R]: A pipe | delimited list of
  382. process comm (https://man7.org/linux/man-pages/man5/proc.5.html) names
  383. to enable page caching for when \f[C]cache.files=per-process\f[R].
  384. (default: \[lq]rtorrent|qbittorrent-nox\[rq])
  385. .IP \[bu] 2
  386. \f[B]cache.writeback=BOOL\f[R]: Enable kernel writeback caching
  387. (default: false)
  388. .IP \[bu] 2
  389. \f[B]cache.symlinks=BOOL\f[R]: Cache symlinks (if supported by kernel)
  390. (default: false)
  391. .IP \[bu] 2
  392. \f[B]cache.readdir=BOOL\f[R]: Cache readdir (if supported by kernel)
  393. (default: false)
  394. .IP \[bu] 2
  395. \f[B]parallel-direct-writes=BOOL\f[R]: Allow the kernel to dispatch
  396. multiple, parallel (non-extending) write requests for files opened with
  397. \f[C]cache.files=per-process\f[R] (if the process is not in
  398. \f[C]process-names\f[R]) or \f[C]cache.files=off\f[R].
  399. (This requires kernel support, and was added in v6.2)
  400. .IP \[bu] 2
  401. \f[B]direct_io\f[R]: deprecated - Bypass page cache.
  402. Use \f[C]cache.files=off\f[R] instead.
  403. (default: false)
  404. .IP \[bu] 2
  405. \f[B]kernel_cache\f[R]: deprecated - Do not invalidate data cache on
  406. file open.
  407. Use \f[C]cache.files=full\f[R] instead.
  408. (default: false)
  409. .IP \[bu] 2
  410. \f[B]auto_cache\f[R]: deprecated - Invalidate data cache if file mtime
  411. or size change.
  412. Use \f[C]cache.files=auto-full\f[R] instead.
  413. (default: false)
  414. .IP \[bu] 2
  415. \f[B]async_read\f[R]: deprecated - Perform reads asynchronously.
  416. Use \f[C]async_read=true\f[R] instead.
  417. .IP \[bu] 2
  418. \f[B]sync_read\f[R]: deprecated - Perform reads synchronously.
  419. Use \f[C]async_read=false\f[R] instead.
  420. .IP \[bu] 2
  421. \f[B]splice_read\f[R]: deprecated - Does nothing.
  422. .IP \[bu] 2
  423. \f[B]splice_write\f[R]: deprecated - Does nothing.
  424. .IP \[bu] 2
  425. \f[B]splice_move\f[R]: deprecated - Does nothing.
  426. .IP \[bu] 2
  427. \f[B]allow_other\f[R]: deprecated - mergerfs v2.35.0 and newer sets this
  428. FUSE option automatically if running as root.
  429. .IP \[bu] 2
  430. \f[B]use_ino\f[R]: deprecated - mergerfs should always control inode
  431. calculation so this is enabled all the time.
  432. .PP
  433. \f[B]NOTE:\f[R] Options are evaluated in the order listed so if the
  434. options are \f[B]func.rmdir=rand,category.action=ff\f[R] the
  435. \f[B]action\f[R] category setting will override the \f[B]rmdir\f[R]
  436. setting.
  437. .PP
  438. \f[B]NOTE:\f[R] Always look at the documentation for the version of
  439. mergerfs you\[cq]re using.
  440. Not all features are available in older releases.
  441. Use \f[C]man mergerfs\f[R] or find the docs as linked in the release.
  442. .SS Value Types
  443. .IP \[bu] 2
  444. BOOL = `true' | `false'
  445. .IP \[bu] 2
  446. INT = [MIN_INT,MAX_INT]
  447. .IP \[bu] 2
  448. UINT = [0,MAX_INT]
  449. .IP \[bu] 2
  450. SIZE = `NNM'; NN = INT, M = `K' | `M' | `G' | `T'
  451. .IP \[bu] 2
  452. STR = string (may refer to an enumerated value, see details of argument)
  453. .IP \[bu] 2
  454. FUNC = filesystem function
  455. .IP \[bu] 2
  456. CATEGORY = function category
  457. .IP \[bu] 2
  458. POLICY = mergerfs function policy
  459. .SS branches
  460. .PP
  461. The `branches' argument is a colon (`:') delimited list of paths to be
  462. pooled together.
  463. It does not matter if the paths are on the same or different filesystems
  464. nor does it matter the filesystem type (within reason).
  465. Used and available space will not be duplicated for paths on the same
  466. filesystem and any features which aren\[cq]t supported by the underlying
  467. filesystem (such as file attributes or extended attributes) will return
  468. the appropriate errors.
  469. .PP
  470. Branches currently have two options which can be set.
  471. A type which impacts whether or not the branch is included in a policy
  472. calculation and a individual minfreespace value.
  473. The values are set by prepending an \f[C]=\f[R] at the end of a branch
  474. designation and using commas as delimiters.
  475. Example: \f[C]/mnt/drive=RW,1234\f[R]
  476. .SS branch mode
  477. .IP \[bu] 2
  478. RW: (read/write) - Default behavior.
  479. Will be eligible in all policy categories.
  480. .IP \[bu] 2
  481. RO: (read-only) - Will be excluded from \f[C]create\f[R] and
  482. \f[C]action\f[R] policies.
  483. Same as a read-only mounted filesystem would be (though faster to
  484. process).
  485. .IP \[bu] 2
  486. NC: (no-create) - Will be excluded from \f[C]create\f[R] policies.
  487. You can\[cq]t create on that branch but you can change or delete.
  488. .SS minfreespace
  489. .PP
  490. Same purpose and syntax as the global option but specific to the branch.
  491. If not set the global value is used.
  492. .SS globbing
  493. .PP
  494. To make it easier to include multiple branches mergerfs supports
  495. globbing (http://linux.die.net/man/7/glob).
  496. \f[B]The globbing tokens MUST be escaped when using via the shell else
  497. the shell itself will apply the glob itself.\f[R]
  498. .IP
  499. .nf
  500. \f[C]
  501. # mergerfs /mnt/hdd\[rs]*:/mnt/ssd /media
  502. \f[R]
  503. .fi
  504. .PP
  505. The above line will use all mount points in /mnt prefixed with
  506. \f[B]hdd\f[R] and \f[B]ssd\f[R].
  507. .PP
  508. To have the pool mounted at boot or otherwise accessible from related
  509. tools use \f[B]/etc/fstab\f[R].
  510. .IP
  511. .nf
  512. \f[C]
  513. # <file system> <mount point> <type> <options> <dump> <pass>
  514. /mnt/hdd*:/mnt/ssd /media fuse.mergerfs minfreespace=16G 0 0
  515. \f[R]
  516. .fi
  517. .PP
  518. \f[B]NOTE:\f[R] the globbing is done at mount or when updated using the
  519. runtime API.
  520. If a new directory is added matching the glob after the fact it will not
  521. be automatically included.
  522. .PP
  523. \f[B]NOTE:\f[R] for mounting via \f[B]fstab\f[R] to work you must have
  524. \f[B]mount.fuse\f[R] installed.
  525. For Ubuntu/Debian it is included in the \f[B]fuse\f[R] package.
  526. .SS inodecalc
  527. .PP
  528. Inodes (st_ino) are unique identifiers within a filesystem.
  529. Each mounted filesystem has device ID (st_dev) as well and together they
  530. can uniquely identify a file on the whole of the system.
  531. Entries on the same device with the same inode are in fact references to
  532. the same underlying file.
  533. It is a many to one relationship between names and an inode.
  534. Directories, however, do not have multiple links on most systems due to
  535. the complexity they add.
  536. .PP
  537. FUSE allows the server (mergerfs) to set inode values but not device
  538. IDs.
  539. Creating an inode value is somewhat complex in mergerfs\[cq] case as
  540. files aren\[cq]t really in its control.
  541. If a policy changes what directory or file is to be selected or
  542. something changes out of band it becomes unclear what value should be
  543. used.
  544. Most software does not to care what the values are but those that do
  545. often break if a value changes unexpectedly.
  546. The tool \f[C]find\f[R] will abort a directory walk if it sees a
  547. directory inode change.
  548. NFS will return stale handle errors if the inode changes out of band.
  549. File dedup tools will usually leverage device ids and inodes as a
  550. shortcut in searching for duplicate files and would resort to full file
  551. comparisons should it find different inode values.
  552. .PP
  553. mergerfs offers multiple ways to calculate the inode in hopes of
  554. covering different usecases.
  555. .IP \[bu] 2
  556. passthrough: Passes through the underlying inode value.
  557. Mostly intended for testing as using this does not address any of the
  558. problems mentioned above and could confuse file deduplication software
  559. as inodes from different filesystems can be the same.
  560. .IP \[bu] 2
  561. path-hash: Hashes the relative path of the entry in question.
  562. The underlying file\[cq]s values are completely ignored.
  563. This means the inode value will always be the same for that file path.
  564. This is useful when using NFS and you make changes out of band such as
  565. copy data between branches.
  566. This also means that entries that do point to the same file will not be
  567. recognizable via inodes.
  568. That \f[B]does not\f[R] mean hard links don\[cq]t work.
  569. They will.
  570. .IP \[bu] 2
  571. path-hash32: 32bit version of path-hash.
  572. .IP \[bu] 2
  573. devino-hash: Hashes the device id and inode of the underlying entry.
  574. This won\[cq]t prevent issues with NFS should the policy pick a
  575. different file or files move out of band but will present the same inode
  576. for underlying files that do too.
  577. .IP \[bu] 2
  578. devino-hash32: 32bit version of devino-hash.
  579. .IP \[bu] 2
  580. hybrid-hash: Performs \f[C]path-hash\f[R] on directories and
  581. \f[C]devino-hash\f[R] on other file types.
  582. Since directories can\[cq]t have hard links the static value won\[cq]t
  583. make a difference and the files will get values useful for finding
  584. duplicates.
  585. Probably the best to use if not using NFS.
  586. As such it is the default.
  587. .IP \[bu] 2
  588. hybrid-hash32: 32bit version of hybrid-hash.
  589. .PP
  590. 32bit versions are provided as there is some software which does not
  591. handle 64bit inodes well.
  592. .PP
  593. While there is a risk of hash collision in tests of a couple million
  594. entries there were zero collisions.
  595. Unlike a typical filesystem FUSE filesystems can reuse inodes and not
  596. refer to the same entry.
  597. The internal identifier used to reference a file in FUSE is different
  598. from the inode value presented.
  599. The former is the \f[C]nodeid\f[R] and is actually a tuple of 2 64bit
  600. values: \f[C]nodeid\f[R] and \f[C]generation\f[R].
  601. This tuple is not client facing.
  602. The inode that is presented to the client is passed through the kernel
  603. uninterpreted.
  604. .PP
  605. From FUSE docs for \f[C]use_ino\f[R]:
  606. .IP
  607. .nf
  608. \f[C]
  609. Honor the st_ino field in the functions getattr() and
  610. fill_dir(). This value is used to fill in the st_ino field
  611. in the stat(2), lstat(2), fstat(2) functions and the d_ino
  612. field in the readdir(2) function. The filesystem does not
  613. have to guarantee uniqueness, however some applications
  614. rely on this value being unique for the whole filesystem.
  615. Note that this does *not* affect the inode that libfuse
  616. and the kernel use internally (also called the \[dq]nodeid\[dq]).
  617. \f[R]
  618. .fi
  619. .PP
  620. As of version 2.35.0 the \f[C]use_ino\f[R] option has been removed.
  621. mergerfs should always be managing inode values.
  622. .SS pin-threads
  623. .PP
  624. Simple strategies for pinning read and/or process threads.
  625. If process threads are not enabled than the strategy simply works on the
  626. read threads.
  627. Invalid values are ignored.
  628. .IP \[bu] 2
  629. R1L: All read threads pinned to a single logical CPU.
  630. .IP \[bu] 2
  631. R1P: All read threads pinned to a single physical CPU.
  632. .IP \[bu] 2
  633. RP1L: All read and process threads pinned to a single logical CPU.
  634. .IP \[bu] 2
  635. RP1P: All read and process threads pinned to a single physical CPU.
  636. .IP \[bu] 2
  637. R1LP1L: All read threads pinned to a single logical CPU, all process
  638. threads pinned to a (if possible) different logical CPU.
  639. .IP \[bu] 2
  640. R1PP1P: All read threads pinned to a single physical CPU, all process
  641. threads pinned to a (if possible) different logical CPU.
  642. .IP \[bu] 2
  643. RPSL: All read and process threads are spread across all logical CPUs.
  644. .IP \[bu] 2
  645. RPSP: All read and process threads are spread across all physical CPUs.
  646. .IP \[bu] 2
  647. R1PPSP: All read threads are pinned to a single physical CPU while
  648. process threads are spread across all other phsycial CPUs.
  649. .SS fuse_msg_size
  650. .PP
  651. FUSE applications communicate with the kernel over a special character
  652. device: \f[C]/dev/fuse\f[R].
  653. A large portion of the overhead associated with FUSE is the cost of
  654. going back and forth from user space and kernel space over that device.
  655. Generally speaking the fewer trips needed the better the performance
  656. will be.
  657. Reducing the number of trips can be done a number of ways.
  658. Kernel level caching and increasing message sizes being two significant
  659. ones.
  660. When it comes to reads and writes if the message size is doubled the
  661. number of trips are approximately halved.
  662. .PP
  663. In Linux 4.20 a new feature was added allowing the negotiation of the
  664. max message size.
  665. Since the size is in multiples of
  666. pages (https://en.wikipedia.org/wiki/Page_(computer_memory)) the feature
  667. is called \f[C]max_pages\f[R].
  668. There is a maximum \f[C]max_pages\f[R] value of 256 (1MiB) and minimum
  669. of 1 (4KiB).
  670. The default used by Linux >=4.20, and hardcoded value used before 4.20,
  671. is 32 (128KiB).
  672. In mergerfs its referred to as \f[C]fuse_msg_size\f[R] to make it clear
  673. what it impacts and provide some abstraction.
  674. .PP
  675. Since there should be no downsides to increasing \f[C]fuse_msg_size\f[R]
  676. / \f[C]max_pages\f[R], outside a minor bump in RAM usage due to larger
  677. message buffers, mergerfs defaults the value to 256.
  678. On kernels before 4.20 the value has no effect.
  679. The reason the value is configurable is to enable experimentation and
  680. benchmarking.
  681. See the BENCHMARKING section for examples.
  682. .SS follow-symlinks
  683. .PP
  684. This feature, when enabled, will cause symlinks to be interpreted by
  685. mergerfs as their target (depending on the mode).
  686. .PP
  687. When there is a getattr/stat request for a file mergerfs will check if
  688. the file is a symlink and depending on the \f[C]follow-symlinks\f[R]
  689. setting will replace the information about the symlink with that of that
  690. which it points to.
  691. .PP
  692. When unlink\[cq]ing or rmdir\[cq]ing the followed symlink it will remove
  693. the symlink itself and not that which it points to.
  694. .IP \[bu] 2
  695. never: Behave as normal.
  696. Symlinks are treated as such.
  697. .IP \[bu] 2
  698. directory: Resolve symlinks only which point to directories.
  699. .IP \[bu] 2
  700. regular: Resolve symlinks only which point to regular files.
  701. .IP \[bu] 2
  702. all: Resolve all symlinks to that which they point to.
  703. .PP
  704. Symlinks which do not point to anything are left as is.
  705. .PP
  706. WARNING: This feature works but there might be edge cases yet found.
  707. If you find any odd behaviors please file a ticket on
  708. github (https://github.com/trapexit/mergerfs/issues).
  709. .SS link-exdev
  710. .PP
  711. If using path preservation and a \f[C]link\f[R] fails with EXDEV make a
  712. call to \f[C]symlink\f[R] where the \f[C]target\f[R] is the
  713. \f[C]oldlink\f[R] and the \f[C]linkpath\f[R] is the \f[C]newpath\f[R].
  714. The \f[C]target\f[R] value is determined by the value of
  715. \f[C]link-exdev\f[R].
  716. .IP \[bu] 2
  717. passthrough: Return EXDEV as normal.
  718. .IP \[bu] 2
  719. rel-symlink: A relative path from the \f[C]newpath\f[R].
  720. .IP \[bu] 2
  721. abs-base-symlink: A absolute value using the underlying branch.
  722. .IP \[bu] 2
  723. abs-pool-symlink: A absolute value using the mergerfs mount point.
  724. .PP
  725. NOTE: It is possible that some applications check the file they link.
  726. In those cases it is possible it will error or complain.
  727. .SS rename-exdev
  728. .PP
  729. If using path preservation and a \f[C]rename\f[R] fails with EXDEV:
  730. .IP "1." 3
  731. Move file from \f[B]/branch/a/b/c\f[R] to
  732. \f[B]/branch/.mergerfs_rename_exdev/a/b/c\f[R].
  733. .IP "2." 3
  734. symlink the rename\[cq]s \f[C]newpath\f[R] to the moved file.
  735. .PP
  736. The \f[C]target\f[R] value is determined by the value of
  737. \f[C]rename-exdev\f[R].
  738. .IP \[bu] 2
  739. passthrough: Return EXDEV as normal.
  740. .IP \[bu] 2
  741. rel-symlink: A relative path from the \f[C]newpath\f[R].
  742. .IP \[bu] 2
  743. abs-symlink: A absolute value using the mergerfs mount point.
  744. .PP
  745. NOTE: It is possible that some applications check the file they rename.
  746. In those cases it is possible it will error or complain.
  747. .PP
  748. NOTE: The reason \f[C]abs-symlink\f[R] is not split into two like
  749. \f[C]link-exdev\f[R] is due to the complexities in managing absolute
  750. base symlinks when multiple \f[C]oldpaths\f[R] exist.
  751. .SS symlinkify
  752. .PP
  753. Due to the levels of indirection introduced by mergerfs and the
  754. underlying technology FUSE there can be varying levels of performance
  755. degradation.
  756. This feature will turn non-directories which are not writable into
  757. symlinks to the original file found by the \f[C]readlink\f[R] policy
  758. after the mtime and ctime are older than the timeout.
  759. .PP
  760. \f[B]WARNING:\f[R] The current implementation has a known issue in which
  761. if the file is open and being used when the file is converted to a
  762. symlink then the application which has that file open will receive an
  763. error when using it.
  764. This is unlikely to occur in practice but is something to keep in mind.
  765. .PP
  766. \f[B]WARNING:\f[R] Some backup solutions, such as CrashPlan, do not
  767. backup the target of a symlink.
  768. If using this feature it will be necessary to point any backup software
  769. to the original filesystems or configure the software to follow symlinks
  770. if such an option is available.
  771. Alternatively create two mounts.
  772. One for backup and one for general consumption.
  773. .SS nullrw
  774. .PP
  775. Due to how FUSE works there is an overhead to all requests made to a
  776. FUSE filesystem that wouldn\[cq]t exist for an in kernel one.
  777. Meaning that even a simple passthrough will have some slowdown.
  778. However, generally the overhead is minimal in comparison to the cost of
  779. the underlying I/O.
  780. By disabling the underlying I/O we can test the theoretical performance
  781. boundaries.
  782. .PP
  783. By enabling \f[C]nullrw\f[R] mergerfs will work as it always does
  784. \f[B]except\f[R] that all reads and writes will be no-ops.
  785. A write will succeed (the size of the write will be returned as if it
  786. were successful) but mergerfs does nothing with the data it was given.
  787. Similarly a read will return the size requested but won\[cq]t touch the
  788. buffer.
  789. .PP
  790. See the BENCHMARKING section for suggestions on how to test.
  791. .SS xattr
  792. .PP
  793. Runtime extended attribute support can be managed via the
  794. \f[C]xattr\f[R] option.
  795. By default it will passthrough any xattr calls.
  796. Given xattr support is rarely used and can have significant performance
  797. implications mergerfs allows it to be disabled at runtime.
  798. The performance problems mostly comes when file caching is enabled.
  799. The kernel will send a \f[C]getxattr\f[R] for
  800. \f[C]security.capability\f[R] \f[I]before every single write\f[R].
  801. It doesn\[cq]t cache the responses to any \f[C]getxattr\f[R].
  802. This might be addressed in the future but for now mergerfs can really
  803. only offer the following workarounds.
  804. .PP
  805. \f[C]noattr\f[R] will cause mergerfs to short circuit all xattr calls
  806. and return ENOATTR where appropriate.
  807. mergerfs still gets all the requests but they will not be forwarded on
  808. to the underlying filesystems.
  809. The runtime control will still function in this mode.
  810. .PP
  811. \f[C]nosys\f[R] will cause mergerfs to return ENOSYS for any xattr call.
  812. The difference with \f[C]noattr\f[R] is that the kernel will cache this
  813. fact and itself short circuit future calls.
  814. This is more efficient than \f[C]noattr\f[R] but will cause
  815. mergerfs\[cq] runtime control via the hidden file to stop working.
  816. .SS nfsopenhack
  817. .PP
  818. NFS is not fully POSIX compliant and historically certain behaviors,
  819. such as opening files with O_EXCL, are not or not well supported.
  820. When mergerfs (or any FUSE filesystem) is exported over NFS some of
  821. these issues come up due to how NFS and FUSE interact.
  822. .PP
  823. This hack addresses the issue where the creation of a file with a
  824. read-only mode but with a read/write or write only flag.
  825. Normally this is perfectly valid but NFS chops the one open call into
  826. multiple calls.
  827. Exactly how it is translated depends on the configuration and versions
  828. of the NFS server and clients but it results in a permission error
  829. because a normal user is not allowed to open a read-only file as
  830. writable.
  831. .PP
  832. Even though it\[cq]s a more niche situation this hack breaks normal
  833. security and behavior and as such is \f[C]off\f[R] by default.
  834. If set to \f[C]git\f[R] it will only perform the hack when the path in
  835. question includes \f[C]/.git/\f[R].
  836. \f[C]all\f[R] will result it applying anytime a read-only file which is
  837. empty is opened for writing.
  838. .SH FUNCTIONS, CATEGORIES and POLICIES
  839. .PP
  840. The POSIX filesystem API is made up of a number of functions.
  841. \f[B]creat\f[R], \f[B]stat\f[R], \f[B]chown\f[R], etc.
  842. For ease of configuration in mergerfs most of the core functions are
  843. grouped into 3 categories: \f[B]action\f[R], \f[B]create\f[R], and
  844. \f[B]search\f[R].
  845. These functions and categories can be assigned a policy which dictates
  846. which branch is chosen when performing that function.
  847. .PP
  848. Some functions, listed in the category \f[C]N/A\f[R] below, can not be
  849. assigned the normal policies.
  850. These functions work with file handles, rather than file paths, which
  851. were created by \f[C]open\f[R] or \f[C]create\f[R].
  852. That said many times the current FUSE kernel driver will not always
  853. provide the file handle when a client calls \f[C]fgetattr\f[R],
  854. \f[C]fchown\f[R], \f[C]fchmod\f[R], \f[C]futimens\f[R],
  855. \f[C]ftruncate\f[R], etc.
  856. This means it will call the regular, path based, versions.
  857. \f[C]statfs\f[R]\[cq]s behavior can be modified via other options.
  858. .PP
  859. When using policies which are based on a branch\[cq]s available space
  860. the base path provided is used.
  861. Not the full path to the file in question.
  862. Meaning that mounts in the branch won\[cq]t be considered in the space
  863. calculations.
  864. The reason is that it doesn\[cq]t really work for non-path preserving
  865. policies and can lead to non-obvious behaviors.
  866. .PP
  867. NOTE: While any policy can be assigned to a function or category, some
  868. may not be very useful in practice.
  869. For instance: \f[B]rand\f[R] (random) may be useful for file creation
  870. (create) but could lead to very odd behavior if used for \f[C]chmod\f[R]
  871. if there were more than one copy of the file.
  872. .SS Functions and their Category classifications
  873. .PP
  874. .TS
  875. tab(@);
  876. lw(7.4n) lw(62.6n).
  877. T{
  878. Category
  879. T}@T{
  880. FUSE Functions
  881. T}
  882. _
  883. T{
  884. action
  885. T}@T{
  886. chmod, chown, link, removexattr, rename, rmdir, setxattr, truncate,
  887. unlink, utimens
  888. T}
  889. T{
  890. create
  891. T}@T{
  892. create, mkdir, mknod, symlink
  893. T}
  894. T{
  895. search
  896. T}@T{
  897. access, getattr, getxattr, ioctl (directories), listxattr, open,
  898. readlink
  899. T}
  900. T{
  901. N/A
  902. T}@T{
  903. fchmod, fchown, futimens, ftruncate, fallocate, fgetattr, fsync, ioctl
  904. (files), read, readdir, release, statfs, write, copy_file_range
  905. T}
  906. .TE
  907. .PP
  908. In cases where something may be searched for (such as a path to clone)
  909. \f[B]getattr\f[R] will usually be used.
  910. .SS Policies
  911. .PP
  912. A policy is the algorithm used to choose a branch or branches for a
  913. function to work on or generally how the function behaves.
  914. .PP
  915. Any function in the \f[C]create\f[R] category will clone the relative
  916. path if needed.
  917. Some other functions (\f[C]rename\f[R],\f[C]link\f[R],\f[C]ioctl\f[R])
  918. have special requirements or behaviors which you can read more about
  919. below.
  920. .SS Filtering
  921. .PP
  922. Most policies basically search branches and create a list of files /
  923. paths for functions to work on.
  924. The policy is responsible for filtering and sorting the branches.
  925. Filters include \f[B]minfreespace\f[R], whether or not a branch is
  926. mounted read-only, and the branch tagging (RO,NC,RW).
  927. These filters are applied across most policies.
  928. .IP \[bu] 2
  929. No \f[B]search\f[R] function policies filter.
  930. .IP \[bu] 2
  931. All \f[B]action\f[R] function policies filter out branches which are
  932. mounted \f[B]read-only\f[R] or tagged as \f[B]RO (read-only)\f[R].
  933. .IP \[bu] 2
  934. All \f[B]create\f[R] function policies filter out branches which are
  935. mounted \f[B]read-only\f[R], tagged \f[B]RO (read-only)\f[R] or \f[B]NC
  936. (no create)\f[R], or has available space less than
  937. \f[C]minfreespace\f[R].
  938. .PP
  939. Policies may have their own additional filtering such as those that
  940. require existing paths to be present.
  941. .PP
  942. If all branches are filtered an error will be returned.
  943. Typically \f[B]EROFS\f[R] (read-only filesystem) or \f[B]ENOSPC\f[R] (no
  944. space left on device) depending on the most recent reason for filtering
  945. a branch.
  946. \f[B]ENOENT\f[R] will be returned if no eligible branch is found.
  947. .PP
  948. If \f[B]create\f[R], \f[B]mkdir\f[R], \f[B]mknod\f[R], or
  949. \f[B]symlink\f[R] fail with \f[C]EROFS\f[R] or other fundimental errors
  950. then mergerfs will mark any branch found to be read-only as such (IE
  951. will set the mode \f[C]RO\f[R]) and will rerun the policy and try again.
  952. This is mostly for \f[C]ext4\f[R] filesystems that can suddenly become
  953. read-only when it encounters an error.
  954. .SS Path Preservation
  955. .PP
  956. Policies, as described below, are of two basic classifications.
  957. \f[C]path preserving\f[R] and \f[C]non-path preserving\f[R].
  958. .PP
  959. All policies which start with \f[C]ep\f[R] (\f[B]epff\f[R],
  960. \f[B]eplfs\f[R], \f[B]eplus\f[R], \f[B]epmfs\f[R], \f[B]eprand\f[R]) are
  961. \f[C]path preserving\f[R].
  962. \f[C]ep\f[R] stands for \f[C]existing path\f[R].
  963. .PP
  964. A path preserving policy will only consider branches where the relative
  965. path being accessed already exists.
  966. .PP
  967. When using non-path preserving policies paths will be cloned to target
  968. branches as necessary.
  969. .PP
  970. With the \f[C]msp\f[R] or \f[C]most shared path\f[R] policies they are
  971. defined as \f[C]path preserving\f[R] for the purpose of controlling
  972. \f[C]link\f[R] and \f[C]rename\f[R]\[cq]s behaviors since
  973. \f[C]ignorepponrename\f[R] is available to disable that behavior.
  974. .SS Policy descriptions
  975. .PP
  976. A policy\[cq]s behavior differs, as mentioned above, based on the
  977. function it is used with.
  978. Sometimes it really might not make sense to even offer certain policies
  979. because they are literally the same as others but it makes things a bit
  980. more uniform.
  981. .PP
  982. .TS
  983. tab(@);
  984. lw(16.2n) lw(53.8n).
  985. T{
  986. Policy
  987. T}@T{
  988. Description
  989. T}
  990. _
  991. T{
  992. all
  993. T}@T{
  994. Search: For \f[B]mkdir\f[R], \f[B]mknod\f[R], and \f[B]symlink\f[R] it
  995. will apply to all branches.
  996. \f[B]create\f[R] works like \f[B]ff\f[R].
  997. T}
  998. T{
  999. epall (existing path, all)
  1000. T}@T{
  1001. For \f[B]mkdir\f[R], \f[B]mknod\f[R], and \f[B]symlink\f[R] it will
  1002. apply to all found.
  1003. \f[B]create\f[R] works like \f[B]epff\f[R] (but more expensive because
  1004. it doesn\[cq]t stop after finding a valid branch).
  1005. T}
  1006. T{
  1007. epff (existing path, first found)
  1008. T}@T{
  1009. Given the order of the branches, as defined at mount time or configured
  1010. at runtime, act on the first one found where the relative path exists.
  1011. T}
  1012. T{
  1013. eplfs (existing path, least free space)
  1014. T}@T{
  1015. Of all the branches on which the relative path exists choose the branch
  1016. with the least free space.
  1017. T}
  1018. T{
  1019. eplus (existing path, least used space)
  1020. T}@T{
  1021. Of all the branches on which the relative path exists choose the branch
  1022. with the least used space.
  1023. T}
  1024. T{
  1025. epmfs (existing path, most free space)
  1026. T}@T{
  1027. Of all the branches on which the relative path exists choose the branch
  1028. with the most free space.
  1029. T}
  1030. T{
  1031. eppfrd (existing path, percentage free random distribution)
  1032. T}@T{
  1033. Like \f[B]pfrd\f[R] but limited to existing paths.
  1034. T}
  1035. T{
  1036. eprand (existing path, random)
  1037. T}@T{
  1038. Calls \f[B]epall\f[R] and then randomizes.
  1039. Returns 1.
  1040. T}
  1041. T{
  1042. ff (first found)
  1043. T}@T{
  1044. Given the order of the branches, as defined at mount time or configured
  1045. at runtime, act on the first one found.
  1046. T}
  1047. T{
  1048. lfs (least free space)
  1049. T}@T{
  1050. Pick the branch with the least available free space.
  1051. T}
  1052. T{
  1053. lus (least used space)
  1054. T}@T{
  1055. Pick the branch with the least used space.
  1056. T}
  1057. T{
  1058. mfs (most free space)
  1059. T}@T{
  1060. Pick the branch with the most available free space.
  1061. T}
  1062. T{
  1063. msplfs (most shared path, least free space)
  1064. T}@T{
  1065. Like \f[B]eplfs\f[R] but if it fails to find a branch it will try again
  1066. with the parent directory.
  1067. Continues this pattern till finding one.
  1068. T}
  1069. T{
  1070. msplus (most shared path, least used space)
  1071. T}@T{
  1072. Like \f[B]eplus\f[R] but if it fails to find a branch it will try again
  1073. with the parent directory.
  1074. Continues this pattern till finding one.
  1075. T}
  1076. T{
  1077. mspmfs (most shared path, most free space)
  1078. T}@T{
  1079. Like \f[B]epmfs\f[R] but if it fails to find a branch it will try again
  1080. with the parent directory.
  1081. Continues this pattern till finding one.
  1082. T}
  1083. T{
  1084. msppfrd (most shared path, percentage free random distribution)
  1085. T}@T{
  1086. Like \f[B]eppfrd\f[R] but if it fails to find a branch it will try again
  1087. with the parent directory.
  1088. Continues this pattern till finding one.
  1089. T}
  1090. T{
  1091. newest
  1092. T}@T{
  1093. Pick the file / directory with the largest mtime.
  1094. T}
  1095. T{
  1096. pfrd (percentage free random distribution)
  1097. T}@T{
  1098. Chooses a branch at random with the likelihood of selection based on a
  1099. branch\[cq]s available space relative to the total.
  1100. T}
  1101. T{
  1102. rand (random)
  1103. T}@T{
  1104. Calls \f[B]all\f[R] and then randomizes.
  1105. Returns 1 branch.
  1106. T}
  1107. .TE
  1108. .PP
  1109. \f[B]NOTE:\f[R] If you are using an underlying filesystem that reserves
  1110. blocks such as ext2, ext3, or ext4 be aware that mergerfs respects the
  1111. reservation by using \f[C]f_bavail\f[R] (number of free blocks for
  1112. unprivileged users) rather than \f[C]f_bfree\f[R] (number of free
  1113. blocks) in policy calculations.
  1114. \f[B]df\f[R] does NOT use \f[C]f_bavail\f[R], it uses \f[C]f_bfree\f[R],
  1115. so direct comparisons between \f[B]df\f[R] output and mergerfs\[cq]
  1116. policies is not appropriate.
  1117. .SS Defaults
  1118. .PP
  1119. .TS
  1120. tab(@);
  1121. l l.
  1122. T{
  1123. Category
  1124. T}@T{
  1125. Policy
  1126. T}
  1127. _
  1128. T{
  1129. action
  1130. T}@T{
  1131. epall
  1132. T}
  1133. T{
  1134. create
  1135. T}@T{
  1136. epmfs
  1137. T}
  1138. T{
  1139. search
  1140. T}@T{
  1141. ff
  1142. T}
  1143. .TE
  1144. .SS func.readdir
  1145. .PP
  1146. examples: \f[C]func.readdir=seq\f[R], \f[C]func.readdir=cor:4\f[R]
  1147. .PP
  1148. \f[C]readdir\f[R] has policies to control how it manages reading
  1149. directory content.
  1150. .PP
  1151. .TS
  1152. tab(@);
  1153. lw(26.7n) lw(43.3n).
  1154. T{
  1155. Policy
  1156. T}@T{
  1157. Description
  1158. T}
  1159. _
  1160. T{
  1161. seq
  1162. T}@T{
  1163. \[lq]sequential\[rq] : Iterate over branches in the order defined.
  1164. This is the default and traditional behavior found prior to the readdir
  1165. policy introduction.
  1166. T}
  1167. T{
  1168. cosr
  1169. T}@T{
  1170. \[lq]concurrent open, sequential read\[rq] : Concurrently open branch
  1171. directories using a thread pool and process them in order of definition.
  1172. This keeps memory and CPU usage low while also reducing the time spent
  1173. waiting on branches to respond.
  1174. Number of threads defaults to the number of logical cores.
  1175. Can be overwritten via the syntax \f[C]func.readdir=cosr:N\f[R] where
  1176. \f[C]N\f[R] is the number of threads.
  1177. T}
  1178. T{
  1179. cor
  1180. T}@T{
  1181. \[lq]concurrent open and read\[rq] : Concurrently open branch
  1182. directories and immediately start reading their contents using a thread
  1183. pool.
  1184. This will result in slightly higher memory and CPU usage but reduced
  1185. latency.
  1186. Particularly when using higher latency / slower speed network filesystem
  1187. branches.
  1188. Unlike \f[C]seq\f[R] and \f[C]cosr\f[R] the order of files could change
  1189. due the async nature of the thread pool.
  1190. Number of threads defaults to the number of logical cores.
  1191. Can be overwritten via the syntax \f[C]func.readdir=cor:N\f[R] where
  1192. \f[C]N\f[R] is the number of threads.
  1193. T}
  1194. .TE
  1195. .PP
  1196. Keep in mind that \f[C]readdir\f[R] mostly just provides a list of file
  1197. names in a directory and possibly some basic metadata about said files.
  1198. To know details about the files, as one would see from commands like
  1199. \f[C]find\f[R] or \f[C]ls\f[R], it is required to call \f[C]stat\f[R] on
  1200. the file which is controlled by \f[C]fuse.getattr\f[R].
  1201. .SS ioctl
  1202. .PP
  1203. When \f[C]ioctl\f[R] is used with an open file then it will use the file
  1204. handle which was created at the original \f[C]open\f[R] call.
  1205. However, when using \f[C]ioctl\f[R] with a directory mergerfs will use
  1206. the \f[C]open\f[R] policy to find the directory to act on.
  1207. .SS rename & link
  1208. .PP
  1209. \f[B]NOTE:\f[R] If you\[cq]re receiving errors from software when files
  1210. are moved / renamed / linked then you should consider changing the
  1211. create policy to one which is \f[B]not\f[R] path preserving, enabling
  1212. \f[C]ignorepponrename\f[R], or contacting the author of the offending
  1213. software and requesting that \f[C]EXDEV\f[R] (cross device / improper
  1214. link) be properly handled.
  1215. .PP
  1216. \f[C]rename\f[R] and \f[C]link\f[R] are tricky functions in a union
  1217. filesystem.
  1218. \f[C]rename\f[R] only works within a single filesystem or device.
  1219. If a rename can\[cq]t be done atomically due to the source and
  1220. destination paths existing on different mount points it will return
  1221. \f[B]-1\f[R] with \f[B]errno = EXDEV\f[R] (cross device / improper
  1222. link).
  1223. So if a \f[C]rename\f[R]\[cq]s source and target are on different
  1224. filesystems within the pool it creates an issue.
  1225. .PP
  1226. Originally mergerfs would return EXDEV whenever a rename was requested
  1227. which was cross directory in any way.
  1228. This made the code simple and was technically compliant with POSIX
  1229. requirements.
  1230. However, many applications fail to handle EXDEV at all and treat it as a
  1231. normal error or otherwise handle it poorly.
  1232. Such apps include: gvfsd-fuse v1.20.3 and prior, Finder / CIFS/SMB
  1233. client in Apple OSX 10.9+, NZBGet, Samba\[cq]s recycling bin feature.
  1234. .PP
  1235. As a result a compromise was made in order to get most software to work
  1236. while still obeying mergerfs\[cq] policies.
  1237. Below is the basic logic.
  1238. .IP \[bu] 2
  1239. If using a \f[B]create\f[R] policy which tries to preserve directory
  1240. paths (epff,eplfs,eplus,epmfs)
  1241. .RS 2
  1242. .IP \[bu] 2
  1243. Using the \f[B]rename\f[R] policy get the list of files to rename
  1244. .IP \[bu] 2
  1245. For each file attempt rename:
  1246. .RS 2
  1247. .IP \[bu] 2
  1248. If failure with ENOENT (no such file or directory) run \f[B]create\f[R]
  1249. policy
  1250. .IP \[bu] 2
  1251. If create policy returns the same branch as currently evaluating then
  1252. clone the path
  1253. .IP \[bu] 2
  1254. Re-attempt rename
  1255. .RE
  1256. .IP \[bu] 2
  1257. If \f[B]any\f[R] of the renames succeed the higher level rename is
  1258. considered a success
  1259. .IP \[bu] 2
  1260. If \f[B]no\f[R] renames succeed the first error encountered will be
  1261. returned
  1262. .IP \[bu] 2
  1263. On success:
  1264. .RS 2
  1265. .IP \[bu] 2
  1266. Remove the target from all branches with no source file
  1267. .IP \[bu] 2
  1268. Remove the source from all branches which failed to rename
  1269. .RE
  1270. .RE
  1271. .IP \[bu] 2
  1272. If using a \f[B]create\f[R] policy which does \f[B]not\f[R] try to
  1273. preserve directory paths
  1274. .RS 2
  1275. .IP \[bu] 2
  1276. Using the \f[B]rename\f[R] policy get the list of files to rename
  1277. .IP \[bu] 2
  1278. Using the \f[B]getattr\f[R] policy get the target path
  1279. .IP \[bu] 2
  1280. For each file attempt rename:
  1281. .RS 2
  1282. .IP \[bu] 2
  1283. If the source branch != target branch:
  1284. .RS 2
  1285. .IP \[bu] 2
  1286. Clone target path from target branch to source branch
  1287. .RE
  1288. .IP \[bu] 2
  1289. Rename
  1290. .RE
  1291. .IP \[bu] 2
  1292. If \f[B]any\f[R] of the renames succeed the higher level rename is
  1293. considered a success
  1294. .IP \[bu] 2
  1295. If \f[B]no\f[R] renames succeed the first error encountered will be
  1296. returned
  1297. .IP \[bu] 2
  1298. On success:
  1299. .RS 2
  1300. .IP \[bu] 2
  1301. Remove the target from all branches with no source file
  1302. .IP \[bu] 2
  1303. Remove the source from all branches which failed to rename
  1304. .RE
  1305. .RE
  1306. .PP
  1307. The the removals are subject to normal entitlement checks.
  1308. .PP
  1309. The above behavior will help minimize the likelihood of EXDEV being
  1310. returned but it will still be possible.
  1311. .PP
  1312. \f[B]link\f[R] uses the same strategy but without the removals.
  1313. .SS statfs / statvfs
  1314. .PP
  1315. statvfs (http://linux.die.net/man/2/statvfs) normalizes the source
  1316. filesystems based on the fragment size and sums the number of adjusted
  1317. blocks and inodes.
  1318. This means you will see the combined space of all sources.
  1319. Total, used, and free.
  1320. The sources however are dedupped based on the filesystem so multiple
  1321. sources on the same drive will not result in double counting its space.
  1322. Other filesystems mounted further down the tree of the branch will not
  1323. be included when checking the mount\[cq]s stats.
  1324. .PP
  1325. The options \f[C]statfs\f[R] and \f[C]statfs_ignore\f[R] can be used to
  1326. modify \f[C]statfs\f[R] behavior.
  1327. .SS flush-on-close
  1328. .PP
  1329. https://lkml.kernel.org/linux-fsdevel/20211024132607.1636952-1-amir73il\[at]gmail.com/T/
  1330. .PP
  1331. By default FUSE would issue a flush before the release of a file
  1332. descriptor.
  1333. This was considered a bit aggressive and a feature added to give the
  1334. FUSE server the ability to choose when that happens.
  1335. .PP
  1336. Options: * always * never * opened-for-write
  1337. .PP
  1338. For now it defaults to \[lq]opened-for-write\[rq] which is less
  1339. aggressive than the behavior before this feature was added.
  1340. It should not be a problem because the flush is really only relevant
  1341. when a file is written to.
  1342. Given flush is irrelevant for many filesystems in the future a branch
  1343. specific flag may be added so only files opened on a specific branch
  1344. would be flushed on close.
  1345. .SH ERROR HANDLING
  1346. .PP
  1347. POSIX filesystem functions offer a single return code meaning that there
  1348. is some complication regarding the handling of multiple branches as
  1349. mergerfs does.
  1350. It tries to handle errors in a way that would generally return
  1351. meaningful values for that particular function.
  1352. .SS chmod, chown, removexattr, setxattr, truncate, utimens
  1353. .IP "1)" 3
  1354. if no error: return 0 (success)
  1355. .IP "2)" 3
  1356. if no successes: return first error
  1357. .IP "3)" 3
  1358. if one of the files acted on was the same as the related search
  1359. function: return its value
  1360. .IP "4)" 3
  1361. return 0 (success)
  1362. .PP
  1363. While doing this increases the complexity and cost of error handling,
  1364. particularly step 3, this provides probably the most reasonable return
  1365. value.
  1366. .SS unlink, rmdir
  1367. .IP "1)" 3
  1368. if no errors: return 0 (success)
  1369. .IP "2)" 3
  1370. return first error
  1371. .PP
  1372. Older version of mergerfs would return success if any success occurred
  1373. but for unlink and rmdir there are downstream assumptions that, while
  1374. not impossible to occur, can confuse some software.
  1375. .SS others
  1376. .PP
  1377. For search functions there is always a single thing acted on and as such
  1378. whatever return value that comes from the single function call is
  1379. returned.
  1380. .PP
  1381. For create functions \f[C]mkdir\f[R], \f[C]mknod\f[R], and
  1382. \f[C]symlink\f[R] which don\[cq]t return a file descriptor and therefore
  1383. can have \f[C]all\f[R] or \f[C]epall\f[R] policies it will return
  1384. success if any of the calls succeed and an error otherwise.
  1385. .SH INSTALL
  1386. .PP
  1387. https://github.com/trapexit/mergerfs/releases
  1388. .PP
  1389. If your distribution\[cq]s package manager includes mergerfs check if
  1390. the version is up to date.
  1391. If out of date it is recommended to use the latest release found on the
  1392. release page.
  1393. Details for common distros are below.
  1394. .SS Debian
  1395. .PP
  1396. Most Debian installs are of a stable branch and therefore do not have
  1397. the most up to date software.
  1398. While mergerfs is available via \f[C]apt\f[R] it is suggested that uses
  1399. install the most recent version available from the releases
  1400. page (https://github.com/trapexit/mergerfs/releases).
  1401. .SS prebuilt deb
  1402. .IP
  1403. .nf
  1404. \f[C]
  1405. wget https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs_<ver>.debian-<rel>_<arch>.deb
  1406. dpkg -i mergerfs_<ver>.debian-<rel>_<arch>.deb
  1407. \f[R]
  1408. .fi
  1409. .SS apt
  1410. .IP
  1411. .nf
  1412. \f[C]
  1413. sudo apt install -y mergerfs
  1414. \f[R]
  1415. .fi
  1416. .SS Ubuntu
  1417. .PP
  1418. Most Ubuntu installs are of a stable branch and therefore do not have
  1419. the most up to date software.
  1420. While mergerfs is available via \f[C]apt\f[R] it is suggested that uses
  1421. install the most recent version available from the releases
  1422. page (https://github.com/trapexit/mergerfs/releases).
  1423. .SS prebuilt deb
  1424. .IP
  1425. .nf
  1426. \f[C]
  1427. wget https://github.com/trapexit/mergerfs/releases/download/<version>/mergerfs_<ver>.ubuntu-<rel>_<arch>.deb
  1428. dpkg -i mergerfs_<ver>.ubuntu-<rel>_<arch>.deb
  1429. \f[R]
  1430. .fi
  1431. .SS apt
  1432. .IP
  1433. .nf
  1434. \f[C]
  1435. sudo apt install -y mergerfs
  1436. \f[R]
  1437. .fi
  1438. .SS Raspberry Pi OS
  1439. .PP
  1440. Effectively the same as Debian or Ubuntu.
  1441. .SS Fedora
  1442. .IP
  1443. .nf
  1444. \f[C]
  1445. wget https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs-<ver>.fc<rel>.<arch>.rpm
  1446. sudo rpm -i mergerfs-<ver>.fc<rel>.<arch>.rpm
  1447. \f[R]
  1448. .fi
  1449. .SS CentOS / Rocky
  1450. .IP
  1451. .nf
  1452. \f[C]
  1453. wget https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs-<ver>.el<rel>.<arch>.rpm
  1454. sudo rpm -i mergerfs-<ver>.el<rel>.<arch>.rpm
  1455. \f[R]
  1456. .fi
  1457. .SS ArchLinux
  1458. .IP "1." 3
  1459. Setup AUR
  1460. .IP "2." 3
  1461. Install \f[C]mergerfs\f[R]
  1462. .SS Other
  1463. .PP
  1464. Static binaries are provided for situations where native packages are
  1465. unavailable.
  1466. .IP
  1467. .nf
  1468. \f[C]
  1469. wget https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs-static-linux_<arch>.tar.gz
  1470. sudo tar xvf mergerfs-static-linux_<arch>.tar.gz -C /
  1471. \f[R]
  1472. .fi
  1473. .SH BUILD
  1474. .PP
  1475. \f[B]NOTE:\f[R] Prebuilt packages can be found at and recommended for
  1476. most users: https://github.com/trapexit/mergerfs/releases
  1477. .PP
  1478. \f[B]NOTE:\f[R] Only tagged releases are supported.
  1479. \f[C]master\f[R] and other branches should be considered works in
  1480. progress.
  1481. .PP
  1482. First get the code from github (https://github.com/trapexit/mergerfs).
  1483. .IP
  1484. .nf
  1485. \f[C]
  1486. $ git clone https://github.com/trapexit/mergerfs.git
  1487. $ # or
  1488. $ wget https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs-<ver>.tar.gz
  1489. \f[R]
  1490. .fi
  1491. .SS Debian / Ubuntu
  1492. .IP
  1493. .nf
  1494. \f[C]
  1495. $ cd mergerfs
  1496. $ sudo tools/install-build-pkgs
  1497. $ make deb
  1498. $ sudo dpkg -i ../mergerfs_<version>_<arch>.deb
  1499. \f[R]
  1500. .fi
  1501. .SS RHEL / CentOS / Rocky / Fedora
  1502. .IP
  1503. .nf
  1504. \f[C]
  1505. $ su -
  1506. # cd mergerfs
  1507. # tools/install-build-pkgs
  1508. # make rpm
  1509. # rpm -i rpmbuild/RPMS/<arch>/mergerfs-<version>.<arch>.rpm
  1510. \f[R]
  1511. .fi
  1512. .SS Generic
  1513. .PP
  1514. Have git, g++, make, python installed.
  1515. .IP
  1516. .nf
  1517. \f[C]
  1518. $ cd mergerfs
  1519. $ make
  1520. $ sudo make install
  1521. \f[R]
  1522. .fi
  1523. .SS Build options
  1524. .IP
  1525. .nf
  1526. \f[C]
  1527. $ make help
  1528. usage: make
  1529. make USE_XATTR=0 - build program without xattrs functionality
  1530. make STATIC=1 - build static binary
  1531. make LTO=1 - build with link time optimization
  1532. \f[R]
  1533. .fi
  1534. .SH UPGRADE
  1535. .PP
  1536. mergerfs can be upgraded live by mounting on top of the previous
  1537. instance.
  1538. Simply install the new version of mergerfs and follow the instructions
  1539. below.
  1540. .PP
  1541. Run mergerfs again or if using \f[C]/etc/fstab\f[R] call for it to mount
  1542. again.
  1543. Existing open files and such will continue to work fine though they
  1544. won\[cq]t see runtime changes since any such change would be the new
  1545. mount.
  1546. If you plan on changing settings with the new mount you should / could
  1547. apply those before mounting the new version.
  1548. .IP
  1549. .nf
  1550. \f[C]
  1551. $ sudo mount /mnt/mergerfs
  1552. $ mount | grep mergerfs
  1553. media on /mnt/mergerfs type fuse.mergerfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
  1554. media on /mnt/mergerfs type fuse.mergerfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
  1555. \f[R]
  1556. .fi
  1557. .PP
  1558. A problem with this approach is that the underlying instance will
  1559. continue to run even if the software using it stop or are restarted.
  1560. To work around this you can use a \[lq]lazy umount\[rq].
  1561. Before mounting over top the mount point with the new instance of
  1562. mergerfs issue: \f[C]umount -l <mergerfs_mountpoint>\f[R].
  1563. Or you can let mergerfs do it by setting the option
  1564. \f[C]lazy-umount-mountpoint=true\f[R].
  1565. .SH RUNTIME INTERFACES
  1566. .SS RUNTIME CONFIG
  1567. .SS .mergerfs pseudo file
  1568. .IP
  1569. .nf
  1570. \f[C]
  1571. <mountpoint>/.mergerfs
  1572. \f[R]
  1573. .fi
  1574. .PP
  1575. There is a pseudo file available at the mount point which allows for the
  1576. runtime modification of certain \f[B]mergerfs\f[R] options.
  1577. The file will not show up in \f[B]readdir\f[R] but can be
  1578. \f[B]stat\f[R]\[cq]ed and manipulated via
  1579. {list,get,set}xattrs (http://linux.die.net/man/2/listxattr) calls.
  1580. .PP
  1581. Any changes made at runtime are \f[B]not\f[R] persisted.
  1582. If you wish for values to persist they must be included as options
  1583. wherever you configure the mounting of mergerfs (/etc/fstab).
  1584. .SS Keys
  1585. .PP
  1586. Use \f[C]getfattr -d /mountpoint/.mergerfs\f[R] or
  1587. \f[C]xattr -l /mountpoint/.mergerfs\f[R] to see all supported keys.
  1588. Some are informational and therefore read-only.
  1589. \f[C]setxattr\f[R] will return EINVAL (invalid argument) on read-only
  1590. keys.
  1591. .SS Values
  1592. .PP
  1593. Same as the command line.
  1594. .SS user.mergerfs.branches
  1595. .PP
  1596. Used to query or modify the list of branches.
  1597. When modifying there are several shortcuts to easy manipulation of the
  1598. list.
  1599. .PP
  1600. .TS
  1601. tab(@);
  1602. l l.
  1603. T{
  1604. Value
  1605. T}@T{
  1606. Description
  1607. T}
  1608. _
  1609. T{
  1610. [list]
  1611. T}@T{
  1612. set
  1613. T}
  1614. T{
  1615. +<[list]
  1616. T}@T{
  1617. prepend
  1618. T}
  1619. T{
  1620. +>[list]
  1621. T}@T{
  1622. append
  1623. T}
  1624. T{
  1625. -[list]
  1626. T}@T{
  1627. remove all values provided
  1628. T}
  1629. T{
  1630. -<
  1631. T}@T{
  1632. remove first in list
  1633. T}
  1634. T{
  1635. ->
  1636. T}@T{
  1637. remove last in list
  1638. T}
  1639. .TE
  1640. .PP
  1641. \f[C]xattr -w user.mergerfs.branches +</mnt/drive3 /mnt/pool/.mergerfs\f[R]
  1642. .PP
  1643. The \f[C]=NC\f[R], \f[C]=RO\f[R], \f[C]=RW\f[R] syntax works just as on
  1644. the command line.
  1645. .SS Example
  1646. .IP
  1647. .nf
  1648. \f[C]
  1649. [trapexit:/mnt/mergerfs] $ getfattr -d .mergerfs
  1650. user.mergerfs.branches=\[dq]/mnt/a=RW:/mnt/b=RW\[dq]
  1651. user.mergerfs.minfreespace=\[dq]4294967295\[dq]
  1652. user.mergerfs.moveonenospc=\[dq]false\[dq]
  1653. \&...
  1654. [trapexit:/mnt/mergerfs] $ getfattr -n user.mergerfs.category.search .mergerfs
  1655. user.mergerfs.category.search=\[dq]ff\[dq]
  1656. [trapexit:/mnt/mergerfs] $ setfattr -n user.mergerfs.category.search -v newest .mergerfs
  1657. [trapexit:/mnt/mergerfs] $ getfattr -n user.mergerfs.category.search .mergerfs
  1658. user.mergerfs.category.search=\[dq]newest\[dq]
  1659. \f[R]
  1660. .fi
  1661. .SS file / directory xattrs
  1662. .PP
  1663. While they won\[cq]t show up when using \f[C]getfattr\f[R]
  1664. \f[B]mergerfs\f[R] offers a number of special xattrs to query
  1665. information about the files served.
  1666. To access the values you will need to issue a
  1667. getxattr (http://linux.die.net/man/2/getxattr) for one of the following:
  1668. .IP \[bu] 2
  1669. \f[B]user.mergerfs.basepath\f[R]: the base mount point for the file
  1670. given the current getattr policy
  1671. .IP \[bu] 2
  1672. \f[B]user.mergerfs.relpath\f[R]: the relative path of the file from the
  1673. perspective of the mount point
  1674. .IP \[bu] 2
  1675. \f[B]user.mergerfs.fullpath\f[R]: the full path of the original file
  1676. given the getattr policy
  1677. .IP \[bu] 2
  1678. \f[B]user.mergerfs.allpaths\f[R]: a NUL (`\[rs]0') separated list of
  1679. full paths to all files found
  1680. .SS SIGNALS
  1681. .IP \[bu] 2
  1682. USR1: This will cause mergerfs to send invalidation notifications to the
  1683. kernel for all files.
  1684. This will cause all unused files to be released from memory.
  1685. .IP \[bu] 2
  1686. USR2: Trigger a general cleanup of currently unused memory.
  1687. A more thorough version of what happens every \[ti]15 minutes.
  1688. .SS IOCTLS
  1689. .PP
  1690. Found in \f[C]fuse_ioctl.cpp\f[R]:
  1691. .IP
  1692. .nf
  1693. \f[C]
  1694. typedef char IOCTL_BUF[4096];
  1695. #define IOCTL_APP_TYPE 0xDF
  1696. #define IOCTL_FILE_INFO _IOWR(IOCTL_APP_TYPE,0,IOCTL_BUF)
  1697. #define IOCTL_GC _IO(IOCTL_APP_TYPE,1)
  1698. #define IOCTL_GC1 _IO(IOCTL_APP_TYPE,2)
  1699. #define IOCTL_INVALIDATE_ALL_NODES _IO(IOCTL_APP_TYPE,3)
  1700. \f[R]
  1701. .fi
  1702. .IP \[bu] 2
  1703. IOCTL_FILE_INFO: Same as the \[lq]file / directory xattrs\[rq] mentioned
  1704. above.
  1705. Use a buffer size of 4096 bytes.
  1706. Pass in a string of \[lq]basepath\[rq], \[lq]relpath\[rq],
  1707. \[lq]fullpath\[rq], or \[lq]allpaths\[rq].
  1708. Receive details in same buffer.
  1709. .IP \[bu] 2
  1710. IOCTL_GC: Triggers a thorough garbage collection of excess memory.
  1711. Same as SIGUSR2.
  1712. .IP \[bu] 2
  1713. IOCTL_GC1: Triggers a simple garbage collection of excess memory.
  1714. Same as what happens every 15 minutes normally.
  1715. .IP \[bu] 2
  1716. IOCTL_INVALIDATE_ALL_NODES: Same as SIGUSR1.
  1717. Send invalidation notifications to the kernel for all files causing
  1718. unused files to be released from memory.
  1719. .SH TOOLING
  1720. .SS preload.so
  1721. .PP
  1722. EXPERIMENTAL
  1723. .PP
  1724. For some time there has been work to enable passthrough IO in FUSE.
  1725. Passthrough IO would allow for near native performance with regards to
  1726. reads and writes (at the expense of certain mergerfs features.) However,
  1727. there have been several complications which have kept the feature from
  1728. making it into the mainline Linux kernel.
  1729. Until that feature is available there are two methods to provide similar
  1730. functionality.
  1731. One method is using the LD_PRELOAD feature of the dynamic linker.
  1732. The other leveraging ptrace to intercept syscalls.
  1733. Each has their disadvantages.
  1734. At the moment only a preload based tool is available.
  1735. A ptrace based tool may be developed later if there is a need.
  1736. .PP
  1737. \f[C]/usr/lib/mergerfs/preload.so\f[R]
  1738. .PP
  1739. This preloadable
  1740. library (https://man7.org/linux/man-pages/man8/ld.so.8.html#ENVIRONMENT)
  1741. overrides the creation and opening of files in order to simulate
  1742. passthrough file IO.
  1743. It catches the open/creat/fopen calls, has mergerfs do the call, queries
  1744. mergerfs for the branch the file exists on, reopens the file on the
  1745. underlying filesystem and returns that instead.
  1746. Meaning that you will get native read/write performance because mergerfs
  1747. is no longer part of the workflow.
  1748. Keep in mind that this also means certain mergerfs features that work by
  1749. interrupting the read/write workflow, such as \f[C]moveonenospc\f[R],
  1750. will no longer work.
  1751. .PP
  1752. Also understand that this will only work on dynamically linked software.
  1753. Anything statically compiled will not work.
  1754. Many GoLang and Rust apps are statically compiled.
  1755. .PP
  1756. The library will not interfere with non-mergerfs filesystems.
  1757. The library is written to always fallback to returning the mergerfs
  1758. opened file on error.
  1759. .PP
  1760. While the library was written to account for a number of edgecases there
  1761. could be some yet accounted for so please report any oddities.
  1762. .PP
  1763. Thank you to nohajc (https://github.com/nohajc/mergerfs-io-passthrough)
  1764. for prototyping the idea.
  1765. .SS general usage
  1766. .IP
  1767. .nf
  1768. \f[C]
  1769. LD_PRELOAD=/usr/lib/mergerfs/preload.so touch /mnt/mergerfs/filename
  1770. \f[R]
  1771. .fi
  1772. .SS Docker usage
  1773. .PP
  1774. Assume \f[C]/mnt/fs0\f[R] and \f[C]/mnt/fs1\f[R] are pooled with
  1775. mergerfs at \f[C]/media\f[R].
  1776. .PP
  1777. All mergerfs branch paths \f[I]must\f[R] be bind mounted into the
  1778. container at the same path as found on the host so the preload library
  1779. can see them.
  1780. .IP
  1781. .nf
  1782. \f[C]
  1783. docker run \[rs]
  1784. -e LD_PRELOAD=/usr/lib/mergerfs/preload.so \[rs]
  1785. -v /usr/lib/mergerfs/preload.so:/usr/lib/mergerfs/preload.so:ro \[rs]
  1786. -v /media:/data \[rs]
  1787. -v /mnt:/mnt \[rs]
  1788. ubuntu:latest \[rs]
  1789. bash
  1790. \f[R]
  1791. .fi
  1792. .PP
  1793. or more explicitly
  1794. .IP
  1795. .nf
  1796. \f[C]
  1797. docker run \[rs]
  1798. -e LD_PRELOAD=/usr/lib/mergerfs/preload.so \[rs]
  1799. -v /usr/lib/mergerfs/preload.so:/usr/lib/mergerfs/preload.so:ro \[rs]
  1800. -v /media:/data \[rs]
  1801. -v /mnt/fs0:/mnt/fs0 \[rs]
  1802. -v /mnt/fs1:/mnt/fs1 \[rs]
  1803. ubuntu:latest \[rs]
  1804. bash
  1805. \f[R]
  1806. .fi
  1807. .SS systemd unit
  1808. .PP
  1809. Use the \f[C]Environment\f[R] option to set the LD_PRELOAD variable.
  1810. .IP \[bu] 2
  1811. https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Command%20lines
  1812. .IP \[bu] 2
  1813. https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service
  1814. .IP
  1815. .nf
  1816. \f[C]
  1817. [Service]
  1818. Environment=LD_PRELOAD=/usr/lib/mergerfs/preload.so
  1819. \f[R]
  1820. .fi
  1821. .SS Misc
  1822. .IP \[bu] 2
  1823. https://github.com/trapexit/mergerfs-tools
  1824. .RS 2
  1825. .IP \[bu] 2
  1826. mergerfs.ctl: A tool to make it easier to query and configure mergerfs
  1827. at runtime
  1828. .IP \[bu] 2
  1829. mergerfs.fsck: Provides permissions and ownership auditing and the
  1830. ability to fix them
  1831. .IP \[bu] 2
  1832. mergerfs.dedup: Will help identify and optionally remove duplicate files
  1833. .IP \[bu] 2
  1834. mergerfs.dup: Ensure there are at least N copies of a file across the
  1835. pool
  1836. .IP \[bu] 2
  1837. mergerfs.balance: Rebalance files across filesystems by moving them from
  1838. the most filled to the least filled
  1839. .IP \[bu] 2
  1840. mergerfs.consolidate: move files within a single mergerfs directory to
  1841. the filesystem with most free space
  1842. .RE
  1843. .IP \[bu] 2
  1844. https://github.com/trapexit/scorch
  1845. .RS 2
  1846. .IP \[bu] 2
  1847. scorch: A tool to help discover silent corruption of files and keep
  1848. track of files
  1849. .RE
  1850. .IP \[bu] 2
  1851. https://github.com/trapexit/bbf
  1852. .RS 2
  1853. .IP \[bu] 2
  1854. bbf (bad block finder): a tool to scan for and `fix' hard drive bad
  1855. blocks and find the files using those blocks
  1856. .RE
  1857. .SH CACHING
  1858. .SS page caching
  1859. .PP
  1860. https://en.wikipedia.org/wiki/Page_cache
  1861. .IP \[bu] 2
  1862. cache.files=off: Disables page caching.
  1863. Underlying files cached, mergerfs files are not.
  1864. .IP \[bu] 2
  1865. cache.files=partial: Enables page caching.
  1866. Underlying files cached, mergerfs files cached while open.
  1867. .IP \[bu] 2
  1868. cache.files=full: Enables page caching.
  1869. Underlying files cached, mergerfs files cached across opens.
  1870. .IP \[bu] 2
  1871. cache.files=auto-full: Enables page caching.
  1872. Underlying files cached, mergerfs files cached across opens if mtime and
  1873. size are unchanged since previous open.
  1874. .IP \[bu] 2
  1875. cache.files=libfuse: follow traditional libfuse \f[C]direct_io\f[R],
  1876. \f[C]kernel_cache\f[R], and \f[C]auto_cache\f[R] arguments.
  1877. .IP \[bu] 2
  1878. cache.files=per-process: Enable page caching (equivalent to
  1879. \f[C]cache.files=partial\f[R]) only for processes whose `comm' name
  1880. matches one of the values defined in
  1881. \f[C]cache.files.process-names\f[R].
  1882. If the name does not match the file open is equivalent to
  1883. \f[C]cache.files=off\f[R].
  1884. .PP
  1885. FUSE, which mergerfs uses, offers a number of page caching modes.
  1886. mergerfs tries to simplify their use via the \f[C]cache.files\f[R]
  1887. option.
  1888. It can and should replace usage of \f[C]direct_io\f[R],
  1889. \f[C]kernel_cache\f[R], and \f[C]auto_cache\f[R].
  1890. .PP
  1891. Due to mergerfs using FUSE and therefore being a userland process
  1892. proxying existing filesystems the kernel will double cache the content
  1893. being read and written through mergerfs.
  1894. Once from the underlying filesystem and once from mergerfs (it sees them
  1895. as two separate entities).
  1896. Using \f[C]cache.files=off\f[R] will keep the double caching from
  1897. happening by disabling caching of mergerfs but this has the side effect
  1898. that \f[I]all\f[R] read and write calls will be passed to mergerfs which
  1899. may be slower than enabling caching, you lose shared \f[C]mmap\f[R]
  1900. support which can affect apps such as rtorrent, and no read-ahead will
  1901. take place.
  1902. The kernel will still cache the underlying filesystem data but that only
  1903. helps so much given mergerfs will still process all requests.
  1904. .PP
  1905. If you do enable file page caching,
  1906. \f[C]cache.files=partial|full|auto-full\f[R], you should also enable
  1907. \f[C]dropcacheonclose\f[R] which will cause mergerfs to instruct the
  1908. kernel to flush the underlying file\[cq]s page cache when the file is
  1909. closed.
  1910. This behavior is the same as the rsync fadvise / drop cache patch and
  1911. Feh\[cq]s nocache project.
  1912. .PP
  1913. If most files are read once through and closed (like media) it is best
  1914. to enable \f[C]dropcacheonclose\f[R] regardless of caching mode in order
  1915. to minimize buffer bloat.
  1916. .PP
  1917. It is difficult to balance memory usage, cache bloat & duplication, and
  1918. performance.
  1919. Ideally mergerfs would be able to disable caching for the files it
  1920. reads/writes but allow page caching for itself.
  1921. That would limit the FUSE overhead.
  1922. However, there isn\[cq]t a good way to achieve this.
  1923. It would need to open all files with O_DIRECT which places limitations
  1924. on the what underlying filesystems would be supported and complicates
  1925. the code.
  1926. .PP
  1927. kernel documentation:
  1928. https://www.kernel.org/doc/Documentation/filesystems/fuse-io.txt
  1929. .SS entry & attribute caching
  1930. .PP
  1931. Given the relatively high cost of FUSE due to the kernel <-> userspace
  1932. round trips there are kernel side caches for file entries and
  1933. attributes.
  1934. The entry cache limits the \f[C]lookup\f[R] calls to mergerfs which ask
  1935. if a file exists.
  1936. The attribute cache limits the need to make \f[C]getattr\f[R] calls to
  1937. mergerfs which provide file attributes (mode, size, type, etc.).
  1938. As with the page cache these should not be used if the underlying
  1939. filesystems are being manipulated at the same time as it could lead to
  1940. odd behavior or data corruption.
  1941. The options for setting these are \f[C]cache.entry\f[R] and
  1942. \f[C]cache.negative_entry\f[R] for the entry cache and
  1943. \f[C]cache.attr\f[R] for the attributes cache.
  1944. \f[C]cache.negative_entry\f[R] refers to the timeout for negative
  1945. responses to lookups (non-existent files).
  1946. .SS writeback caching
  1947. .PP
  1948. When \f[C]cache.files\f[R] is enabled the default is for it to perform
  1949. writethrough caching.
  1950. This behavior won\[cq]t help improve performance as each write still
  1951. goes one for one through the filesystem.
  1952. By enabling the FUSE writeback cache small writes may be aggregated by
  1953. the kernel and then sent to mergerfs as one larger request.
  1954. This can greatly improve the throughput for apps which write to files
  1955. inefficiently.
  1956. The amount the kernel can aggregate is limited by the size of a FUSE
  1957. message.
  1958. Read the \f[C]fuse_msg_size\f[R] section for more details.
  1959. .PP
  1960. There is a small side effect as a result of enabling writeback caching.
  1961. Underlying files won\[cq]t ever be opened with O_APPEND or O_WRONLY.
  1962. The former because the kernel then manages append mode and the latter
  1963. because the kernel may request file data from mergerfs to populate the
  1964. write cache.
  1965. The O_APPEND change means that if a file is changed outside of mergerfs
  1966. it could lead to corruption as the kernel won\[cq]t know the end of the
  1967. file has changed.
  1968. That said any time you use caching you should keep from using the same
  1969. file outside of mergerfs at the same time.
  1970. .PP
  1971. Note that if an application is properly sizing writes then writeback
  1972. caching will have little or no effect.
  1973. It will only help with writes of sizes below the FUSE message size (128K
  1974. on older kernels, 1M on newer).
  1975. .SS statfs caching
  1976. .PP
  1977. Of the syscalls used by mergerfs in policies the \f[C]statfs\f[R] /
  1978. \f[C]statvfs\f[R] call is perhaps the most expensive.
  1979. It\[cq]s used to find out the available space of a filesystem and
  1980. whether it is mounted read-only.
  1981. Depending on the setup and usage pattern these queries can be relatively
  1982. costly.
  1983. When \f[C]cache.statfs\f[R] is enabled all calls to \f[C]statfs\f[R] by
  1984. a policy will be cached for the number of seconds its set to.
  1985. .PP
  1986. Example: If the create policy is \f[C]mfs\f[R] and the timeout is 60
  1987. then for that 60 seconds the same filesystem will be returned as the
  1988. target for creates because the available space won\[cq]t be updated for
  1989. that time.
  1990. .SS symlink caching
  1991. .PP
  1992. As of version 4.20 Linux supports symlink caching.
  1993. Significant performance increases can be had in workloads which use a
  1994. lot of symlinks.
  1995. Setting \f[C]cache.symlinks=true\f[R] will result in requesting symlink
  1996. caching from the kernel only if supported.
  1997. As a result its safe to enable it on systems prior to 4.20.
  1998. That said it is disabled by default for now.
  1999. You can see if caching is enabled by querying the xattr
  2000. \f[C]user.mergerfs.cache.symlinks\f[R] but given it must be requested at
  2001. startup you can not change it at runtime.
  2002. .SS readdir caching
  2003. .PP
  2004. As of version 4.20 Linux supports readdir caching.
  2005. This can have a significant impact on directory traversal.
  2006. Especially when combined with entry (\f[C]cache.entry\f[R]) and
  2007. attribute (\f[C]cache.attr\f[R]) caching.
  2008. Setting \f[C]cache.readdir=true\f[R] will result in requesting readdir
  2009. caching from the kernel on each \f[C]opendir\f[R].
  2010. If the kernel doesn\[cq]t support readdir caching setting the option to
  2011. \f[C]true\f[R] has no effect.
  2012. This option is configurable at runtime via xattr
  2013. \f[C]user.mergerfs.cache.readdir\f[R].
  2014. .SS tiered caching
  2015. .PP
  2016. Some storage technologies support what some call \[lq]tiered\[rq]
  2017. caching.
  2018. The placing of usually smaller, faster storage as a transparent cache to
  2019. larger, slower storage.
  2020. NVMe, SSD, Optane in front of traditional HDDs for instance.
  2021. .PP
  2022. mergerfs does not natively support any sort of tiered caching.
  2023. Most users have no use for such a feature and its inclusion would
  2024. complicate the code.
  2025. However, there are a few situations where a cache filesystem could help
  2026. with a typical mergerfs setup.
  2027. .IP "1." 3
  2028. Fast network, slow filesystems, many readers: You\[cq]ve a 10+Gbps
  2029. network with many readers and your regular filesystems can\[cq]t keep
  2030. up.
  2031. .IP "2." 3
  2032. Fast network, slow filesystems, small\[cq]ish bursty writes: You have a
  2033. 10+Gbps network and wish to transfer amounts of data less than your
  2034. cache filesystem but wish to do so quickly.
  2035. .PP
  2036. With #1 it\[cq]s arguable if you should be using mergerfs at all.
  2037. RAID would probably be the better solution.
  2038. If you\[cq]re going to use mergerfs there are other tactics that may
  2039. help: spreading the data across filesystems (see the mergerfs.dup tool)
  2040. and setting \f[C]func.open=rand\f[R], using \f[C]symlinkify\f[R], or
  2041. using dm-cache or a similar technology to add tiered cache to the
  2042. underlying device.
  2043. .PP
  2044. With #2 one could use dm-cache as well but there is another solution
  2045. which requires only mergerfs and a cronjob.
  2046. .IP "1." 3
  2047. Create 2 mergerfs pools.
  2048. One which includes just the slow devices and one which has both the fast
  2049. devices (SSD,NVME,etc.) and slow devices.
  2050. .IP "2." 3
  2051. The `cache' pool should have the cache filesystems listed first.
  2052. .IP "3." 3
  2053. The best \f[C]create\f[R] policies to use for the `cache' pool would
  2054. probably be \f[C]ff\f[R], \f[C]epff\f[R], \f[C]lfs\f[R], or
  2055. \f[C]eplfs\f[R].
  2056. The latter two under the assumption that the cache filesystem(s) are far
  2057. smaller than the backing filesystems.
  2058. If using path preserving policies remember that you\[cq]ll need to
  2059. manually create the core directories of those paths you wish to be
  2060. cached.
  2061. Be sure the permissions are in sync.
  2062. Use \f[C]mergerfs.fsck\f[R] to check / correct them.
  2063. You could also set the slow filesystems mode to \f[C]NC\f[R] though
  2064. that\[cq]d mean if the cache filesystems fill you\[cq]d get \[lq]out of
  2065. space\[rq] errors.
  2066. .IP "4." 3
  2067. Enable \f[C]moveonenospc\f[R] and set \f[C]minfreespace\f[R]
  2068. appropriately.
  2069. To make sure there is enough room on the \[lq]slow\[rq] pool you might
  2070. want to set \f[C]minfreespace\f[R] to at least as large as the size of
  2071. the largest cache filesystem if not larger.
  2072. This way in the worst case the whole of the cache filesystem(s) can be
  2073. moved to the other drives.
  2074. .IP "5." 3
  2075. Set your programs to use the cache pool.
  2076. .IP "6." 3
  2077. Save one of the below scripts or create you\[cq]re own.
  2078. .IP "7." 3
  2079. Use \f[C]cron\f[R] (as root) to schedule the command at whatever
  2080. frequency is appropriate for your workflow.
  2081. .SS time based expiring
  2082. .PP
  2083. Move files from cache to backing pool based only on the last time the
  2084. file was accessed.
  2085. Replace \f[C]-atime\f[R] with \f[C]-amin\f[R] if you want minutes rather
  2086. than days.
  2087. May want to use the \f[C]fadvise\f[R] / \f[C]--drop-cache\f[R] version
  2088. of rsync or run rsync with the tool \[lq]nocache\[rq].
  2089. .PP
  2090. \f[I]NOTE:\f[R] The arguments to these scripts include the cache
  2091. \f[B]filesystem\f[R] itself.
  2092. Not the pool with the cache filesystem.
  2093. You could have data loss if the source is the cache pool.
  2094. .PP
  2095. mergerfs.time-based-mover
  2096. .SS percentage full expiring
  2097. .PP
  2098. Move the oldest file from the cache to the backing pool.
  2099. Continue till below percentage threshold.
  2100. .PP
  2101. \f[I]NOTE:\f[R] The arguments to these scripts include the cache
  2102. \f[B]filesystem\f[R] itself.
  2103. Not the pool with the cache filesystem.
  2104. You could have data loss if the source is the cache pool.
  2105. .PP
  2106. mergerfs.percent-full-mover
  2107. .SH PERFORMANCE
  2108. .PP
  2109. mergerfs is at its core just a proxy and therefore its theoretical max
  2110. performance is that of the underlying devices.
  2111. However, given it is a FUSE filesystem working from userspace there is
  2112. an increase in overhead relative to kernel based solutions.
  2113. That said the performance can match the theoretical max but it depends
  2114. greatly on the system\[cq]s configuration.
  2115. Especially when adding network filesystems into the mix there are many
  2116. variables which can impact performance.
  2117. Device speeds and latency, network speeds and latency, general
  2118. concurrency, read/write sizes, etc.
  2119. Unfortunately, given the number of variables it has been difficult to
  2120. find a single set of settings which provide optimal performance.
  2121. If you\[cq]re having performance issues please look over the suggestions
  2122. below (including the benchmarking section.)
  2123. .PP
  2124. NOTE: be sure to read about these features before changing them to
  2125. understand what behaviors it may impact
  2126. .IP \[bu] 2
  2127. disable \f[C]security_capability\f[R] and/or \f[C]xattr\f[R]
  2128. .IP \[bu] 2
  2129. increase cache timeouts \f[C]cache.attr\f[R], \f[C]cache.entry\f[R],
  2130. \f[C]cache.negative_entry\f[R]
  2131. .IP \[bu] 2
  2132. enable (or disable) page caching (\f[C]cache.files\f[R])
  2133. .IP \[bu] 2
  2134. enable \f[C]parallel-direct-writes\f[R]
  2135. .IP \[bu] 2
  2136. enable \f[C]cache.writeback\f[R]
  2137. .IP \[bu] 2
  2138. enable \f[C]cache.statfs\f[R]
  2139. .IP \[bu] 2
  2140. enable \f[C]cache.symlinks\f[R]
  2141. .IP \[bu] 2
  2142. enable \f[C]cache.readdir\f[R]
  2143. .IP \[bu] 2
  2144. change the number of worker threads
  2145. .IP \[bu] 2
  2146. disable \f[C]posix_acl\f[R]
  2147. .IP \[bu] 2
  2148. disable \f[C]async_read\f[R]
  2149. .IP \[bu] 2
  2150. test theoretical performance using \f[C]nullrw\f[R] or mounting a ram
  2151. disk
  2152. .IP \[bu] 2
  2153. use \f[C]symlinkify\f[R] if your data is largely static and read-only
  2154. .IP \[bu] 2
  2155. use tiered cache devices
  2156. .IP \[bu] 2
  2157. use LVM and LVM cache to place a SSD in front of your HDDs
  2158. .IP \[bu] 2
  2159. increase readahead: \f[C]readahead=1024\f[R]
  2160. .PP
  2161. If you come across a setting that significantly impacts performance
  2162. please contact trapexit so he may investigate further.
  2163. Please test both against your normal setup, a singular branch, and with
  2164. \f[C]nullrw=true\f[R]
  2165. .SH BENCHMARKING
  2166. .PP
  2167. Filesystems are complicated.
  2168. They do many things and many of those are interconnected.
  2169. Additionally, the OS, drivers, hardware, etc.
  2170. all can impact performance.
  2171. Therefore, when benchmarking, it is \f[B]necessary\f[R] that the test
  2172. focus as narrowly as possible.
  2173. .PP
  2174. For most throughput is the key benchmark.
  2175. To test throughput \f[C]dd\f[R] is useful but \f[B]must\f[R] be used
  2176. with the correct settings in order to ensure the filesystem or device is
  2177. actually being tested.
  2178. The OS can and will cache data.
  2179. Without forcing synchronous reads and writes and/or disabling caching
  2180. the values returned will not be representative of the device\[cq]s true
  2181. performance.
  2182. .PP
  2183. When benchmarking through mergerfs ensure you only use 1 branch to
  2184. remove any possibility of the policies complicating the situation.
  2185. Benchmark the underlying filesystem first and then mount mergerfs over
  2186. it and test again.
  2187. If you\[cq]re experience speeds below your expectation you will need to
  2188. narrow down precisely which component is leading to the slowdown.
  2189. Preferably test the following in the order listed (but not combined).
  2190. .IP "1." 3
  2191. Enable \f[C]nullrw\f[R] mode with \f[C]nullrw=true\f[R].
  2192. This will effectively make reads and writes no-ops.
  2193. Removing the underlying device / filesystem from the equation.
  2194. This will give us the top theoretical speeds.
  2195. .IP "2." 3
  2196. Mount mergerfs over \f[C]tmpfs\f[R].
  2197. \f[C]tmpfs\f[R] is a RAM disk.
  2198. Extremely high speed and very low latency.
  2199. This is a more realistic best case scenario.
  2200. Example: \f[C]mount -t tmpfs -o size=2G tmpfs /tmp/tmpfs\f[R]
  2201. .IP "3." 3
  2202. Mount mergerfs over a local device.
  2203. NVMe, SSD, HDD, etc.
  2204. If you have more than one I\[cq]d suggest testing each of them as drives
  2205. and/or controllers (their drivers) could impact performance.
  2206. .IP "4." 3
  2207. Finally, if you intend to use mergerfs with a network filesystem, either
  2208. as the source of data or to combine with another through mergerfs, test
  2209. each of those alone as above.
  2210. .PP
  2211. Once you find the component which has the performance issue you can do
  2212. further testing with different options to see if they impact
  2213. performance.
  2214. For reads and writes the most relevant would be: \f[C]cache.files\f[R],
  2215. \f[C]async_read\f[R].
  2216. Less likely but relevant when using NFS or with certain filesystems
  2217. would be \f[C]security_capability\f[R], \f[C]xattr\f[R], and
  2218. \f[C]posix_acl\f[R].
  2219. If you find a specific system, device, filesystem, controller, etc.
  2220. that performs poorly contact trapexit so he may investigate further.
  2221. .PP
  2222. Sometimes the problem is really the application accessing or writing
  2223. data through mergerfs.
  2224. Some software use small buffer sizes which can lead to more requests and
  2225. therefore greater overhead.
  2226. You can test this out yourself by replace \f[C]bs=1M\f[R] in the
  2227. examples below with \f[C]ibs\f[R] or \f[C]obs\f[R] and using a size of
  2228. \f[C]512\f[R] instead of \f[C]1M\f[R].
  2229. In one example test using \f[C]nullrw\f[R] the write speed dropped from
  2230. 4.9GB/s to 69.7MB/s when moving from \f[C]1M\f[R] to \f[C]512\f[R].
  2231. Similar results were had when testing reads.
  2232. Small writes overhead may be improved by leveraging a write cache but in
  2233. casual tests little gain was found.
  2234. More tests will need to be done before this feature would become
  2235. available.
  2236. If you have an app that appears slow with mergerfs it could be due to
  2237. this.
  2238. Contact trapexit so he may investigate further.
  2239. .SS write benchmark
  2240. .IP
  2241. .nf
  2242. \f[C]
  2243. $ dd if=/dev/zero of=/mnt/mergerfs/1GB.file bs=1M count=1024 oflag=nocache conv=fdatasync status=progress
  2244. \f[R]
  2245. .fi
  2246. .SS read benchmark
  2247. .IP
  2248. .nf
  2249. \f[C]
  2250. $ dd if=/mnt/mergerfs/1GB.file of=/dev/null bs=1M count=1024 iflag=nocache conv=fdatasync status=progress
  2251. \f[R]
  2252. .fi
  2253. .SS other benchmarks
  2254. .PP
  2255. If you are attempting to benchmark other behaviors you must ensure you
  2256. clear kernel caches before runs.
  2257. In fact it would be a good deal to run before the read and write
  2258. benchmarks as well just in case.
  2259. .IP
  2260. .nf
  2261. \f[C]
  2262. sync
  2263. echo 3 | sudo tee /proc/sys/vm/drop_caches
  2264. \f[R]
  2265. .fi
  2266. .SH TIPS / NOTES
  2267. .IP \[bu] 2
  2268. This document is literal and thorough.
  2269. If a suspected feature isn\[cq]t mentioned it doesn\[cq]t exist.
  2270. If certain libfuse arguments aren\[cq]t listed they probably
  2271. shouldn\[cq]t be used.
  2272. .IP \[bu] 2
  2273. Ensure you\[cq]re using the latest version.
  2274. .IP \[bu] 2
  2275. Run mergerfs as \f[C]root\f[R].
  2276. mergerfs is designed and intended to be run as \f[C]root\f[R] and may
  2277. exibit incorrect behavior if run otherwise..
  2278. .IP \[bu] 2
  2279. If you don\[cq]t see some directories and files you expect, policies
  2280. seem to skip branches, you get strange permission errors, etc.
  2281. be sure the underlying filesystems\[cq] permissions are all the same.
  2282. Use \f[C]mergerfs.fsck\f[R] to audit the filesystem for out of sync
  2283. permissions.
  2284. .IP \[bu] 2
  2285. If you still have permission issues be sure you are using POSIX ACL
  2286. compliant filesystems.
  2287. mergerfs doesn\[cq]t generally make exceptions for FAT, NTFS, or other
  2288. non-POSIX filesystem.
  2289. .IP \[bu] 2
  2290. Do \f[B]not\f[R] use \f[C]cache.files=off\f[R] if you expect
  2291. applications (such as rtorrent) to use
  2292. mmap (http://linux.die.net/man/2/mmap) files.
  2293. Shared mmap is not currently supported in FUSE w/ page caching disabled.
  2294. Enabling \f[C]dropcacheonclose\f[R] is recommended when
  2295. \f[C]cache.files=partial|full|auto-full\f[R].
  2296. .IP \[bu] 2
  2297. Kodi (http://kodi.tv), Plex (http://plex.tv),
  2298. Subsonic (http://subsonic.org), etc.
  2299. can use directory mtime (http://linux.die.net/man/2/stat) to more
  2300. efficiently determine whether to scan for new content rather than simply
  2301. performing a full scan.
  2302. If using the default \f[B]getattr\f[R] policy of \f[B]ff\f[R] it\[cq]s
  2303. possible those programs will miss an update on account of it returning
  2304. the first directory found\[cq]s \f[B]stat\f[R] info and it\[cq]s a later
  2305. directory on another mount which had the \f[B]mtime\f[R] recently
  2306. updated.
  2307. To fix this you will want to set \f[B]func.getattr=newest\f[R].
  2308. Remember though that this is just \f[B]stat\f[R].
  2309. If the file is later \f[B]open\f[R]\[cq]ed or \f[B]unlink\f[R]\[cq]ed
  2310. and the policy is different for those then a completely different file
  2311. or directory could be acted on.
  2312. .IP \[bu] 2
  2313. Some policies mixed with some functions may result in strange behaviors.
  2314. Not that some of these behaviors and race conditions couldn\[cq]t happen
  2315. outside \f[B]mergerfs\f[R] but that they are far more likely to occur on
  2316. account of the attempt to merge together multiple sources of data which
  2317. could be out of sync due to the different policies.
  2318. .IP \[bu] 2
  2319. For consistency its generally best to set \f[B]category\f[R] wide
  2320. policies rather than individual \f[B]func\f[R]\[cq]s.
  2321. This will help limit the confusion of tools such as
  2322. rsync (http://linux.die.net/man/1/rsync).
  2323. However, the flexibility is there if needed.
  2324. .SH KNOWN ISSUES / BUGS
  2325. .SS kernel issues & bugs
  2326. .PP
  2327. <https://github.com/trapexit/mergerfs/wiki/Kernel-Issues-&-Bugs>
  2328. .SS directory mtime is not being updated
  2329. .PP
  2330. Remember that the default policy for \f[C]getattr\f[R] is \f[C]ff\f[R].
  2331. The information for the first directory found will be returned.
  2332. If it wasn\[cq]t the directory which had been updated then it will
  2333. appear outdated.
  2334. .PP
  2335. The reason this is the default is because any other policy would be more
  2336. expensive and for many applications it is unnecessary.
  2337. To always return the directory with the most recent mtime or a faked
  2338. value based on all found would require a scan of all filesystems.
  2339. .PP
  2340. If you always want the directory information from the one with the most
  2341. recent mtime then use the \f[C]newest\f[R] policy for \f[C]getattr\f[R].
  2342. .SS `mv /mnt/pool/foo /mnt/disk1/foo' removes `foo'
  2343. .PP
  2344. This is not a bug.
  2345. .PP
  2346. Run in verbose mode to better understand what\[cq]s happening:
  2347. .IP
  2348. .nf
  2349. \f[C]
  2350. $ mv -v /mnt/pool/foo /mnt/disk1/foo
  2351. copied \[aq]/mnt/pool/foo\[aq] -> \[aq]/mnt/disk1/foo\[aq]
  2352. removed \[aq]/mnt/pool/foo\[aq]
  2353. $ ls /mnt/pool/foo
  2354. ls: cannot access \[aq]/mnt/pool/foo\[aq]: No such file or directory
  2355. \f[R]
  2356. .fi
  2357. .PP
  2358. \f[C]mv\f[R], when working across devices, is copying the source to
  2359. target and then removing the source.
  2360. Since the source \f[B]is\f[R] the target in this case, depending on the
  2361. unlink policy, it will remove the just copied file and other files
  2362. across the branches.
  2363. .PP
  2364. If you want to move files to one filesystem just copy them there and use
  2365. mergerfs.dedup to clean up the old paths or manually remove them from
  2366. the branches directly.
  2367. .SS cached memory appears greater than it should be
  2368. .PP
  2369. Use \f[C]cache.files=off\f[R] and/or \f[C]dropcacheonclose=true\f[R].
  2370. See the section on page caching.
  2371. .SS NFS clients returning ESTALE / Stale file handle
  2372. .PP
  2373. NFS does not like out of band changes.
  2374. That is especially true of inode values.
  2375. .PP
  2376. Be sure to use the following options:
  2377. .IP \[bu] 2
  2378. noforget
  2379. .IP \[bu] 2
  2380. inodecalc=path-hash
  2381. .SS rtorrent fails with ENODEV (No such device)
  2382. .PP
  2383. Be sure to set \f[C]cache.files=partial|full|auto-full|per-processe\f[R]
  2384. or turn off \f[C]direct_io\f[R].
  2385. rtorrent and some other applications use
  2386. mmap (http://linux.die.net/man/2/mmap) to read and write to files and
  2387. offer no fallback to traditional methods.
  2388. FUSE does not currently support mmap while using \f[C]direct_io\f[R].
  2389. There may be a performance penalty on writes with \f[C]direct_io\f[R]
  2390. off as well as the problem of double caching but it\[cq]s the only way
  2391. to get such applications to work.
  2392. If the performance loss is too high for other apps you can mount
  2393. mergerfs twice.
  2394. Once with \f[C]direct_io\f[R] enabled and one without it.
  2395. Be sure to set \f[C]dropcacheonclose=true\f[R] if not using
  2396. \f[C]direct_io\f[R].
  2397. .SS Plex doesn\[cq]t work with mergerfs
  2398. .PP
  2399. It does.
  2400. If you\[cq]re trying to put Plex\[cq]s config / metadata / database on
  2401. mergerfs you can\[cq]t set \f[C]cache.files=off\f[R] because Plex is
  2402. using sqlite3 with mmap enabled.
  2403. Shared mmap is not supported by Linux\[cq]s FUSE implementation when
  2404. page caching is disabled.
  2405. To fix this place the data elsewhere (preferable) or enable
  2406. \f[C]cache.files\f[R] (with \f[C]dropcacheonclose=true\f[R]).
  2407. Sqlite3 does not need mmap but the developer needs to fall back to
  2408. standard IO if mmap fails.
  2409. .PP
  2410. This applies to other software: Radarr, Sonarr, Lidarr, Jellyfin, etc.
  2411. .PP
  2412. I would recommend reaching out to the developers of the software
  2413. you\[cq]re having troubles with and asking them to add a fallback to
  2414. regular file IO when mmap is unavailable.
  2415. .PP
  2416. If the issue is that scanning doesn\[cq]t seem to pick up media then be
  2417. sure to set \f[C]func.getattr=newest\f[R] though generally a full scan
  2418. will pick up all media anyway.
  2419. .SS When a program tries to move or rename a file it fails
  2420. .PP
  2421. Please read the section above regarding rename & link.
  2422. .PP
  2423. The problem is that many applications do not properly handle
  2424. \f[C]EXDEV\f[R] errors which \f[C]rename\f[R] and \f[C]link\f[R] may
  2425. return even though they are perfectly valid situations which do not
  2426. indicate actual device, filesystem, or OS errors.
  2427. The error will only be returned by mergerfs if using a path preserving
  2428. policy as described in the policy section above.
  2429. If you do not care about path preservation simply change the mergerfs
  2430. policy to the non-path preserving version.
  2431. For example: \f[C]-o category.create=mfs\f[R] Ideally the offending
  2432. software would be fixed and it is recommended that if you run into this
  2433. problem you contact the software\[cq]s author and request proper
  2434. handling of \f[C]EXDEV\f[R] errors.
  2435. .SS my 32bit software has problems
  2436. .PP
  2437. Some software have problems with 64bit inode values.
  2438. The symptoms can include EOVERFLOW errors when trying to list files.
  2439. You can address this by setting \f[C]inodecalc\f[R] to one of the 32bit
  2440. based algos as described in the relevant section.
  2441. .SS Samba: Moving files / directories fails
  2442. .PP
  2443. Workaround: Copy the file/directory and then remove the original rather
  2444. than move.
  2445. .PP
  2446. This isn\[cq]t an issue with Samba but some SMB clients.
  2447. GVFS-fuse v1.20.3 and prior (found in Ubuntu 14.04 among others) failed
  2448. to handle certain error codes correctly.
  2449. Particularly \f[B]STATUS_NOT_SAME_DEVICE\f[R] which comes from the
  2450. \f[B]EXDEV\f[R] which is returned by \f[B]rename\f[R] when the call is
  2451. crossing mount points.
  2452. When a program gets an \f[B]EXDEV\f[R] it needs to explicitly take an
  2453. alternate action to accomplish its goal.
  2454. In the case of \f[B]mv\f[R] or similar it tries \f[B]rename\f[R] and on
  2455. \f[B]EXDEV\f[R] falls back to a manual copying of data between the two
  2456. locations and unlinking the source.
  2457. In these older versions of GVFS-fuse if it received \f[B]EXDEV\f[R] it
  2458. would translate that into \f[B]EIO\f[R].
  2459. This would cause \f[B]mv\f[R] or most any application attempting to move
  2460. files around on that SMB share to fail with a IO error.
  2461. .PP
  2462. GVFS-fuse v1.22.0 (https://bugzilla.gnome.org/show_bug.cgi?id=734568)
  2463. and above fixed this issue but a large number of systems use the older
  2464. release.
  2465. On Ubuntu the version can be checked by issuing
  2466. \f[C]apt-cache showpkg gvfs-fuse\f[R].
  2467. Most distros released in 2015 seem to have the updated release and will
  2468. work fine but older systems may not.
  2469. Upgrading gvfs-fuse or the distro in general will address the problem.
  2470. .PP
  2471. In Apple\[cq]s MacOSX 10.9 they replaced Samba (client and server) with
  2472. their own product.
  2473. It appears their new client does not handle \f[B]EXDEV\f[R] either and
  2474. responds similar to older release of gvfs on Linux.
  2475. .SS Trashing files occasionally fails
  2476. .PP
  2477. This is the same issue as with Samba.
  2478. \f[C]rename\f[R] returns \f[C]EXDEV\f[R] (in our case that will really
  2479. only happen with path preserving policies like \f[C]epmfs\f[R]) and the
  2480. software doesn\[cq]t handle the situation well.
  2481. This is unfortunately a common failure of software which moves files
  2482. around.
  2483. The standard indicates that an implementation \f[C]MAY\f[R] choose to
  2484. support non-user home directory trashing of files (which is a
  2485. \f[C]MUST\f[R]).
  2486. The implementation \f[C]MAY\f[R] also support \[lq]top directory
  2487. trashes\[rq] which many probably do.
  2488. .PP
  2489. To create a \f[C]$topdir/.Trash\f[R] directory as defined in the
  2490. standard use the
  2491. mergerfs-tools (https://github.com/trapexit/mergerfs-tools) tool
  2492. \f[C]mergerfs.mktrash\f[R].
  2493. .SS Supplemental user groups
  2494. .PP
  2495. Due to the overhead of
  2496. getgroups/setgroups (http://linux.die.net/man/2/setgroups) mergerfs
  2497. utilizes a cache.
  2498. This cache is opportunistic and per thread.
  2499. Each thread will query the supplemental groups for a user when that
  2500. particular thread needs to change credentials and will keep that data
  2501. for the lifetime of the thread.
  2502. This means that if a user is added to a group it may not be picked up
  2503. without the restart of mergerfs.
  2504. However, since the high level FUSE API\[cq]s (at least the standard
  2505. version) thread pool dynamically grows and shrinks it\[cq]s possible
  2506. that over time a thread will be killed and later a new thread with no
  2507. cache will start and query the new data.
  2508. .PP
  2509. The gid cache uses fixed storage to simplify the design and be
  2510. compatible with older systems which may not have C++11 compilers.
  2511. There is enough storage for 256 users\[cq] supplemental groups.
  2512. Each user is allowed up to 32 supplemental groups.
  2513. Linux >= 2.6.3 allows up to 65535 groups per user but most other *nixs
  2514. allow far less.
  2515. NFS allowing only 16.
  2516. The system does handle overflow gracefully.
  2517. If the user has more than 32 supplemental groups only the first 32 will
  2518. be used.
  2519. If more than 256 users are using the system when an uncached user is
  2520. found it will evict an existing user\[cq]s cache at random.
  2521. So long as there aren\[cq]t more than 256 active users this should be
  2522. fine.
  2523. If either value is too low for your needs you will have to modify
  2524. \f[C]gidcache.hpp\f[R] to increase the values.
  2525. Note that doing so will increase the memory needed by each thread.
  2526. .PP
  2527. While not a bug some users have found when using containers that
  2528. supplemental groups defined inside the container don\[cq]t work properly
  2529. with regard to permissions.
  2530. This is expected as mergerfs lives outside the container and therefore
  2531. is querying the host\[cq]s group database.
  2532. There might be a hack to work around this (make mergerfs read the
  2533. /etc/group file in the container) but it is not yet implemented and
  2534. would be limited to Linux and the /etc/group DB.
  2535. Preferably users would mount in the host group file into the containers
  2536. or use a standard shared user & groups technology like NIS or LDAP.
  2537. .SH FAQ
  2538. .SS How well does mergerfs scale? Is it \[lq]production ready?\[rq]
  2539. .PP
  2540. Users have reported running mergerfs on everything from a Raspberry Pi
  2541. to dual socket Xeon systems with >20 cores.
  2542. I\[cq]m aware of at least a few companies which use mergerfs in
  2543. production.
  2544. Open Media Vault (https://www.openmediavault.org) includes mergerfs as
  2545. its sole solution for pooling filesystems.
  2546. The author of mergerfs had it running for over 300 days managing 16+
  2547. devices with reasonably heavy 24/7 read and write usage.
  2548. Stopping only after the machine\[cq]s power supply died.
  2549. .PP
  2550. Most serious issues (crashes or data corruption) have been due to kernel
  2551. bugs (https://github.com/trapexit/mergerfs/wiki/Kernel-Issues-&-Bugs).
  2552. All of which are fixed in stable releases.
  2553. .SS Can mergerfs be used with filesystems which already have data / are in use?
  2554. .PP
  2555. Yes.
  2556. mergerfs is really just a proxy and does \f[B]NOT\f[R] interfere with
  2557. the normal form or function of the filesystems / mounts / paths it
  2558. manages.
  2559. It is just another userland application that is acting as a
  2560. man-in-the-middle.
  2561. It can\[cq]t do anything that any other random piece of software
  2562. can\[cq]t do.
  2563. .PP
  2564. mergerfs is \f[B]not\f[R] a traditional filesystem that takes control
  2565. over the underlying block device.
  2566. mergerfs is \f[B]not\f[R] RAID.
  2567. It does \f[B]not\f[R] manipulate the data that passes through it.
  2568. It does \f[B]not\f[R] shard data across filesystems.
  2569. It merely shards some \f[B]behavior\f[R] and aggregates others.
  2570. .SS Can drives/filesystems be removed from the pool at will?
  2571. .PP
  2572. Yes.
  2573. See previous question\[cq]s answer.
  2574. .SS Can mergerfs be removed without affecting the data?
  2575. .PP
  2576. Yes.
  2577. See the previous question\[cq]s answer.
  2578. .SS Can drives/filesystems be moved to another pool?
  2579. .PP
  2580. Yes.
  2581. See the previous question\[cq]s answer.
  2582. .SS How do I migrate data into or out of the pool when adding/removing drives/filesystems?
  2583. .PP
  2584. You don\[cq]t need to.
  2585. See the previous question\[cq]s answer.
  2586. .SS How do I remove a drive/filesystem but keep the data in the pool?
  2587. .PP
  2588. Nothing special needs to be done.
  2589. Remove the branch from mergerfs\[cq] config and copy (rsync) the data
  2590. from the removed filesystem into the pool.
  2591. Effectively the same as if it were you transfering data from one
  2592. filesystem to another.
  2593. .PP
  2594. If you wish to continue using the pool while performing the transfer
  2595. simply create another, temporary pool without the filesystem in question
  2596. and then copy the data.
  2597. It would probably be a good idea to set the branch to \f[C]RO\f[R] prior
  2598. to doing this to ensure no new content is written to the filesystem
  2599. while performing the copy.
  2600. .SS What policies should I use?
  2601. .PP
  2602. Unless you\[cq]re doing something more niche the average user is
  2603. probably best off using \f[C]mfs\f[R] for \f[C]category.create\f[R].
  2604. It will spread files out across your branches based on available space.
  2605. Use \f[C]mspmfs\f[R] if you want to try to colocate the data a bit more.
  2606. You may want to use \f[C]lus\f[R] if you prefer a slightly different
  2607. distribution of data if you have a mix of smaller and larger
  2608. filesystems.
  2609. Generally though \f[C]mfs\f[R], \f[C]lus\f[R], or even \f[C]rand\f[R]
  2610. are good for the general use case.
  2611. If you are starting with an imbalanced pool you can use the tool
  2612. \f[B]mergerfs.balance\f[R] to redistribute files across the pool.
  2613. .PP
  2614. If you really wish to try to colocate files based on directory you can
  2615. set \f[C]func.create\f[R] to \f[C]epmfs\f[R] or similar and
  2616. \f[C]func.mkdir\f[R] to \f[C]rand\f[R] or \f[C]eprand\f[R] depending on
  2617. if you just want to colocate generally or on specific branches.
  2618. Either way the \f[I]need\f[R] to colocate is rare.
  2619. For instance: if you wish to remove the device regularly and want the
  2620. data to predictably be on that device or if you don\[cq]t use backup at
  2621. all and don\[cq]t wish to replace that data piecemeal.
  2622. In which case using path preservation can help but will require some
  2623. manual attention.
  2624. Colocating after the fact can be accomplished using the
  2625. \f[B]mergerfs.consolidate\f[R] tool.
  2626. If you don\[cq]t need strict colocation which the \f[C]ep\f[R] policies
  2627. provide then you can use the \f[C]msp\f[R] based policies which will
  2628. walk back the path till finding a branch that works.
  2629. .PP
  2630. Ultimately there is no correct answer.
  2631. It is a preference or based on some particular need.
  2632. mergerfs is very easy to test and experiment with.
  2633. I suggest creating a test setup and experimenting to get a sense of what
  2634. you want.
  2635. .PP
  2636. \f[C]epmfs\f[R] is the default \f[C]category.create\f[R] policy because
  2637. \f[C]ep\f[R] policies are not going to change the general layout of the
  2638. branches.
  2639. It won\[cq]t place files/dirs on branches that don\[cq]t already have
  2640. the relative branch.
  2641. So it keeps the system in a known state.
  2642. It\[cq]s much easier to stop using \f[C]epmfs\f[R] or redistribute files
  2643. around the filesystem than it is to consolidate them back.
  2644. .SS What settings should I use?
  2645. .PP
  2646. Depends on what features you want.
  2647. Generally speaking there are no \[lq]wrong\[rq] settings.
  2648. All settings are performance or feature related.
  2649. The best bet is to read over the available options and choose what fits
  2650. your situation.
  2651. If something isn\[cq]t clear from the documentation please reach out and
  2652. the documentation will be improved.
  2653. .PP
  2654. That said, for the average person, the following should be fine:
  2655. .PP
  2656. \f[C]cache.files=off,dropcacheonclose=true,category.create=mfs\f[R]
  2657. .SS Why are all my files ending up on 1 filesystem?!
  2658. .PP
  2659. Did you start with empty filesystems?
  2660. Did you explicitly configure a \f[C]category.create\f[R] policy?
  2661. Are you using an \f[C]existing path\f[R] / \f[C]path preserving\f[R]
  2662. policy?
  2663. .PP
  2664. The default create policy is \f[C]epmfs\f[R].
  2665. That is a path preserving algorithm.
  2666. With such a policy for \f[C]mkdir\f[R] and \f[C]create\f[R] with a set
  2667. of empty filesystems it will select only 1 filesystem when the first
  2668. directory is created.
  2669. Anything, files or directories, created in that first directory will be
  2670. placed on the same branch because it is preserving paths.
  2671. .PP
  2672. This catches a lot of new users off guard but changing the default would
  2673. break the setup for many existing users and this policy is the safest
  2674. policy as it will not change the general layout of the existing
  2675. filesystems.
  2676. If you do not care about path preservation and wish your files to be
  2677. spread across all your filesystems change to \f[C]mfs\f[R] or similar
  2678. policy as described above.
  2679. If you do want path preservation you\[cq]ll need to perform the manual
  2680. act of creating paths on the filesystems you want the data to land on
  2681. before transferring your data.
  2682. Setting \f[C]func.mkdir=epall\f[R] can simplify managing path
  2683. preservation for \f[C]create\f[R].
  2684. Or use \f[C]func.mkdir=rand\f[R] if you\[cq]re interested in just
  2685. grouping together directory content by filesystem.
  2686. .SS Do hardlinks work?
  2687. .PP
  2688. Yes.
  2689. See also the option \f[C]inodecalc\f[R] for how inode values are
  2690. calculated.
  2691. .PP
  2692. What mergerfs does not do is fake hard links across branches.
  2693. Read the section \[lq]rename & link\[rq] for how it works.
  2694. .PP
  2695. Remember that hardlinks will NOT work across devices.
  2696. That includes between the original filesystem and a mergerfs pool,
  2697. between two separate pools of the same underlying filesystems, or bind
  2698. mounts of paths within the mergerfs pool.
  2699. The latter is common when using Docker or Podman.
  2700. Multiple volumes (bind mounts) to the same underlying filesystem are
  2701. considered different devices.
  2702. There is no way to link between them.
  2703. You should mount in the highest directory in the mergerfs pool that
  2704. includes all the paths you need if you want links to work.
  2705. .SS Does FICLONE or FICLONERANGE work?
  2706. .PP
  2707. Unfortunately not.
  2708. FUSE, the technology mergerfs is based on, does not support the
  2709. \f[C]clone_file_range\f[R] feature needed for it to work.
  2710. mergerfs won\[cq]t even know such a request is made.
  2711. The kernel will simply return an error back to the application making
  2712. the request.
  2713. .PP
  2714. Should FUSE gain the ability mergerfs will be updated to support it.
  2715. .SS Can I use mergerfs without SnapRAID? SnapRAID without mergerfs?
  2716. .PP
  2717. Yes.
  2718. They are completely unrelated pieces of software.
  2719. .SS Can mergerfs run via Docker, Podman, Kubernetes, etc.
  2720. .PP
  2721. Yes.
  2722. With Docker you\[cq]ll need to include
  2723. \f[C]--cap-add=SYS_ADMIN --device=/dev/fuse --security-opt=apparmor:unconfined\f[R]
  2724. or similar with other container runtimes.
  2725. You should also be running it as root or given sufficient caps to change
  2726. user and group identity as well as have root like filesystem
  2727. permissions.
  2728. .PP
  2729. Keep in mind that you \f[B]MUST\f[R] consider identity when using
  2730. containers.
  2731. For example: supplemental groups will be picked up from the container
  2732. unless you properly manage users and groups by sharing relevant /etc
  2733. files or by using some other means to share identity across containers.
  2734. Similarly if you use \[lq]rootless\[rq] containers and user namespaces
  2735. to do uid/gid translations you \f[B]MUST\f[R] consider that while
  2736. managing shared files.
  2737. .PP
  2738. Also, as mentioned by hotio (https://hotio.dev/containers/mergerfs),
  2739. with Docker you should probably be mounting with
  2740. \f[C]bind-propagation\f[R] set to \f[C]slave\f[R].
  2741. .SS Does mergerfs support CoW / copy-on-write / writes to read-only filesystems?
  2742. .PP
  2743. Not in the sense of a filesystem like BTRFS or ZFS nor in the overlayfs
  2744. or aufs sense.
  2745. It does offer a
  2746. cow-shell (http://manpages.ubuntu.com/manpages/bionic/man1/cow-shell.1.html)
  2747. like hard link breaking (copy to temp file then rename over original)
  2748. which can be useful when wanting to save space by hardlinking duplicate
  2749. files but wish to treat each name as if it were a unique and separate
  2750. file.
  2751. .PP
  2752. If you want to write to a read-only filesystem you should look at
  2753. overlayfs.
  2754. You can always include the overlayfs mount into a mergerfs pool.
  2755. .SS Why can\[cq]t I see my files / directories?
  2756. .PP
  2757. It\[cq]s almost always a permissions issue.
  2758. Unlike mhddfs and unionfs-fuse, which runs as root and attempts to
  2759. access content as such, mergerfs always changes its credentials to that
  2760. of the caller.
  2761. This means that if the user does not have access to a file or directory
  2762. than neither will mergerfs.
  2763. However, because mergerfs is creating a union of paths it may be able to
  2764. read some files and directories on one filesystem but not another
  2765. resulting in an incomplete set.
  2766. .PP
  2767. Whenever you run into a split permission issue (seeing some but not all
  2768. files) try using
  2769. mergerfs.fsck (https://github.com/trapexit/mergerfs-tools) tool to check
  2770. for and fix the mismatch.
  2771. If you aren\[cq]t seeing anything at all be sure that the basic
  2772. permissions are correct.
  2773. The user and group values are correct and that directories have their
  2774. executable bit set.
  2775. A common mistake by users new to Linux is to \f[C]chmod -R 644\f[R] when
  2776. they should have \f[C]chmod -R u=rwX,go=rX\f[R].
  2777. .PP
  2778. If using a network filesystem such as NFS, SMB, CIFS (Samba) be sure to
  2779. pay close attention to anything regarding permissioning and users.
  2780. Root squashing and user translation for instance has bitten a few
  2781. mergerfs users.
  2782. Some of these also affect the use of mergerfs from container platforms
  2783. such as Docker.
  2784. .SS Why use FUSE? Why not a kernel based solution?
  2785. .PP
  2786. As with any solutions to a problem there are advantages and
  2787. disadvantages to each one.
  2788. .PP
  2789. A FUSE based solution has all the downsides of FUSE:
  2790. .IP \[bu] 2
  2791. Higher IO latency due to the trips in and out of kernel space
  2792. .IP \[bu] 2
  2793. Higher general overhead due to trips in and out of kernel space
  2794. .IP \[bu] 2
  2795. Double caching when using page caching
  2796. .IP \[bu] 2
  2797. Misc limitations due to FUSE\[cq]s design
  2798. .PP
  2799. But FUSE also has a lot of upsides:
  2800. .IP \[bu] 2
  2801. Easier to offer a cross platform solution
  2802. .IP \[bu] 2
  2803. Easier forward and backward compatibility
  2804. .IP \[bu] 2
  2805. Easier updates for users
  2806. .IP \[bu] 2
  2807. Easier and faster release cadence
  2808. .IP \[bu] 2
  2809. Allows more flexibility in design and features
  2810. .IP \[bu] 2
  2811. Overall easier to write, secure, and maintain
  2812. .IP \[bu] 2
  2813. Much lower barrier to entry (getting code into the kernel takes a lot of
  2814. time and effort initially)
  2815. .PP
  2816. FUSE was chosen because of all the advantages listed above.
  2817. The negatives of FUSE do not outweigh the positives.
  2818. .SS Is my OS\[cq]s libfuse needed for mergerfs to work?
  2819. .PP
  2820. No.\ Normally \f[C]mount.fuse\f[R] is needed to get mergerfs (or any
  2821. FUSE filesystem to mount using the \f[C]mount\f[R] command but in
  2822. vendoring the libfuse library the \f[C]mount.fuse\f[R] app has been
  2823. renamed to \f[C]mount.mergerfs\f[R] meaning the filesystem type in
  2824. \f[C]fstab\f[R] can simply be \f[C]mergerfs\f[R].
  2825. That said there should be no harm in having it installed and continuing
  2826. to using \f[C]fuse.mergerfs\f[R] as the type in \f[C]/etc/fstab\f[R].
  2827. .PP
  2828. If \f[C]mergerfs\f[R] doesn\[cq]t work as a type it could be due to how
  2829. the \f[C]mount.mergerfs\f[R] tool was installed.
  2830. Must be in \f[C]/sbin/\f[R] with proper permissions.
  2831. .SS Why was splice support removed?
  2832. .PP
  2833. After a lot of testing over the years splicing always appeared to be at
  2834. best provide equivalent performance and in cases worse performance.
  2835. Splice is not supported on other platforms forcing a traditional
  2836. read/write fallback to be provided.
  2837. The splice code was removed to simplify the codebase.
  2838. .SS What should mergerfs NOT be used for?
  2839. .IP \[bu] 2
  2840. databases: Even if the database stored data in separate files (mergerfs
  2841. wouldn\[cq]t offer much otherwise) the higher latency of the indirection
  2842. will kill performance.
  2843. If it is a lightly used SQLITE database then it may be fine but
  2844. you\[cq]ll need to test.
  2845. .IP \[bu] 2
  2846. VM images: For the same reasons as databases.
  2847. VM images are accessed very aggressively and mergerfs will introduce too
  2848. much latency (if it works at all).
  2849. .IP \[bu] 2
  2850. As replacement for RAID: mergerfs is just for pooling branches.
  2851. If you need that kind of device performance aggregation or high
  2852. availability you should stick with RAID.
  2853. .SS Can filesystems be written to directly? Outside of mergerfs while pooled?
  2854. .PP
  2855. Yes, however it\[cq]s not recommended to use the same file from within
  2856. the pool and from without at the same time (particularly writing).
  2857. Especially if using caching of any kind (cache.files, cache.entry,
  2858. cache.attr, cache.negative_entry, cache.symlinks, cache.readdir, etc.)
  2859. as there could be a conflict between cached data and not.
  2860. .SS Why do I get an \[lq]out of space\[rq] / \[lq]no space left on device\[rq] / ENOSPC error even though there appears to be lots of space available?
  2861. .PP
  2862. First make sure you\[cq]ve read the sections above about policies, path
  2863. preservation, branch filtering, and the options \f[B]minfreespace\f[R],
  2864. \f[B]moveonenospc\f[R], \f[B]statfs\f[R], and \f[B]statfs_ignore\f[R].
  2865. .PP
  2866. mergerfs is simply presenting a union of the content within multiple
  2867. branches.
  2868. The reported free space is an aggregate of space available within the
  2869. pool (behavior modified by \f[B]statfs\f[R] and
  2870. \f[B]statfs_ignore\f[R]).
  2871. It does not represent a contiguous space.
  2872. In the same way that read-only filesystems, those with quotas, or
  2873. reserved space report the full theoretical space available.
  2874. .PP
  2875. Due to path preservation, branch tagging, read-only status, and
  2876. \f[B]minfreespace\f[R] settings it is perfectly valid that
  2877. \f[C]ENOSPC\f[R] / \[lq]out of space\[rq] / \[lq]no space left on
  2878. device\[rq] be returned.
  2879. It is doing what was asked of it: filtering possible branches due to
  2880. those settings.
  2881. Only one error can be returned and if one of the reasons for filtering a
  2882. branch was \f[B]minfreespace\f[R] then it will be returned as such.
  2883. \f[B]moveonenospc\f[R] is only relevant to writing a file which is too
  2884. large for the filesystem it\[cq]s currently on.
  2885. .PP
  2886. It is also possible that the filesystem selected has run out of inodes.
  2887. Use \f[C]df -i\f[R] to list the total and available inodes per
  2888. filesystem.
  2889. .PP
  2890. If you don\[cq]t care about path preservation then simply change the
  2891. \f[C]create\f[R] policy to one which isn\[cq]t.
  2892. \f[C]mfs\f[R] is probably what most are looking for.
  2893. The reason it\[cq]s not default is because it was originally set to
  2894. \f[C]epmfs\f[R] and changing it now would change people\[cq]s setup.
  2895. Such a setting change will likely occur in mergerfs 3.
  2896. .SS Why does the total available space in mergerfs not equal outside?
  2897. .PP
  2898. Are you using ext2/3/4?
  2899. With reserve for root?
  2900. mergerfs uses available space for statfs calculations.
  2901. If you\[cq]ve reserved space for root then it won\[cq]t show up.
  2902. .PP
  2903. You can remove the reserve by running: \f[C]tune2fs -m 0 <device>\f[R]
  2904. .SS Can mergerfs mounts be exported over NFS?
  2905. .PP
  2906. Yes, however if you do anything which may changes files out of band
  2907. (including for example using the \f[C]newest\f[R] policy) it will result
  2908. in \[lq]stale file handle\[rq] errors unless properly setup.
  2909. .PP
  2910. Be sure to use the following options:
  2911. .IP \[bu] 2
  2912. noforget
  2913. .IP \[bu] 2
  2914. inodecalc=path-hash
  2915. .SS Can mergerfs mounts be exported over Samba / SMB?
  2916. .PP
  2917. Yes.
  2918. While some users have reported problems it appears to always be related
  2919. to how Samba is setup in relation to permissions.
  2920. .SS Can mergerfs mounts be used over SSHFS?
  2921. .PP
  2922. Yes.
  2923. .SS I notice massive slowdowns of writes when enabling cache.files.
  2924. .PP
  2925. When file caching is enabled in any form (\f[C]cache.files!=off\f[R] or
  2926. \f[C]direct_io=false\f[R]) it will issue \f[C]getxattr\f[R] requests for
  2927. \f[C]security.capability\f[R] prior to \f[I]every single write\f[R].
  2928. This will usually result in a performance degradation, especially when
  2929. using a network filesystem (such as NFS or CIFS/SMB/Samba.)
  2930. Unfortunately at this moment the kernel is not caching the response.
  2931. .PP
  2932. To work around this situation mergerfs offers a few solutions.
  2933. .IP "1." 3
  2934. Set \f[C]security_capability=false\f[R].
  2935. It will short circuit any call and return \f[C]ENOATTR\f[R].
  2936. This still means though that mergerfs will receive the request before
  2937. every write but at least it doesn\[cq]t get passed through to the
  2938. underlying filesystem.
  2939. .IP "2." 3
  2940. Set \f[C]xattr=noattr\f[R].
  2941. Same as above but applies to \f[I]all\f[R] calls to getxattr.
  2942. Not just \f[C]security.capability\f[R].
  2943. This will not be cached by the kernel either but mergerfs\[cq] runtime
  2944. config system will still function.
  2945. .IP "3." 3
  2946. Set \f[C]xattr=nosys\f[R].
  2947. Results in mergerfs returning \f[C]ENOSYS\f[R] which \f[I]will\f[R] be
  2948. cached by the kernel.
  2949. No future xattr calls will be forwarded to mergerfs.
  2950. The downside is that also means the xattr based config and query
  2951. functionality won\[cq]t work either.
  2952. .IP "4." 3
  2953. Disable file caching.
  2954. If you aren\[cq]t using applications which use \f[C]mmap\f[R] it\[cq]s
  2955. probably simpler to just disable it all together.
  2956. The kernel won\[cq]t send the requests when caching is disabled.
  2957. .SS It\[cq]s mentioned that there are some security issues with mhddfs. What are they? How does mergerfs address them?
  2958. .PP
  2959. mhddfs (https://github.com/trapexit/mhddfs) manages running as
  2960. \f[B]root\f[R] by calling
  2961. getuid() (https://github.com/trapexit/mhddfs/blob/cae96e6251dd91e2bdc24800b4a18a74044f6672/src/main.c#L319)
  2962. and if it returns \f[B]0\f[R] then it will
  2963. chown (http://linux.die.net/man/1/chown) the file.
  2964. Not only is that a race condition but it doesn\[cq]t handle other
  2965. situations.
  2966. Rather than attempting to simulate POSIX ACL behavior the proper way to
  2967. manage this is to use seteuid (http://linux.die.net/man/2/seteuid) and
  2968. setegid (http://linux.die.net/man/2/setegid), in effect becoming the
  2969. user making the original call, and perform the action as them.
  2970. This is what mergerfs does and why mergerfs should always run as root.
  2971. .PP
  2972. In Linux setreuid syscalls apply only to the thread.
  2973. GLIBC hides this away by using realtime signals to inform all threads to
  2974. change credentials.
  2975. Taking after \f[B]Samba\f[R], mergerfs uses
  2976. \f[B]syscall(SYS_setreuid,\&...)\f[R] to set the callers credentials for
  2977. that thread only.
  2978. Jumping back to \f[B]root\f[R] as necessary should escalated privileges
  2979. be needed (for instance: to clone paths between filesystems).
  2980. .PP
  2981. For non-Linux systems mergerfs uses a read-write lock and changes
  2982. credentials only when necessary.
  2983. If multiple threads are to be user X then only the first one will need
  2984. to change the processes credentials.
  2985. So long as the other threads need to be user X they will take a readlock
  2986. allowing multiple threads to share the credentials.
  2987. Once a request comes in to run as user Y that thread will attempt a
  2988. write lock and change to Y\[cq]s credentials when it can.
  2989. If the ability to give writers priority is supported then that flag will
  2990. be used so threads trying to change credentials don\[cq]t starve.
  2991. This isn\[cq]t the best solution but should work reasonably well
  2992. assuming there are few users.
  2993. .SH mergerfs versus X
  2994. .SS mhddfs
  2995. .PP
  2996. mhddfs had not been maintained for some time and has some known
  2997. stability and security issues.
  2998. mergerfs provides a superset of mhddfs\[cq] features and should offer
  2999. the same or better performance.
  3000. .PP
  3001. Below is an example of mhddfs and mergerfs setup to work similarly.
  3002. .PP
  3003. \f[C]mhddfs -o mlimit=4G,allow_other /mnt/drive1,/mnt/drive2 /mnt/pool\f[R]
  3004. .PP
  3005. \f[C]mergerfs -o minfreespace=4G,category.create=ff /mnt/drive1:/mnt/drive2 /mnt/pool\f[R]
  3006. .SS aufs
  3007. .PP
  3008. aufs is mostly abandoned and no longer available in most Linux distros.
  3009. .PP
  3010. While aufs can offer better peak performance mergerfs provides more
  3011. configurability and is generally easier to use.
  3012. mergerfs however does not offer the overlay / copy-on-write (CoW)
  3013. features which aufs has.
  3014. .SS unionfs-fuse
  3015. .PP
  3016. unionfs-fuse is more like aufs than mergerfs in that it offers overlay /
  3017. copy-on-write (CoW) features.
  3018. If you\[cq]re just looking to create a union of filesystems and want
  3019. flexibility in file/directory placement then mergerfs offers that
  3020. whereas unionfs is more for overlaying read/write filesystems over
  3021. read-only ones.
  3022. .SS overlayfs
  3023. .PP
  3024. overlayfs is similar to aufs and unionfs-fuse in that it also is
  3025. primarily used to layer a read/write filesystem over one or more
  3026. read-only filesystems.
  3027. It does not have the ability to spread files/directories across numerous
  3028. filesystems.
  3029. .SS RAID0, JBOD, drive concatenation, striping
  3030. .PP
  3031. With simple JBOD / drive concatenation / stripping / RAID0 a single
  3032. drive failure will result in full pool failure.
  3033. mergerfs performs a similar function without the possibility of
  3034. catastrophic failure and the difficulties in recovery.
  3035. Drives may fail but all other filesystems and their data will continue
  3036. to be accessible.
  3037. .PP
  3038. The main practical difference with mergerfs is the fact you don\[cq]t
  3039. actually have contiguous space as large as if you used those other
  3040. technologies.
  3041. Meaning you can\[cq]t create a 2TB file on a pool of 2 1TB filesystems.
  3042. .PP
  3043. When combined with something like SnapRaid (http://www.snapraid.it)
  3044. and/or an offsite backup solution you can have the flexibility of JBOD
  3045. without the single point of failure.
  3046. .SS UnRAID
  3047. .PP
  3048. UnRAID is a full OS and its storage layer, as I understand, is
  3049. proprietary and closed source.
  3050. Users who have experience with both have often said they prefer the
  3051. flexibility offered by mergerfs and for some the fact it is open source
  3052. is important.
  3053. .PP
  3054. There are a number of UnRAID users who use mergerfs as well though
  3055. I\[cq]m not entirely familiar with the use case.
  3056. .PP
  3057. For semi-static data mergerfs + SnapRaid (http://www.snapraid.it)
  3058. provides a similar solution.
  3059. .SS ZFS
  3060. .PP
  3061. mergerfs is very different from ZFS.
  3062. mergerfs is intended to provide flexible pooling of arbitrary
  3063. filesystems (local or remote), of arbitrary sizes, and arbitrary
  3064. filesystems.
  3065. For \f[C]write once, read many\f[R] usecases such as bulk media storage.
  3066. Where data integrity and backup is managed in other ways.
  3067. In those usecases ZFS can introduce a number of costs and limitations as
  3068. described
  3069. here (http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html),
  3070. here (https://markmcb.com/2020/01/07/five-years-of-btrfs/), and
  3071. here (https://utcc.utoronto.ca/~cks/space/blog/solaris/ZFSWhyNoRealReshaping).
  3072. .SS StableBit\[cq]s DrivePool
  3073. .PP
  3074. DrivePool works only on Windows so not as common an alternative as other
  3075. Linux solutions.
  3076. If you want to use Windows then DrivePool is a good option.
  3077. Functionally the two projects work a bit differently.
  3078. DrivePool always writes to the filesystem with the most free space and
  3079. later rebalances.
  3080. mergerfs does not offer rebalance but chooses a branch at file/directory
  3081. create time.
  3082. DrivePool\[cq]s rebalancing can be done differently in any directory and
  3083. has file pattern matching to further customize the behavior.
  3084. mergerfs, not having rebalancing does not have these features, but
  3085. similar features are planned for mergerfs v3.
  3086. DrivePool has builtin file duplication which mergerfs does not natively
  3087. support (but can be done via an external script.)
  3088. .PP
  3089. There are a lot of misc differences between the two projects but most
  3090. features in DrivePool can be replicated with external tools in
  3091. combination with mergerfs.
  3092. .PP
  3093. Additionally DrivePool is a closed source commercial product vs mergerfs
  3094. a ISC licensed OSS project.
  3095. .SH SUPPORT
  3096. .PP
  3097. Filesystems are complex and difficult to debug.
  3098. mergerfs, while being just a proxy of sorts, can be difficult to debug
  3099. given the large number of possible settings it can have itself and the
  3100. number of environments it can run in.
  3101. When reporting on a suspected issue \f[B]please\f[R] include as much of
  3102. the below information as possible otherwise it will be difficult or
  3103. impossible to diagnose.
  3104. Also please read the above documentation as it provides details on many
  3105. previously encountered questions/issues.
  3106. .PP
  3107. \f[B]Please make sure you are using the latest
  3108. release (https://github.com/trapexit/mergerfs/releases) or have tried it
  3109. in comparison. Old versions, which are often included in distros like
  3110. Debian and Ubuntu, are not ever going to be updated and the issue you
  3111. are encountering may have been addressed already.\f[R]
  3112. .PP
  3113. \f[B]For commercial support or feature requests please contact me
  3114. directly. (mailto:support@spawn.link)\f[R]
  3115. .SS Information to include in bug reports
  3116. .IP \[bu] 2
  3117. Information about the broader problem along with any attempted
  3118. solutions. (https://xyproblem.info)
  3119. .IP \[bu] 2
  3120. Solution already ruled out and why.
  3121. .IP \[bu] 2
  3122. Version of mergerfs: \f[C]mergerfs --version\f[R]
  3123. .IP \[bu] 2
  3124. mergerfs settings / arguments: from fstab, systemd unit, command line,
  3125. OMV plugin, etc.
  3126. .IP \[bu] 2
  3127. Version of the OS: \f[C]uname -a\f[R] and \f[C]lsb_release -a\f[R]
  3128. .IP \[bu] 2
  3129. List of branches, their filesystem types, sizes (before and after
  3130. issue): \f[C]df -h\f[R]
  3131. .IP \[bu] 2
  3132. \f[B]All\f[R] information about the relevant paths and files:
  3133. permissions, ownership, etc.
  3134. .IP \[bu] 2
  3135. \f[B]All\f[R] information about the client app making the requests:
  3136. version, uid/gid
  3137. .IP \[bu] 2
  3138. Runtime environment:
  3139. .RS 2
  3140. .IP \[bu] 2
  3141. Is mergerfs running within a container?
  3142. .IP \[bu] 2
  3143. Are the client apps using mergerfs running in a container?
  3144. .RE
  3145. .IP \[bu] 2
  3146. A \f[C]strace\f[R] of the app having problems:
  3147. .RS 2
  3148. .IP \[bu] 2
  3149. \f[C]strace -fvTtt -s 256 -o /tmp/app.strace.txt <cmd>\f[R]
  3150. .RE
  3151. .IP \[bu] 2
  3152. A \f[C]strace\f[R] of mergerfs while the program is trying to do
  3153. whatever it is failing to do:
  3154. .RS 2
  3155. .IP \[bu] 2
  3156. \f[C]strace -fvTtt -s 256 -p <mergerfsPID> -o /tmp/mergerfs.strace.txt\f[R]
  3157. .RE
  3158. .IP \[bu] 2
  3159. \f[B]Precise\f[R] directions on replicating the issue.
  3160. Do not leave \f[B]anything\f[R] out.
  3161. .IP \[bu] 2
  3162. Try to recreate the problem in the simplest way using standard programs:
  3163. \f[C]ln\f[R], \f[C]mv\f[R], \f[C]cp\f[R], \f[C]ls\f[R], \f[C]dd\f[R],
  3164. etc.
  3165. .SS Contact / Issue submission
  3166. .IP \[bu] 2
  3167. github.com: https://github.com/trapexit/mergerfs/issues
  3168. .IP \[bu] 2
  3169. discord: https://discord.gg/MpAr69V
  3170. .IP \[bu] 2
  3171. reddit: https://www.reddit.com/r/mergerfs
  3172. .SS Donations
  3173. .PP
  3174. https://github.com/trapexit/support
  3175. .PP
  3176. Development and support of a project like mergerfs requires a
  3177. significant amount of time and effort.
  3178. The software is released under the very liberal ISC license and is
  3179. therefore free to use for personal or commercial uses.
  3180. .PP
  3181. If you are a personal user and find mergerfs and its support valuable
  3182. and would like to support the project financially it would be very much
  3183. appreciated.
  3184. .PP
  3185. If you are using mergerfs commercially please consider sponsoring the
  3186. project to ensure it continues to be maintained and receive updates.
  3187. If custom features are needed feel free to contact me
  3188. directly (mailto:support@spawn.link).
  3189. .SH LINKS
  3190. .IP \[bu] 2
  3191. https://spawn.link
  3192. .IP \[bu] 2
  3193. https://github.com/trapexit/mergerfs
  3194. .IP \[bu] 2
  3195. https://github.com/trapexit/mergerfs/wiki
  3196. .IP \[bu] 2
  3197. https://github.com/trapexit/mergerfs-tools
  3198. .IP \[bu] 2
  3199. https://github.com/trapexit/scorch
  3200. .IP \[bu] 2
  3201. https://github.com/trapexit/bbf