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.

2488 lines
96 KiB

7 years ago
7 years ago
8 years ago
9 years ago
8 years ago
8 years ago
5 years ago
8 years ago
8 years ago
5 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
8 years ago
5 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
5 years ago
5 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
8 years ago
8 years ago
5 years ago
5 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
8 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
8 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
  1. .\"t
  2. .\" Automatically generated by Pandoc 1.19.2.4
  3. .\"
  4. .TH "mergerfs" "1" "2020\-04\-20" "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[] 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[], \f[B]unionfs\f[], and \f[B]aufs\f[].
  18. .SH FEATURES
  19. .IP \[bu] 2
  20. Runs in userspace (FUSE)
  21. .IP \[bu] 2
  22. Configurable behaviors / file placement
  23. .IP \[bu] 2
  24. Support for extended attributes (xattrs)
  25. .IP \[bu] 2
  26. Support for file attributes (chattr)
  27. .IP \[bu] 2
  28. Runtime configurable (via xattrs)
  29. .IP \[bu] 2
  30. Safe to run as root
  31. .IP \[bu] 2
  32. Opportunistic credential caching
  33. .IP \[bu] 2
  34. Works with heterogeneous filesystem types
  35. .IP \[bu] 2
  36. Handling of writes to full drives (transparently move file to drive with
  37. capacity)
  38. .IP \[bu] 2
  39. Handles pool of read\-only and read/write drives
  40. .IP \[bu] 2
  41. Can turn read\-only files into symlinks to underlying file
  42. .IP \[bu] 2
  43. Hard link copy\-on\-write / CoW
  44. .IP \[bu] 2
  45. supports POSIX ACLs
  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[]
  75. .fi
  76. .PP
  77. mergerfs does \f[B]not\f[] support the copy\-on\-write (CoW) behavior
  78. found in \f[B]aufs\f[] and \f[B]overlayfs\f[].
  79. You can \f[B]not\f[] mount a read\-only filesystem and write to it.
  80. However, mergerfs will ignore read\-only drives when creating new files
  81. so you can mix read\-write and read\-only drives.
  82. It also does \f[B]not\f[] split data across drives.
  83. It is not RAID0 / striping.
  84. It is simply a union.
  85. .SH BASIC SETUP
  86. .PP
  87. If you don\[aq]t already know that you have a special use case then just
  88. start with one of the following option sets.
  89. .SS You don\[aq]t need \f[C]mmap\f[]
  90. .PP
  91. \f[C]use_ino,cache.files=off,dropcacheonclose=true,allow_other,category.create=mfs\f[]
  92. .SS You do need \f[C]mmap\f[] (used by rtorrent and some other programs)
  93. .PP
  94. \f[C]use_ino,cache.files=partial,dropcacheonclose=true,allow_other,category.create=mfs\f[]
  95. .PP
  96. See the mergerfs wiki for real world
  97. deployments (https://github.com/trapexit/mergerfs/wiki/Real-World-Deployments)
  98. for comparisons / ideas.
  99. .SH OPTIONS
  100. .SS mount options
  101. .IP \[bu] 2
  102. \f[B]allow_other\f[]: A libfuse option which allows users besides the
  103. one which ran mergerfs to see the filesystem.
  104. This is required for most use\-cases.
  105. .IP \[bu] 2
  106. \f[B]minfreespace=SIZE\f[]: The minimum space value used for creation
  107. policies.
  108. Understands \[aq]K\[aq], \[aq]M\[aq], and \[aq]G\[aq] to represent
  109. kilobyte, megabyte, and gigabyte respectively.
  110. (default: 4G)
  111. .IP \[bu] 2
  112. \f[B]moveonenospc=BOOL\f[]: When enabled if a \f[B]write\f[] fails with
  113. \f[B]ENOSPC\f[] (no space left on device) or \f[B]EDQUOT\f[] (disk quota
  114. exceeded) a scan of all drives will be done looking for the drive with
  115. the most free space which is at least the size of the file plus the
  116. amount which failed to write.
  117. An attempt to move the file to that drive will occur (keeping all
  118. metadata possible) and if successful the original is unlinked and the
  119. write retried.
  120. (default: false)
  121. .IP \[bu] 2
  122. \f[B]use_ino\f[]: Causes mergerfs to supply file/directory inodes rather
  123. than libfuse.
  124. While not a default it is recommended it be enabled so that linked files
  125. share the same inode value.
  126. .IP \[bu] 2
  127. \f[B]dropcacheonclose=BOOL\f[]: When a file is requested to be closed
  128. call \f[C]posix_fadvise\f[] on it first to instruct the kernel that we
  129. no longer need the data and it can drop its cache.
  130. Recommended when \f[B]cache.files=partial|full|auto\-full\f[] to limit
  131. double caching.
  132. (default: false)
  133. .IP \[bu] 2
  134. \f[B]symlinkify=BOOL\f[]: When enabled and a file is not writable and
  135. its mtime or ctime is older than \f[B]symlinkify_timeout\f[] files will
  136. be reported as symlinks to the original files.
  137. Please read more below before using.
  138. (default: false)
  139. .IP \[bu] 2
  140. \f[B]symlinkify_timeout=INT\f[]: Time to wait, in seconds, to activate
  141. the \f[B]symlinkify\f[] behavior.
  142. (default: 3600)
  143. .IP \[bu] 2
  144. \f[B]nullrw=BOOL\f[]: Turns reads and writes into no\-ops.
  145. The request will succeed but do nothing.
  146. Useful for benchmarking mergerfs.
  147. (default: false)
  148. .IP \[bu] 2
  149. \f[B]ignorepponrename=BOOL\f[]: Ignore path preserving on rename.
  150. Typically rename and link act differently depending on the policy of
  151. \f[C]create\f[] (read below).
  152. Enabling this will cause rename and link to always use the non\-path
  153. preserving behavior.
  154. This means files, when renamed or linked, will stay on the same drive.
  155. (default: false)
  156. .IP \[bu] 2
  157. \f[B]security_capability=BOOL\f[]: If false return ENOATTR when xattr
  158. security.capability is queried.
  159. (default: true)
  160. .IP \[bu] 2
  161. \f[B]xattr=passthrough|noattr|nosys\f[]: Runtime control of xattrs.
  162. Default is to passthrough xattr requests.
  163. \[aq]noattr\[aq] will short circuit as if nothing exists.
  164. \[aq]nosys\[aq] will respond with ENOSYS as if xattrs are not supported
  165. or disabled.
  166. (default: passthrough)
  167. .IP \[bu] 2
  168. \f[B]link_cow=BOOL\f[]: When enabled if a regular file is opened which
  169. has a link count > 1 it will copy the file to a temporary file and
  170. rename over the original.
  171. Breaking the link and providing a basic copy\-on\-write function similar
  172. to cow\-shell.
  173. (default: false)
  174. .IP \[bu] 2
  175. \f[B]statfs=base|full\f[]: Controls how statfs works.
  176. \[aq]base\[aq] means it will always use all branches in statfs
  177. calculations.
  178. \[aq]full\[aq] is in effect path preserving and only includes drives
  179. where the path exists.
  180. (default: base)
  181. .IP \[bu] 2
  182. \f[B]statfs_ignore=none|ro|nc\f[]: \[aq]ro\[aq] will cause statfs
  183. calculations to ignore available space for branches mounted or tagged as
  184. \[aq]read\-only\[aq] or \[aq]no create\[aq].
  185. \[aq]nc\[aq] will ignore available space for branches tagged as \[aq]no
  186. create\[aq].
  187. (default: none)
  188. .IP \[bu] 2
  189. \f[B]posix_acl=BOOL\f[]: Enable POSIX ACL support (if supported by
  190. kernel and underlying filesystem).
  191. (default: false)
  192. .IP \[bu] 2
  193. \f[B]async_read=BOOL\f[]: Perform reads asynchronously.
  194. If disabled or unavailable the kernel will ensure there is at most one
  195. pending read request per file handle and will attempt to order requests
  196. by offset.
  197. (default: true)
  198. .IP \[bu] 2
  199. \f[B]fuse_msg_size=INT\f[]: Set the max number of pages per FUSE
  200. message.
  201. Only available on Linux >= 4.20 and ignored otherwise.
  202. (min: 1; max: 256; default: 256)
  203. .IP \[bu] 2
  204. \f[B]threads=INT\f[]: Number of threads to use in multithreaded mode.
  205. When set to zero it will attempt to discover and use the number of
  206. logical cores.
  207. If the lookup fails it will fall back to using 4.
  208. If the thread count is set negative it will look up the number of cores
  209. then divide by the absolute value.
  210. ie.
  211. threads=\-2 on an 8 core machine will result in 8 / 2 = 4 threads.
  212. There will always be at least 1 thread.
  213. NOTE: higher number of threads increases parallelism but usually
  214. decreases throughput.
  215. (default: 0)
  216. .IP \[bu] 2
  217. \f[B]fsname=STR\f[]: Sets the name of the filesystem as seen in
  218. \f[B]mount\f[], \f[B]df\f[], etc.
  219. Defaults to a list of the source paths concatenated together with the
  220. longest common prefix removed.
  221. .IP \[bu] 2
  222. \f[B]func.FUNC=POLICY\f[]: Sets the specific FUSE function\[aq]s policy.
  223. See below for the list of value types.
  224. Example: \f[B]func.getattr=newest\f[]
  225. .IP \[bu] 2
  226. \f[B]category.CATEGORY=POLICY\f[]: Sets policy of all FUSE functions in
  227. the provided category.
  228. See POLICIES section for defaults.
  229. Example: \f[B]category.create=mfs\f[]
  230. .IP \[bu] 2
  231. \f[B]cache.open=INT\f[]: \[aq]open\[aq] policy cache timeout in seconds.
  232. (default: 0)
  233. .IP \[bu] 2
  234. \f[B]cache.statfs=INT\f[]: \[aq]statfs\[aq] cache timeout in seconds.
  235. (default: 0)
  236. .IP \[bu] 2
  237. \f[B]cache.attr=INT\f[]: File attribute cache timeout in seconds.
  238. (default: 1)
  239. .IP \[bu] 2
  240. \f[B]cache.entry=INT\f[]: File name lookup cache timeout in seconds.
  241. (default: 1)
  242. .IP \[bu] 2
  243. \f[B]cache.negative_entry=INT\f[]: Negative file name lookup cache
  244. timeout in seconds.
  245. (default: 0)
  246. .IP \[bu] 2
  247. \f[B]cache.files=libfuse|off|partial|full|auto\-full\f[]: File page
  248. caching mode (default: libfuse)
  249. .IP \[bu] 2
  250. \f[B]cache.writeback=BOOL\f[]: Enable kernel writeback caching (default:
  251. false)
  252. .IP \[bu] 2
  253. \f[B]cache.symlinks=BOOL\f[]: Cache symlinks (if supported by kernel)
  254. (default: false)
  255. .IP \[bu] 2
  256. \f[B]cache.readdir=BOOL\f[]: Cache readdir (if supported by kernel)
  257. (default: false)
  258. .IP \[bu] 2
  259. \f[B]direct_io\f[]: deprecated \- Bypass page cache.
  260. Use \f[C]cache.files=off\f[] instead.
  261. (default: false)
  262. .IP \[bu] 2
  263. \f[B]kernel_cache\f[]: deprecated \- Do not invalidate data cache on
  264. file open.
  265. Use \f[C]cache.files=full\f[] instead.
  266. (default: false)
  267. .IP \[bu] 2
  268. \f[B]auto_cache\f[]: deprecated \- Invalidate data cache if file mtime
  269. or size change.
  270. Use \f[C]cache.files=auto\-full\f[] instead.
  271. (default: false)
  272. .IP \[bu] 2
  273. \f[B]async_read\f[]: deprecated \- Perform reads asynchronously.
  274. Use \f[C]async_read=true\f[] instead.
  275. .IP \[bu] 2
  276. \f[B]sync_read\f[]: deprecated \- Perform reads synchronously.
  277. Use \f[C]async_read=false\f[] instead.
  278. .PP
  279. \f[B]NOTE:\f[] Options are evaluated in the order listed so if the
  280. options are \f[B]func.rmdir=rand,category.action=ff\f[] the
  281. \f[B]action\f[] category setting will override the \f[B]rmdir\f[]
  282. setting.
  283. .SS Value Types
  284. .IP \[bu] 2
  285. BOOL = \[aq]true\[aq] | \[aq]false\[aq]
  286. .IP \[bu] 2
  287. INT = [0,MAX_INT]
  288. .IP \[bu] 2
  289. SIZE = \[aq]NNM\[aq]; NN = INT, M = \[aq]K\[aq] | \[aq]M\[aq] |
  290. \[aq]G\[aq] | \[aq]T\[aq]
  291. .IP \[bu] 2
  292. STR = string
  293. .IP \[bu] 2
  294. FUNC = FUSE function
  295. .IP \[bu] 2
  296. CATEGORY = FUSE function category
  297. .IP \[bu] 2
  298. POLICY = mergerfs function policy
  299. .SS branches
  300. .PP
  301. The \[aq]branches\[aq] (formerly \[aq]srcmounts\[aq]) argument is a
  302. colon (\[aq]:\[aq]) delimited list of paths to be pooled together.
  303. It does not matter if the paths are on the same or different drives nor
  304. does it matter the filesystem.
  305. Used and available space will not be duplicated for paths on the same
  306. device and any features which aren\[aq]t supported by the underlying
  307. filesystem (such as file attributes or extended attributes) will return
  308. the appropriate errors.
  309. .PP
  310. To make it easier to include multiple branches mergerfs supports
  311. globbing (http://linux.die.net/man/7/glob).
  312. \f[B]The globbing tokens MUST be escaped when using via the shell else
  313. the shell itself will apply the glob itself.\f[]
  314. .PP
  315. Each branch can have a suffix of \f[C]=RW\f[] (read / write),
  316. \f[C]=RO\f[] (read\-only), or \f[C]=NC\f[] (no create).
  317. These suffixes work with globs as well and will apply to each path
  318. found.
  319. \f[C]RW\f[] is the default behavior and those paths will be eligible for
  320. all policy categories.
  321. \f[C]RO\f[] will exclude those paths from \f[C]create\f[] and
  322. \f[C]action\f[] policies (just as a filesystem being mounted \f[C]ro\f[]
  323. would).
  324. \f[C]NC\f[] will exclude those paths from \f[C]create\f[] policies (you
  325. can\[aq]t create but you can change / delete).
  326. .IP
  327. .nf
  328. \f[C]
  329. #\ mergerfs\ \-o\ allow_other,use_ino\ /mnt/disk\\*:/mnt/cdrom\ /media/drives
  330. \f[]
  331. .fi
  332. .PP
  333. The above line will use all mount points in /mnt prefixed with
  334. \f[B]disk\f[] and the \f[B]cdrom\f[].
  335. .PP
  336. To have the pool mounted at boot or otherwise accessible from related
  337. tools use \f[B]/etc/fstab\f[].
  338. .IP
  339. .nf
  340. \f[C]
  341. #\ <file\ system>\ \ \ \ \ \ \ \ <mount\ point>\ \ <type>\ \ \ \ <options>\ \ \ \ \ \ \ \ \ \ \ \ \ <dump>\ \ <pass>
  342. /mnt/disk*:/mnt/cdrom\ \ /media/drives\ \ mergerfs\ \ allow_other,use_ino\ \ \ 0\ \ \ \ \ \ \ 0
  343. \f[]
  344. .fi
  345. .PP
  346. \f[B]NOTE:\f[] the globbing is done at mount or xattr update time (see
  347. below).
  348. If a new directory is added matching the glob after the fact it will not
  349. be automatically included.
  350. .PP
  351. \f[B]NOTE:\f[] for mounting via \f[B]fstab\f[] to work you must have
  352. \f[B]mount.fuse\f[] installed.
  353. For Ubuntu/Debian it is included in the \f[B]fuse\f[] package.
  354. .SS fuse_msg_size
  355. .PP
  356. FUSE applications communicate with the kernel over a special character
  357. device: \f[C]/dev/fuse\f[].
  358. A large portion of the overhead associated with FUSE is the cost of
  359. going back and forth from user space and kernel space over that device.
  360. Generally speaking the fewer trips needed the better the performance
  361. will be.
  362. Reducing the number of trips can be done a number of ways.
  363. Kernel level caching and increasing message sizes being two significant
  364. ones.
  365. When it comes to reads and writes if the message size is doubled the
  366. number of trips are approximately halved.
  367. .PP
  368. In Linux 4.20 a new feature was added allowing the negotiation of the
  369. max message size.
  370. Since the size is in multiples of
  371. pages (https://en.wikipedia.org/wiki/Page_(computer_memory)) the feature
  372. is called \f[C]max_pages\f[].
  373. There is a maximum \f[C]max_pages\f[] value of 256 (1MiB) and minimum of
  374. 1 (4KiB).
  375. The default used by Linux >=4.20, and hardcoded value used before 4.20,
  376. is 32 (128KiB).
  377. In mergerfs its referred to as \f[C]fuse_msg_size\f[] to make it clear
  378. what it impacts and provide some abstraction.
  379. .PP
  380. Since there should be no downsides to increasing \f[C]fuse_msg_size\f[]
  381. / \f[C]max_pages\f[], outside a minor bump in RAM usage due to larger
  382. message buffers, mergerfs defaults the value to 256.
  383. On kernels before 4.20 the value has no effect.
  384. The reason the value is configurable is to enable experimentation and
  385. benchmarking.
  386. See the BENCHMARKING section for examples.
  387. .SS symlinkify
  388. .PP
  389. Due to the levels of indirection introduced by mergerfs and the
  390. underlying technology FUSE there can be varying levels of performance
  391. degradation.
  392. This feature will turn non\-directories which are not writable into
  393. symlinks to the original file found by the \f[C]readlink\f[] policy
  394. after the mtime and ctime are older than the timeout.
  395. .PP
  396. \f[B]WARNING:\f[] The current implementation has a known issue in which
  397. if the file is open and being used when the file is converted to a
  398. symlink then the application which has that file open will receive an
  399. error when using it.
  400. This is unlikely to occur in practice but is something to keep in mind.
  401. .PP
  402. \f[B]WARNING:\f[] Some backup solutions, such as CrashPlan, do not
  403. backup the target of a symlink.
  404. If using this feature it will be necessary to point any backup software
  405. to the original drives or configure the software to follow symlinks if
  406. such an option is available.
  407. Alternatively create two mounts.
  408. One for backup and one for general consumption.
  409. .SS nullrw
  410. .PP
  411. Due to how FUSE works there is an overhead to all requests made to a
  412. FUSE filesystem that wouldn\[aq]t exist for an in kernel one.
  413. Meaning that even a simple passthrough will have some slowdown.
  414. However, generally the overhead is minimal in comparison to the cost of
  415. the underlying I/O.
  416. By disabling the underlying I/O we can test the theoretical performance
  417. boundaries.
  418. .PP
  419. By enabling \f[C]nullrw\f[] mergerfs will work as it always does
  420. \f[B]except\f[] that all reads and writes will be no\-ops.
  421. A write will succeed (the size of the write will be returned as if it
  422. were successful) but mergerfs does nothing with the data it was given.
  423. Similarly a read will return the size requested but won\[aq]t touch the
  424. buffer.
  425. .PP
  426. See the BENCHMARKING section for suggestions on how to test.
  427. .SS xattr
  428. .PP
  429. Runtime extended attribute support can be managed via the \f[C]xattr\f[]
  430. option.
  431. By default it will passthrough any xattr calls.
  432. Given xattr support is rarely used and can have significant performance
  433. implications mergerfs allows it to be disabled at runtime.
  434. The performance problems mostly comes when file caching is enabled.
  435. The kernel will send a \f[C]getxattr\f[] for
  436. \f[C]security.capability\f[] \f[I]before every single write\f[].
  437. It doesn\[aq]t cache the responses to any \f[C]getxattr\f[].
  438. This might be addressed in the future but for now mergerfs can really
  439. only offer the following workarounds.
  440. .PP
  441. \f[C]noattr\f[] will cause mergerfs to short circuit all xattr calls and
  442. return ENOATTR where appropriate.
  443. mergerfs still gets all the requests but they will not be forwarded on
  444. to the underlying filesystems.
  445. The runtime control will still function in this mode.
  446. .PP
  447. \f[C]nosys\f[] will cause mergerfs to return ENOSYS for any xattr call.
  448. The difference with \f[C]noattr\f[] is that the kernel will cache this
  449. fact and itself short circuit future calls.
  450. This is more efficient than \f[C]noattr\f[] but will cause mergerfs\[aq]
  451. runtime control via the hidden file to stop working.
  452. .SH FUNCTIONS / POLICIES / CATEGORIES
  453. .PP
  454. The POSIX filesystem API is made up of a number of functions.
  455. \f[B]creat\f[], \f[B]stat\f[], \f[B]chown\f[], etc.
  456. In mergerfs most of the core functions are grouped into 3 categories:
  457. \f[B]action\f[], \f[B]create\f[], and \f[B]search\f[].
  458. These functions and categories can be assigned a policy which dictates
  459. what file or directory is chosen when performing that behavior.
  460. Any policy can be assigned to a function or category though some may not
  461. be very useful in practice.
  462. For instance: \f[B]rand\f[] (random) may be useful for file creation
  463. (create) but could lead to very odd behavior if used for \f[C]chmod\f[]
  464. if there were more than one copy of the file.
  465. .PP
  466. Some functions, listed in the category \f[C]N/A\f[] below, can not be
  467. assigned the normal policies.
  468. All functions which work on file handles use the handle which was
  469. acquired by \f[C]open\f[] or \f[C]create\f[].
  470. \f[C]readdir\f[] has no real need for a policy given the purpose is
  471. merely to return a list of entries in a directory.
  472. \f[C]statfs\f[]\[aq]s behavior can be modified via other options.
  473. That said many times the current FUSE kernel driver will not always
  474. provide the file handle when a client calls \f[C]fgetattr\f[],
  475. \f[C]fchown\f[], \f[C]fchmod\f[], \f[C]futimens\f[], \f[C]ftruncate\f[],
  476. etc.
  477. This means it will call the regular, path based, versions.
  478. .PP
  479. When using policies which are based on a branch\[aq]s available space
  480. the base path provided is used.
  481. Not the full path to the file in question.
  482. Meaning that sub mounts won\[aq]t be considered in the space
  483. calculations.
  484. The reason is that it doesn\[aq]t really work for non\-path preserving
  485. policies and can lead to non\-obvious behaviors.
  486. .SS Function / Category classifications
  487. .PP
  488. .TS
  489. tab(@);
  490. lw(7.9n) lw(62.1n).
  491. T{
  492. Category
  493. T}@T{
  494. FUSE Functions
  495. T}
  496. _
  497. T{
  498. action
  499. T}@T{
  500. chmod, chown, link, removexattr, rename, rmdir, setxattr, truncate,
  501. unlink, utimens
  502. T}
  503. T{
  504. create
  505. T}@T{
  506. create, mkdir, mknod, symlink
  507. T}
  508. T{
  509. search
  510. T}@T{
  511. access, getattr, getxattr, ioctl (directories), listxattr, open,
  512. readlink
  513. T}
  514. T{
  515. N/A
  516. T}@T{
  517. fchmod, fchown, futimens, ftruncate, fallocate, fgetattr, fsync, ioctl
  518. (files), read, readdir, release, statfs, write, copy_file_range
  519. T}
  520. .TE
  521. .PP
  522. In cases where something may be searched (to confirm a directory exists
  523. across all source mounts) \f[B]getattr\f[] will be used.
  524. .SS Path Preservation
  525. .PP
  526. Policies, as described below, are of two basic types.
  527. \f[C]path\ preserving\f[] and \f[C]non\-path\ preserving\f[].
  528. .PP
  529. All policies which start with \f[C]ep\f[] (\f[B]epff\f[],
  530. \f[B]eplfs\f[], \f[B]eplus\f[], \f[B]epmfs\f[], \f[B]eprand\f[]) are
  531. \f[C]path\ preserving\f[].
  532. \f[C]ep\f[] stands for \f[C]existing\ path\f[].
  533. .PP
  534. A path preserving policy will only consider drives where the relative
  535. path being accessed already exists.
  536. .PP
  537. When using non\-path preserving policies paths will be cloned to target
  538. drives as necessary.
  539. .SS Filters
  540. .PP
  541. Policies basically search branches and create a list of files / paths
  542. for functions to work on.
  543. The policy is responsible for filtering and sorting.
  544. The policy type defines the sorting but filtering is mostly uniform as
  545. described below.
  546. .IP \[bu] 2
  547. No \f[B]search\f[] policies filter.
  548. .IP \[bu] 2
  549. All \f[B]action\f[] policies will filter out branches which are mounted
  550. \f[B]read\-only\f[] or tagged as \f[B]RO (read\-only)\f[].
  551. .IP \[bu] 2
  552. All \f[B]create\f[] policies will filter out branches which are mounted
  553. \f[B]read\-only\f[], tagged \f[B]RO (read\-only)\f[] or \f[B]NC (no
  554. create)\f[], or has available space less than \f[C]minfreespace\f[].
  555. .PP
  556. If all branches are filtered an error will be returned.
  557. Typically \f[B]EROFS\f[] (read\-only filesystem) or \f[B]ENOSPC\f[] (no
  558. space left on device) depending on the reasons.
  559. .SS Policy descriptions
  560. .PP
  561. .TS
  562. tab(@);
  563. lw(16.6n) lw(53.4n).
  564. T{
  565. Policy
  566. T}@T{
  567. Description
  568. T}
  569. _
  570. T{
  571. all
  572. T}@T{
  573. Search category: same as \f[B]epall\f[].
  574. Action category: same as \f[B]epall\f[].
  575. Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and
  576. \f[B]symlink\f[] it will apply to all branches.
  577. \f[B]create\f[] works like \f[B]ff\f[].
  578. T}
  579. T{
  580. epall (existing path, all)
  581. T}@T{
  582. Search category: same as \f[B]epff\f[] (but more expensive because it
  583. doesn\[aq]t stop after finding a valid branch).
  584. Action category: apply to all found.
  585. Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and
  586. \f[B]symlink\f[] it will apply to all found.
  587. \f[B]create\f[] works like \f[B]epff\f[] (but more expensive because it
  588. doesn\[aq]t stop after finding a valid branch).
  589. T}
  590. T{
  591. epff (existing path, first found)
  592. T}@T{
  593. Given the order of the branches, as defined at mount time or configured
  594. at runtime, act on the first one found where the relative path exists.
  595. T}
  596. T{
  597. eplfs (existing path, least free space)
  598. T}@T{
  599. Of all the branches on which the relative path exists choose the drive
  600. with the least free space.
  601. T}
  602. T{
  603. eplus (existing path, least used space)
  604. T}@T{
  605. Of all the branches on which the relative path exists choose the drive
  606. with the least used space.
  607. T}
  608. T{
  609. epmfs (existing path, most free space)
  610. T}@T{
  611. Of all the branches on which the relative path exists choose the drive
  612. with the most free space.
  613. T}
  614. T{
  615. eprand (existing path, random)
  616. T}@T{
  617. Calls \f[B]epall\f[] and then randomizes.
  618. Returns 1.
  619. T}
  620. T{
  621. erofs
  622. T}@T{
  623. Exclusively return \f[B]\-1\f[] with \f[B]errno\f[] set to
  624. \f[B]EROFS\f[] (read\-only filesystem).
  625. T}
  626. T{
  627. ff (first found)
  628. T}@T{
  629. Search category: same as \f[B]epff\f[].
  630. Action category: same as \f[B]epff\f[].
  631. Create category: Given the order of the drives, as defined at mount time
  632. or configured at runtime, act on the first one found.
  633. T}
  634. T{
  635. lfs (least free space)
  636. T}@T{
  637. Search category: same as \f[B]eplfs\f[].
  638. Action category: same as \f[B]eplfs\f[].
  639. Create category: Pick the drive with the least available free space.
  640. T}
  641. T{
  642. lus (least used space)
  643. T}@T{
  644. Search category: same as \f[B]eplus\f[].
  645. Action category: same as \f[B]eplus\f[].
  646. Create category: Pick the drive with the least used space.
  647. T}
  648. T{
  649. mfs (most free space)
  650. T}@T{
  651. Search category: same as \f[B]epmfs\f[].
  652. Action category: same as \f[B]epmfs\f[].
  653. Create category: Pick the drive with the most available free space.
  654. T}
  655. T{
  656. newest
  657. T}@T{
  658. Pick the file / directory with the largest mtime.
  659. T}
  660. T{
  661. rand (random)
  662. T}@T{
  663. Calls \f[B]all\f[] and then randomizes.
  664. Returns 1.
  665. T}
  666. .TE
  667. .PP
  668. \f[B]NOTE:\f[] If you are using an underlying filesystem that reserves
  669. blocks such as ext2, ext3, or ext4 be aware that mergerfs respects the
  670. reservation by using \f[C]f_bavail\f[] (number of free blocks for
  671. unprivileged users) rather than \f[C]f_bfree\f[] (number of free blocks)
  672. in policy calculations.
  673. \f[B]df\f[] does NOT use \f[C]f_bavail\f[], it uses \f[C]f_bfree\f[], so
  674. direct comparisons between \f[B]df\f[] output and mergerfs\[aq] policies
  675. is not appropriate.
  676. .SS Defaults
  677. .PP
  678. .TS
  679. tab(@);
  680. l l.
  681. T{
  682. Category
  683. T}@T{
  684. Policy
  685. T}
  686. _
  687. T{
  688. action
  689. T}@T{
  690. epall
  691. T}
  692. T{
  693. create
  694. T}@T{
  695. epmfs
  696. T}
  697. T{
  698. search
  699. T}@T{
  700. ff
  701. T}
  702. .TE
  703. .SS ioctl
  704. .PP
  705. When \f[C]ioctl\f[] is used with an open file then it will use the file
  706. handle which was created at the original \f[C]open\f[] call.
  707. However, when using \f[C]ioctl\f[] with a directory mergerfs will use
  708. the \f[C]open\f[] policy to find the directory to act on.
  709. .SS unlink
  710. .PP
  711. In FUSE there is an opaque "file handle" which is created by
  712. \f[C]open\f[], \f[C]create\f[], or \f[C]opendir\f[], passed to the
  713. kernel, and then is passed back to the FUSE userland application by the
  714. kernel.
  715. Unfortunately, the FUSE kernel driver does not always send the file
  716. handle when it theoretically could/should.
  717. This complicates certain behaviors / workflows particularly in the high
  718. level API.
  719. As a result mergerfs is currently doing a few hacky things.
  720. .PP
  721. libfuse2 and libfuse3, when using the high level API, will rename names
  722. to \f[C]\&.fuse_hiddenXXXXXX\f[] if the file is open when unlinked or
  723. renamed over.
  724. It does this so the file is still available when a request referencing
  725. the now missing file is made.
  726. This file however keeps a \f[C]rmdir\f[] from succeeding and can be
  727. picked up by software reading directories.
  728. .PP
  729. The change mergerfs has done is that if a file is open when an unlink or
  730. rename happens it will open the file and keep it open till closed by all
  731. those who opened it prior.
  732. When a request comes in referencing that file and it doesn\[aq]t include
  733. a file handle it will instead use the file handle created at
  734. unlink/rename time.
  735. .PP
  736. This won\[aq]t result in technically proper behavior but close enough
  737. for many usecases.
  738. .PP
  739. The plan is to rewrite mergerfs to use the low level API so these
  740. invasive libfuse changes are no longer necessary.
  741. .SS rename & link
  742. .PP
  743. \f[B]NOTE:\f[] If you\[aq]re receiving errors from software when files
  744. are moved / renamed / linked then you should consider changing the
  745. create policy to one which is \f[B]not\f[] path preserving, enabling
  746. \f[C]ignorepponrename\f[], or contacting the author of the offending
  747. software and requesting that \f[C]EXDEV\f[] (cross device / improper
  748. link) be properly handled.
  749. .PP
  750. \f[C]rename\f[] and \f[C]link\f[] are tricky functions in a union
  751. filesystem.
  752. \f[C]rename\f[] only works within a single filesystem or device.
  753. If a rename can\[aq]t be done atomically due to the source and
  754. destination paths existing on different mount points it will return
  755. \f[B]\-1\f[] with \f[B]errno = EXDEV\f[] (cross device / improper link).
  756. So if a \f[C]rename\f[]\[aq]s source and target are on different drives
  757. within the pool it creates an issue.
  758. .PP
  759. Originally mergerfs would return EXDEV whenever a rename was requested
  760. which was cross directory in any way.
  761. This made the code simple and was technically compliant with POSIX
  762. requirements.
  763. However, many applications fail to handle EXDEV at all and treat it as a
  764. normal error or otherwise handle it poorly.
  765. Such apps include: gvfsd\-fuse v1.20.3 and prior, Finder / CIFS/SMB
  766. client in Apple OSX 10.9+, NZBGet, Samba\[aq]s recycling bin feature.
  767. .PP
  768. As a result a compromise was made in order to get most software to work
  769. while still obeying mergerfs\[aq] policies.
  770. Below is the basic logic.
  771. .IP \[bu] 2
  772. If using a \f[B]create\f[] policy which tries to preserve directory
  773. paths (epff,eplfs,eplus,epmfs)
  774. .IP \[bu] 2
  775. Using the \f[B]rename\f[] policy get the list of files to rename
  776. .IP \[bu] 2
  777. For each file attempt rename:
  778. .RS 2
  779. .IP \[bu] 2
  780. If failure with ENOENT (no such file or directory) run \f[B]create\f[]
  781. policy
  782. .IP \[bu] 2
  783. If create policy returns the same drive as currently evaluating then
  784. clone the path
  785. .IP \[bu] 2
  786. Re\-attempt rename
  787. .RE
  788. .IP \[bu] 2
  789. If \f[B]any\f[] of the renames succeed the higher level rename is
  790. considered a success
  791. .IP \[bu] 2
  792. If \f[B]no\f[] renames succeed the first error encountered will be
  793. returned
  794. .IP \[bu] 2
  795. On success:
  796. .RS 2
  797. .IP \[bu] 2
  798. Remove the target from all drives with no source file
  799. .IP \[bu] 2
  800. Remove the source from all drives which failed to rename
  801. .RE
  802. .IP \[bu] 2
  803. If using a \f[B]create\f[] policy which does \f[B]not\f[] try to
  804. preserve directory paths
  805. .IP \[bu] 2
  806. Using the \f[B]rename\f[] policy get the list of files to rename
  807. .IP \[bu] 2
  808. Using the \f[B]getattr\f[] policy get the target path
  809. .IP \[bu] 2
  810. For each file attempt rename:
  811. .RS 2
  812. .IP \[bu] 2
  813. If the source drive != target drive:
  814. .IP \[bu] 2
  815. Clone target path from target drive to source drive
  816. .IP \[bu] 2
  817. Rename
  818. .RE
  819. .IP \[bu] 2
  820. If \f[B]any\f[] of the renames succeed the higher level rename is
  821. considered a success
  822. .IP \[bu] 2
  823. If \f[B]no\f[] renames succeed the first error encountered will be
  824. returned
  825. .IP \[bu] 2
  826. On success:
  827. .RS 2
  828. .IP \[bu] 2
  829. Remove the target from all drives with no source file
  830. .IP \[bu] 2
  831. Remove the source from all drives which failed to rename
  832. .RE
  833. .PP
  834. The the removals are subject to normal entitlement checks.
  835. .PP
  836. The above behavior will help minimize the likelihood of EXDEV being
  837. returned but it will still be possible.
  838. .PP
  839. \f[B]link\f[] uses the same strategy but without the removals.
  840. .SS readdir
  841. .PP
  842. readdir (http://linux.die.net/man/3/readdir) is different from all other
  843. filesystem functions.
  844. While it could have its own set of policies to tweak its behavior at
  845. this time it provides a simple union of files and directories found.
  846. Remember that any action or information queried about these files and
  847. directories come from the respective function.
  848. For instance: an \f[B]ls\f[] is a \f[B]readdir\f[] and for each
  849. file/directory returned \f[B]getattr\f[] is called.
  850. Meaning the policy of \f[B]getattr\f[] is responsible for choosing the
  851. file/directory which is the source of the metadata you see in an
  852. \f[B]ls\f[].
  853. .SS statfs / statvfs
  854. .PP
  855. statvfs (http://linux.die.net/man/2/statvfs) normalizes the source
  856. drives based on the fragment size and sums the number of adjusted blocks
  857. and inodes.
  858. This means you will see the combined space of all sources.
  859. Total, used, and free.
  860. The sources however are dedupped based on the drive so multiple sources
  861. on the same drive will not result in double counting its space.
  862. Filesystems mounted further down the tree of the branch will not be
  863. included when checking the mount\[aq]s stats.
  864. .PP
  865. The options \f[C]statfs\f[] and \f[C]statfs_ignore\f[] can be used to
  866. modify \f[C]statfs\f[] behavior.
  867. .SH BUILD / UPDATE
  868. .PP
  869. \f[B]NOTE:\f[] Prebuilt packages can be found at:
  870. https://github.com/trapexit/mergerfs/releases
  871. .PP
  872. First get the code from github (https://github.com/trapexit/mergerfs).
  873. .IP
  874. .nf
  875. \f[C]
  876. $\ git\ clone\ https://github.com/trapexit/mergerfs.git
  877. $\ #\ or
  878. $\ wget\ https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs\-<ver>.tar.gz
  879. \f[]
  880. .fi
  881. .SS Debian / Ubuntu
  882. .IP
  883. .nf
  884. \f[C]
  885. $\ cd\ mergerfs
  886. $\ sudo\ tools/install\-build\-pkgs
  887. $\ make\ deb
  888. $\ sudo\ dpkg\ \-i\ ../mergerfs_version_arch.deb
  889. \f[]
  890. .fi
  891. .SS RHEL / CentOS /Fedora
  892. .IP
  893. .nf
  894. \f[C]
  895. $\ su\ \-
  896. #\ cd\ mergerfs
  897. #\ tools/install\-build\-pkgs
  898. #\ make\ rpm
  899. #\ rpm\ \-i\ rpmbuild/RPMS/<arch>/mergerfs\-<verion>.<arch>.rpm
  900. \f[]
  901. .fi
  902. .SS Generically
  903. .PP
  904. Have git, g++, make, python installed.
  905. .IP
  906. .nf
  907. \f[C]
  908. $\ cd\ mergerfs
  909. $\ make
  910. $\ sudo\ make\ install
  911. \f[]
  912. .fi
  913. .SS Build options
  914. .IP
  915. .nf
  916. \f[C]
  917. $\ make\ help
  918. usage:\ make
  919. make\ USE_XATTR=0\ \ \ \ \ \ \-\ build\ program\ without\ xattrs\ functionality
  920. make\ STATIC=1\ \ \ \ \ \ \ \ \ \-\ build\ static\ binary
  921. make\ LTO=1\ \ \ \ \ \ \ \ \ \ \ \ \-\ build\ with\ link\ time\ optimization
  922. \f[]
  923. .fi
  924. .SH RUNTIME CONFIG
  925. .SS .mergerfs pseudo file
  926. .IP
  927. .nf
  928. \f[C]
  929. <mountpoint>/.mergerfs
  930. \f[]
  931. .fi
  932. .PP
  933. There is a pseudo file available at the mount point which allows for the
  934. runtime modification of certain \f[B]mergerfs\f[] options.
  935. The file will not show up in \f[B]readdir\f[] but can be
  936. \f[B]stat\f[]\[aq]ed and manipulated via
  937. {list,get,set}xattrs (http://linux.die.net/man/2/listxattr) calls.
  938. .PP
  939. Any changes made at runtime are \f[B]not\f[] persisted.
  940. If you wish for values to persist they must be included as options
  941. wherever you configure the mounting of mergerfs (/etc/fstab).
  942. .SS Keys
  943. .PP
  944. Use \f[C]xattr\ \-l\ /mountpoint/.mergerfs\f[] to see all supported
  945. keys.
  946. Some are informational and therefore read\-only.
  947. \f[C]setxattr\f[] will return EINVAL (invalid argument) on read\-only
  948. keys.
  949. .SS Values
  950. .PP
  951. Same as the command line.
  952. .SS user.mergerfs.branches
  953. .PP
  954. \f[B]NOTE:\f[] formerly \f[C]user.mergerfs.srcmounts\f[] but said key is
  955. still supported.
  956. .PP
  957. Used to query or modify the list of branches.
  958. When modifying there are several shortcuts to easy manipulation of the
  959. list.
  960. .PP
  961. .TS
  962. tab(@);
  963. l l.
  964. T{
  965. Value
  966. T}@T{
  967. Description
  968. T}
  969. _
  970. T{
  971. [list]
  972. T}@T{
  973. set
  974. T}
  975. T{
  976. +<[list]
  977. T}@T{
  978. prepend
  979. T}
  980. T{
  981. +>[list]
  982. T}@T{
  983. append
  984. T}
  985. T{
  986. \-[list]
  987. T}@T{
  988. remove all values provided
  989. T}
  990. T{
  991. \-<
  992. T}@T{
  993. remove first in list
  994. T}
  995. T{
  996. \->
  997. T}@T{
  998. remove last in list
  999. T}
  1000. .TE
  1001. .PP
  1002. \f[C]xattr\ \-w\ user.mergerfs.branches\ +</mnt/drive3\ /mnt/pool/.mergerfs\f[]
  1003. .PP
  1004. The \f[C]=NC\f[], \f[C]=RO\f[], \f[C]=RW\f[] syntax works just as on the
  1005. command line.
  1006. .SS Example
  1007. .IP
  1008. .nf
  1009. \f[C]
  1010. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-l\ .mergerfs
  1011. user.mergerfs.branches:\ /mnt/a=RW:/mnt/b=RW
  1012. user.mergerfs.minfreespace:\ 4294967295
  1013. user.mergerfs.moveonenospc:\ false
  1014. \&...
  1015. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.category.search\ .mergerfs
  1016. ff
  1017. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-w\ user.mergerfs.category.search\ newest\ .mergerfs
  1018. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.category.search\ .mergerfs
  1019. newest
  1020. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-w\ user.mergerfs.branches\ +/mnt/c\ .mergerfs
  1021. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.branches\ .mergerfs
  1022. /mnt/a:/mnt/b:/mnt/c
  1023. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-w\ user.mergerfs.branches\ =/mnt/c\ .mergerfs
  1024. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.branches\ .mergerfs
  1025. /mnt/c
  1026. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-w\ user.mergerfs.branches\ \[aq]+</mnt/a:/mnt/b\[aq]\ .mergerfs
  1027. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.branches\ .mergerfs
  1028. /mnt/a:/mnt/b:/mnt/c
  1029. \f[]
  1030. .fi
  1031. .SS file / directory xattrs
  1032. .PP
  1033. While they won\[aq]t show up when using
  1034. listxattr (http://linux.die.net/man/2/listxattr) \f[B]mergerfs\f[]
  1035. offers a number of special xattrs to query information about the files
  1036. served.
  1037. To access the values you will need to issue a
  1038. getxattr (http://linux.die.net/man/2/getxattr) for one of the following:
  1039. .IP \[bu] 2
  1040. \f[B]user.mergerfs.basepath\f[]: the base mount point for the file given
  1041. the current getattr policy
  1042. .IP \[bu] 2
  1043. \f[B]user.mergerfs.relpath\f[]: the relative path of the file from the
  1044. perspective of the mount point
  1045. .IP \[bu] 2
  1046. \f[B]user.mergerfs.fullpath\f[]: the full path of the original file
  1047. given the getattr policy
  1048. .IP \[bu] 2
  1049. \f[B]user.mergerfs.allpaths\f[]: a NUL (\[aq]\[aq]) separated list of
  1050. full paths to all files found
  1051. .IP
  1052. .nf
  1053. \f[C]
  1054. [trapexit:/mnt/mergerfs]\ $\ ls
  1055. A\ B\ C
  1056. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.fullpath\ A
  1057. /mnt/a/full/path/to/A
  1058. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.basepath\ A
  1059. /mnt/a
  1060. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.relpath\ A
  1061. /full/path/to/A
  1062. [trapexit:/mnt/mergerfs]\ $\ xattr\ \-p\ user.mergerfs.allpaths\ A\ |\ tr\ \[aq]\\0\[aq]\ \[aq]\\n\[aq]
  1063. /mnt/a/full/path/to/A
  1064. /mnt/b/full/path/to/A
  1065. \f[]
  1066. .fi
  1067. .SH UPGRADE
  1068. .PP
  1069. mergerfs can be upgraded live by mounting on top of the previous
  1070. version.
  1071. Simply install the new version of mergerfs and follow the instructions
  1072. below.
  1073. .PP
  1074. Add \f[C]nonempty\f[] to your mergerfs option list and call mergerfs
  1075. again or if using \f[C]/etc/fstab\f[] call for it to mount again.
  1076. Existing open files and such will continue to work fine though they
  1077. won\[aq]t see runtime changes since any such change would be the new
  1078. mount.
  1079. If you plan on changing settings with the new mount you should / could
  1080. apply those before mounting the new version.
  1081. .IP
  1082. .nf
  1083. \f[C]
  1084. $\ sudo\ mount\ /mnt/mergerfs
  1085. $\ mount\ |\ grep\ mergerfs
  1086. media\ on\ /mnt/mergerfs\ type\ fuse.mergerfs\ (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
  1087. media\ on\ /mnt/mergerfs\ type\ fuse.mergerfs\ (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
  1088. \f[]
  1089. .fi
  1090. .SH TOOLING
  1091. .IP \[bu] 2
  1092. https://github.com/trapexit/mergerfs\-tools
  1093. .IP \[bu] 2
  1094. mergerfs.ctl: A tool to make it easier to query and configure mergerfs
  1095. at runtime
  1096. .IP \[bu] 2
  1097. mergerfs.fsck: Provides permissions and ownership auditing and the
  1098. ability to fix them
  1099. .IP \[bu] 2
  1100. mergerfs.dedup: Will help identify and optionally remove duplicate files
  1101. .IP \[bu] 2
  1102. mergerfs.dup: Ensure there are at least N copies of a file across the
  1103. pool
  1104. .IP \[bu] 2
  1105. mergerfs.balance: Rebalance files across drives by moving them from the
  1106. most filled to the least filled
  1107. .IP \[bu] 2
  1108. mergerfs.consolidate: move files within a single mergerfs directory to
  1109. the drive with most free space
  1110. .IP \[bu] 2
  1111. mergerfs.mktrash: Creates FreeDesktop.org Trash specification compatible
  1112. directories on a mergerfs mount
  1113. .IP \[bu] 2
  1114. https://github.com/trapexit/scorch
  1115. .IP \[bu] 2
  1116. scorch: A tool to help discover silent corruption of files and keep
  1117. track of files
  1118. .IP \[bu] 2
  1119. https://github.com/trapexit/bbf
  1120. .IP \[bu] 2
  1121. bbf (bad block finder): a tool to scan for and \[aq]fix\[aq] hard drive
  1122. bad blocks and find the files using those blocks
  1123. .SH CACHING
  1124. .SS page caching
  1125. .PP
  1126. https://en.wikipedia.org/wiki/Page_cache
  1127. .PP
  1128. tl;dr: * cache.files=off: Disables page caching.
  1129. Underlying files cached, mergerfs files are not.
  1130. * cache.files=partial: Enables page caching.
  1131. Underlying files cached, mergerfs files cached while open.
  1132. * cache.files=full: Enables page caching.
  1133. Underlying files cached, mergerfs files cached across opens.
  1134. * cache.files=auto\-full: Enables page caching.
  1135. Underlying files cached, mergerfs files cached across opens if mtime and
  1136. size are unchanged since previous open.
  1137. * cache.files=libfuse: follow traditional libfuse \f[C]direct_io\f[],
  1138. \f[C]kernel_cache\f[], and \f[C]auto_cache\f[] arguments.
  1139. .PP
  1140. FUSE, which mergerfs uses, offers a number of page caching modes.
  1141. mergerfs tries to simplify their use via the \f[C]cache.files\f[]
  1142. option.
  1143. It can and should replace usage of \f[C]direct_io\f[],
  1144. \f[C]kernel_cache\f[], and \f[C]auto_cache\f[].
  1145. .PP
  1146. Due to mergerfs using FUSE and therefore being a userland process
  1147. proxying existing filesystems the kernel will double cache the content
  1148. being read and written through mergerfs.
  1149. Once from the underlying filesystem and once from mergerfs (it sees them
  1150. as two separate entities).
  1151. Using \f[C]cache.files=off\f[] will keep the double caching from
  1152. happening by disabling caching of mergerfs but this has the side effect
  1153. that \f[I]all\f[] read and write calls will be passed to mergerfs which
  1154. may be slower than enabling caching, you lose shared \f[C]mmap\f[]
  1155. support which can affect apps such as rtorrent, and no read\-ahead will
  1156. take place.
  1157. The kernel will still cache the underlying filesystem data but that only
  1158. helps so much given mergerfs will still process all requests.
  1159. .PP
  1160. If you do enable file page caching,
  1161. \f[C]cache.files=partial|full|auto\-full\f[], you should also enable
  1162. \f[C]dropcacheonclose\f[] which will cause mergerfs to instruct the
  1163. kernel to flush the underlying file\[aq]s page cache when the file is
  1164. closed.
  1165. This behavior is the same as the rsync fadvise / drop cache patch and
  1166. Feh\[aq]s nocache project.
  1167. .PP
  1168. If most files are read once through and closed (like media) it is best
  1169. to enable \f[C]dropcacheonclose\f[] regardless of caching mode in order
  1170. to minimize buffer bloat.
  1171. .PP
  1172. It is difficult to balance memory usage, cache bloat & duplication, and
  1173. performance.
  1174. Ideally mergerfs would be able to disable caching for the files it
  1175. reads/writes but allow page caching for itself.
  1176. That would limit the FUSE overhead.
  1177. However, there isn\[aq]t a good way to achieve this.
  1178. It would need to open all files with O_DIRECT which places limitations
  1179. on the what underlying filesystems would be supported and complicates
  1180. the code.
  1181. .PP
  1182. kernel documentation:
  1183. https://www.kernel.org/doc/Documentation/filesystems/fuse\-io.txt
  1184. .SS entry & attribute caching
  1185. .PP
  1186. Given the relatively high cost of FUSE due to the kernel <\-> userspace
  1187. round trips there are kernel side caches for file entries and
  1188. attributes.
  1189. The entry cache limits the \f[C]lookup\f[] calls to mergerfs which ask
  1190. if a file exists.
  1191. The attribute cache limits the need to make \f[C]getattr\f[] calls to
  1192. mergerfs which provide file attributes (mode, size, type, etc.).
  1193. As with the page cache these should not be used if the underlying
  1194. filesystems are being manipulated at the same time as it could lead to
  1195. odd behavior or data corruption.
  1196. The options for setting these are \f[C]cache.entry\f[] and
  1197. \f[C]cache.negative_entry\f[] for the entry cache and
  1198. \f[C]cache.attr\f[] for the attributes cache.
  1199. \f[C]cache.negative_entry\f[] refers to the timeout for negative
  1200. responses to lookups (non\-existent files).
  1201. .SS writeback caching
  1202. .PP
  1203. When \f[C]cache.files\f[] is enabled the default is for it to perform
  1204. writethrough caching.
  1205. This behavior won\[aq]t help improve performance as each write still
  1206. goes one for one through the filesystem.
  1207. By enabling the FUSE writeback cache small writes may be aggregated by
  1208. the kernel and then sent to mergerfs as one larger request.
  1209. This can greatly improve the throughput for apps which write to files
  1210. inefficiently.
  1211. The amount the kernel can aggregate is limited by the size of a FUSE
  1212. message.
  1213. Read the \f[C]fuse_msg_size\f[] section for more details.
  1214. .PP
  1215. There is a small side effect as a result of enabling wrtieback caching.
  1216. Underlying files won\[aq]t ever be opened with O_APPEND or O_WRONLY.
  1217. The former because the kernel then manages append mode and the latter
  1218. because the kernel may request file data from mergerfs to populate the
  1219. write cache.
  1220. The O_APPEND change means that if a file is changed outside of mergerfs
  1221. it could lead to corruption as the kernel won\[aq]t know the end of the
  1222. file has changed.
  1223. That said any time you use caching you should keep from using the same
  1224. file outside of mergerfs at the same time.
  1225. .PP
  1226. Note that if an application is properly sizing writes then writeback
  1227. caching will have little or no effect.
  1228. It will only help with writes of sizes below the FUSE message size (128K
  1229. on older kernels, 1M on newer).
  1230. .SS policy caching
  1231. .PP
  1232. Policies are run every time a function (with a policy as mentioned
  1233. above) is called.
  1234. These policies can be expensive depending on mergerfs\[aq] setup and
  1235. client usage patterns.
  1236. Generally we wouldn\[aq]t want to cache policy results because it may
  1237. result in stale responses if the underlying drives are used directly.
  1238. .PP
  1239. The \f[C]open\f[] policy cache will cache the result of an \f[C]open\f[]
  1240. policy for a particular input for \f[C]cache.open\f[] seconds or until
  1241. the file is unlinked.
  1242. Each file close (release) will randomly chose to clean up the cache of
  1243. expired entries.
  1244. .PP
  1245. This cache is really only useful in cases where you have a large number
  1246. of branches and \f[C]open\f[] is called on the same files repeatedly
  1247. (like \f[B]Transmission\f[] which opens and closes a file on every
  1248. read/write presumably to keep file handle usage low).
  1249. .SS statfs caching
  1250. .PP
  1251. Of the syscalls used by mergerfs in policies the \f[C]statfs\f[] /
  1252. \f[C]statvfs\f[] call is perhaps the most expensive.
  1253. It\[aq]s used to find out the available space of a drive and whether it
  1254. is mounted read\-only.
  1255. Depending on the setup and usage pattern these queries can be relatively
  1256. costly.
  1257. When \f[C]cache.statfs\f[] is enabled all calls to \f[C]statfs\f[] by a
  1258. policy will be cached for the number of seconds its set to.
  1259. .PP
  1260. Example: If the create policy is \f[C]mfs\f[] and the timeout is 60 then
  1261. for that 60 seconds the same drive will be returned as the target for
  1262. creates because the available space won\[aq]t be updated for that time.
  1263. .SS symlink caching
  1264. .PP
  1265. As of version 4.20 Linux supports symlink caching.
  1266. Significant performance increases can be had in workloads which use a
  1267. lot of symlinks.
  1268. Setting \f[C]cache.symlinks=true\f[] will result in requesting symlink
  1269. caching from the kernel only if supported.
  1270. As a result its safe to enable it on systems prior to 4.20.
  1271. That said it is disabled by default for now.
  1272. You can see if caching is enabled by querying the xattr
  1273. \f[C]user.mergerfs.cache.symlinks\f[] but given it must be requested at
  1274. startup you can not change it at runtime.
  1275. .SS readdir caching
  1276. .PP
  1277. As of version 4.20 Linux supports readdir caching.
  1278. This can have a significant impact on directory traversal.
  1279. Especially when combined with entry (\f[C]cache.entry\f[]) and attribute
  1280. (\f[C]cache.attr\f[]) caching.
  1281. Setting \f[C]cache.readdir=true\f[] will result in requesting readdir
  1282. caching from the kernel on each \f[C]opendir\f[].
  1283. If the kernel doesn\[aq]t support readdir caching setting the option to
  1284. \f[C]true\f[] has no effect.
  1285. This option is configurable at runtime via xattr
  1286. \f[C]user.mergerfs.cache.readdir\f[].
  1287. .SS tiered caching
  1288. .PP
  1289. Some storage technologies support what some call "tiered" caching.
  1290. The placing of usually smaller, faster storage as a transparent cache to
  1291. larger, slower storage.
  1292. NVMe, SSD, Optane in front of traditional HDDs for instance.
  1293. .PP
  1294. MergerFS does not natively support any sort of tiered caching.
  1295. Most users have no use for such a feature and its inclusion would
  1296. complicate the code.
  1297. However, there are a few situations where a cache drive could help with
  1298. a typical mergerfs setup.
  1299. .IP "1." 3
  1300. Fast network, slow drives, many readers: You\[aq]ve a 10+Gbps network
  1301. with many readers and your regular drives can\[aq]t keep up.
  1302. .IP "2." 3
  1303. Fast network, slow drives, small\[aq]ish bursty writes: You have a
  1304. 10+Gbps network and wish to transfer amounts of data less than your
  1305. cache drive but wish to do so quickly.
  1306. .PP
  1307. With #1 its arguable if you should be using mergerfs at all.
  1308. RAID would probably be the better solution.
  1309. If you\[aq]re going to use mergerfs there are other tactics that may
  1310. help: spreading the data across drives (see the mergerfs.dup tool) and
  1311. setting \f[C]func.open=rand\f[], using \f[C]symlinkify\f[], or using
  1312. dm\-cache or a similar technology to add tiered cache to the underlying
  1313. device.
  1314. .PP
  1315. With #2 one could use dm\-cache as well but there is another solution
  1316. which requires only mergerfs and a cronjob.
  1317. .IP "1." 3
  1318. Create 2 mergerfs pools.
  1319. One which includes just the slow drives and one which has both the fast
  1320. drives (SSD,NVME,etc.) and slow drives.
  1321. .IP "2." 3
  1322. The \[aq]cache\[aq] pool should have the cache drives listed first.
  1323. .IP "3." 3
  1324. The best \f[C]create\f[] policies to use for the \[aq]cache\[aq] pool
  1325. would probably be \f[C]ff\f[], \f[C]epff\f[], \f[C]lfs\f[], or
  1326. \f[C]eplfs\f[].
  1327. The latter two under the assumption that the cache drive(s) are far
  1328. smaller than the backing drives.
  1329. If using path preserving policies remember that you\[aq]ll need to
  1330. manually create the core directories of those paths you wish to be
  1331. cached.
  1332. Be sure the permissions are in sync.
  1333. Use \f[C]mergerfs.fsck\f[] to check / correct them.
  1334. You could also tag the slow drives as \f[C]=NC\f[] though that\[aq]d
  1335. mean if the cache drives fill you\[aq]d get "out of space" errors.
  1336. .IP "4." 3
  1337. Enable \f[C]moveonenospc\f[] and set \f[C]minfreespace\f[]
  1338. appropriately.
  1339. To make sure there is enough room on the "slow" pool you might want to
  1340. set \f[C]minfreespace\f[] to at least as large as the size of the
  1341. largest cache drive if not larger.
  1342. This way in the worst case the whole of the cache drive(s) can be moved
  1343. to the other drives.
  1344. .IP "5." 3
  1345. Set your programs to use the cache pool.
  1346. .IP "6." 3
  1347. Save one of the below scripts or create you\[aq]re own.
  1348. .IP "7." 3
  1349. Use \f[C]cron\f[] (as root) to schedule the command at whatever
  1350. frequency is appropriate for your workflow.
  1351. .SS time based expiring
  1352. .PP
  1353. Move files from cache to backing pool based only on the last time the
  1354. file was accessed.
  1355. Replace \f[C]\-atime\f[] with \f[C]\-amin\f[] if you want minutes rather
  1356. than days.
  1357. May want to use the \f[C]fadvise\f[] / \f[C]\-\-drop\-cache\f[] version
  1358. of rsync or run rsync with the tool "nocache".
  1359. .IP
  1360. .nf
  1361. \f[C]
  1362. #!/bin/bash
  1363. if\ [\ $#\ !=\ 3\ ];\ then
  1364. \ \ echo\ "usage:\ $0\ <cache\-drive>\ <backing\-pool>\ <days\-old>"
  1365. \ \ exit\ 1
  1366. fi
  1367. CACHE="${1}"
  1368. BACKING="${2}"
  1369. N=${3}
  1370. find\ "${CACHE}"\ \-type\ f\ \-atime\ +${N}\ \-printf\ \[aq]%P\\n\[aq]\ |\ \\
  1371. \ \ rsync\ \-\-files\-from=\-\ \-axqHAXWES\ \-\-preallocate\ \-\-remove\-source\-files\ "${CACHE}/"\ "${BACKING}/"
  1372. \f[]
  1373. .fi
  1374. .SS percentage full expiring
  1375. .PP
  1376. Move the oldest file from the cache to the backing pool.
  1377. Continue till below percentage threshold.
  1378. .IP
  1379. .nf
  1380. \f[C]
  1381. #!/bin/bash
  1382. if\ [\ $#\ !=\ 3\ ];\ then
  1383. \ \ echo\ "usage:\ $0\ <cache\-drive>\ <backing\-pool>\ <percentage>"
  1384. \ \ exit\ 1
  1385. fi
  1386. CACHE="${1}"
  1387. BACKING="${2}"
  1388. PERCENTAGE=${3}
  1389. set\ \-o\ errexit
  1390. while\ [\ $(df\ \-\-output=pcent\ "${CACHE}"\ |\ grep\ \-v\ Use\ |\ cut\ \-d\[aq]%\[aq]\ \-f1)\ \-gt\ ${PERCENTAGE}\ ]
  1391. do
  1392. \ \ \ \ FILE=$(find\ "${CACHE}"\ \-type\ f\ \-printf\ \[aq]%A\@\ %P\\n\[aq]\ |\ \\
  1393. \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sort\ |\ \\
  1394. \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ head\ \-n\ 1\ |\ \\
  1395. \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cut\ \-d\[aq]\ \[aq]\ \-f2\-)
  1396. \ \ \ \ test\ \-n\ "${FILE}"
  1397. \ \ \ \ rsync\ \-axqHAXWES\ \-\-preallocate\ \-\-remove\-source\-files\ "${CACHE}/./${FILE}"\ "${BACKING}/"
  1398. done
  1399. \f[]
  1400. .fi
  1401. .SH PERFORMANCE
  1402. .PP
  1403. mergerfs is at its core just a proxy and therefore its theoretical max
  1404. performance is that of the underlying devices.
  1405. However, given it is a FUSE filesystem working from userspace there is
  1406. an increase in overhead relative to kernel based solutions.
  1407. That said the performance can match the theoretical max but it depends
  1408. greatly on the system\[aq]s configuration.
  1409. Especially when adding network filesystems into the mix there are many
  1410. variables which can impact performance.
  1411. Drive speeds and latency, network speeds and latency, general
  1412. concurrency, read/write sizes, etc.
  1413. Unfortunately, given the number of variables it has been difficult to
  1414. find a single set of settings which provide optimal performance.
  1415. If you\[aq]re having performance issues please look over the suggestions
  1416. below (including the benchmarking section.)
  1417. .PP
  1418. NOTE: be sure to read about these features before changing them to
  1419. understand what behaviors it may impact
  1420. .IP \[bu] 2
  1421. enable (or disable) \f[C]splice_move\f[], \f[C]splice_read\f[], and
  1422. \f[C]splice_write\f[]
  1423. .IP \[bu] 2
  1424. disable \f[C]security_capability\f[] and/or \f[C]xattr\f[]
  1425. .IP \[bu] 2
  1426. increase cache timeouts \f[C]cache.attr\f[], \f[C]cache.entry\f[],
  1427. \f[C]cache.negative_entry\f[]
  1428. .IP \[bu] 2
  1429. enable (or disable) page caching (\f[C]cache.files\f[])
  1430. .IP \[bu] 2
  1431. enable \f[C]cache.writeback\f[]
  1432. .IP \[bu] 2
  1433. enable \f[C]cache.open\f[]
  1434. .IP \[bu] 2
  1435. enable \f[C]cache.statfs\f[]
  1436. .IP \[bu] 2
  1437. enable \f[C]cache.symlinks\f[]
  1438. .IP \[bu] 2
  1439. enable \f[C]cache.readdir\f[]
  1440. .IP \[bu] 2
  1441. change the number of worker threads
  1442. .IP \[bu] 2
  1443. disable \f[C]posix_acl\f[]
  1444. .IP \[bu] 2
  1445. disable \f[C]async_read\f[]
  1446. .IP \[bu] 2
  1447. test theoretical performance using \f[C]nullrw\f[] or mounting a ram
  1448. disk
  1449. .IP \[bu] 2
  1450. use \f[C]symlinkify\f[] if your data is largely static and read\-only
  1451. .IP \[bu] 2
  1452. use tiered cache drives
  1453. .IP \[bu] 2
  1454. use LVM and LVM cache to place a SSD in front of your HDDs
  1455. .PP
  1456. If you come across a setting that significantly impacts performance
  1457. please contact trapexit so he may investigate further.
  1458. .SH BENCHMARKING
  1459. .PP
  1460. Filesystems are complicated.
  1461. They do many things and many of those are interconnected.
  1462. Additionally, the OS, drivers, hardware, etc.
  1463. all can impact performance.
  1464. Therefore, when benchmarking, it is \f[B]necessary\f[] that the test
  1465. focus as narrowly as possible.
  1466. .PP
  1467. For most throughput is the key benchmark.
  1468. To test throughput \f[C]dd\f[] is useful but \f[B]must\f[] be used with
  1469. the correct settings in order to ensure the filesystem or device is
  1470. actually being tested.
  1471. The OS can and will cache data.
  1472. Without forcing synchronous reads and writes and/or disabling caching
  1473. the values returned will not be representative of the device\[aq]s true
  1474. performance.
  1475. .PP
  1476. When benchmarking through mergerfs ensure you only use 1 branch to
  1477. remove any possibility of the policies complicating the situation.
  1478. Benchmark the underlying filesystem first and then mount mergerfs over
  1479. it and test again.
  1480. If you\[aq]re experience speeds below your expectation you will need to
  1481. narrow down precisely which component is leading to the slowdown.
  1482. Preferably test the following in the order listed (but not combined).
  1483. .IP "1." 3
  1484. Enable \f[C]nullrw\f[] mode with \f[C]nullrw=true\f[].
  1485. This will effectively make reads and writes no\-ops.
  1486. Removing the underlying device / filesystem from the equation.
  1487. This will give us the top theoretical speeds.
  1488. .IP "2." 3
  1489. Mount mergerfs over \f[C]tmpfs\f[].
  1490. \f[C]tmpfs\f[] is a RAM disk.
  1491. Extremely high speed and very low latency.
  1492. This is a more realistic best case scenario.
  1493. Example: \f[C]mount\ \-t\ tmpfs\ \-o\ size=2G\ tmpfs\ /tmp/tmpfs\f[]
  1494. .IP "3." 3
  1495. Mount mergerfs over a local drive.
  1496. NVMe, SSD, HDD, etc.
  1497. If you have more than one I\[aq]d suggest testing each of them as drives
  1498. and/or controllers (their drivers) could impact performance.
  1499. .IP "4." 3
  1500. Finally, if you intend to use mergerfs with a network filesystem, either
  1501. as the source of data or to combine with another through mergerfs, test
  1502. each of those alone as above.
  1503. .PP
  1504. Once you find the component which has the performance issue you can do
  1505. further testing with different options to see if they impact
  1506. performance.
  1507. For reads and writes the most relevant would be: \f[C]cache.files\f[],
  1508. \f[C]async_read\f[], \f[C]splice_move\f[], \f[C]splice_read\f[],
  1509. \f[C]splice_write\f[].
  1510. Less likely but relevant when using NFS or with certain filesystems
  1511. would be \f[C]security_capability\f[], \f[C]xattr\f[], and
  1512. \f[C]posix_acl\f[].
  1513. If you find a specific system, drive, filesystem, controller, etc.
  1514. that performs poorly contact trapexit so he may investigate further.
  1515. .PP
  1516. Sometimes the problem is really the application accessing or writing
  1517. data through mergerfs.
  1518. Some software use small buffer sizes which can lead to more requests and
  1519. therefore greater overhead.
  1520. You can test this out yourself by replace \f[C]bs=1M\f[] in the examples
  1521. below with \f[C]ibs\f[] or \f[C]obs\f[] and using a size of \f[C]512\f[]
  1522. instead of \f[C]1M\f[].
  1523. In one example test using \f[C]nullrw\f[] the write speed dropped from
  1524. 4.9GB/s to 69.7MB/s when moving from \f[C]1M\f[] to \f[C]512\f[].
  1525. Similar results were had when testing reads.
  1526. Small writes overhead may be improved by leveraging a write cache but in
  1527. casual tests little gain was found.
  1528. More tests will need to be done before this feature would become
  1529. available.
  1530. If you have an app that appears slow with mergerfs it could be due to
  1531. this.
  1532. Contact trapexit so he may investigate further.
  1533. .SS write benchmark
  1534. .IP
  1535. .nf
  1536. \f[C]
  1537. $\ dd\ if=/dev/zero\ of=/mnt/mergerfs/1GB.file\ bs=1M\ count=1024\ oflag=nocache\ conv=fdatasync\ status=progress
  1538. \f[]
  1539. .fi
  1540. .SS read benchmark
  1541. .IP
  1542. .nf
  1543. \f[C]
  1544. $\ dd\ if=/mnt/mergerfs/1GB.file\ of=/dev/null\ bs=1M\ count=1024\ iflag=nocache\ conv=fdatasync\ status=progress
  1545. \f[]
  1546. .fi
  1547. .SH TIPS / NOTES
  1548. .IP \[bu] 2
  1549. \f[B]use_ino\f[] will only work when used with mergerfs 2.18.0 and
  1550. above.
  1551. .IP \[bu] 2
  1552. Run mergerfs as \f[C]root\f[] (with \f[B]allow_other\f[]) unless
  1553. you\[aq]re merging paths which are owned by the same user otherwise
  1554. strange permission issues may arise.
  1555. .IP \[bu] 2
  1556. https://github.com/trapexit/backup\-and\-recovery\-howtos : A set of
  1557. guides / howtos on creating a data storage system, backing it up,
  1558. maintaining it, and recovering from failure.
  1559. .IP \[bu] 2
  1560. If you don\[aq]t see some directories and files you expect in a merged
  1561. point or policies seem to skip drives be sure the user has permission to
  1562. all the underlying directories.
  1563. Use \f[C]mergerfs.fsck\f[] to audit the drive for out of sync
  1564. permissions.
  1565. .IP \[bu] 2
  1566. Do \f[B]not\f[] use \f[C]cache.files=off\f[] (or \f[C]direct_io\f[]) if
  1567. you expect applications (such as rtorrent) to
  1568. mmap (http://linux.die.net/man/2/mmap) files.
  1569. Shared mmap is not currently supported in FUSE w/ \f[C]direct_io\f[]
  1570. enabled.
  1571. Enabling \f[C]dropcacheonclose\f[] is recommended when
  1572. \f[C]cache.files=partial|full|auto\-full\f[] or
  1573. \f[C]direct_io=false\f[].
  1574. .IP \[bu] 2
  1575. Since POSIX functions give only a singular error or success its
  1576. difficult to determine the proper behavior when applying the function to
  1577. multiple targets.
  1578. \f[B]mergerfs\f[] will return an error only if all attempts of an action
  1579. fail.
  1580. Any success will lead to a success returned.
  1581. This means however that some odd situations may arise.
  1582. .IP \[bu] 2
  1583. Kodi (http://kodi.tv), Plex (http://plex.tv),
  1584. Subsonic (http://subsonic.org), etc.
  1585. can use directory mtime (http://linux.die.net/man/2/stat) to more
  1586. efficiently determine whether to scan for new content rather than simply
  1587. performing a full scan.
  1588. If using the default \f[B]getattr\f[] policy of \f[B]ff\f[] its possible
  1589. those programs will miss an update on account of it returning the first
  1590. directory found\[aq]s \f[B]stat\f[] info and its a later directory on
  1591. another mount which had the \f[B]mtime\f[] recently updated.
  1592. To fix this you will want to set \f[B]func.getattr=newest\f[].
  1593. Remember though that this is just \f[B]stat\f[].
  1594. If the file is later \f[B]open\f[]\[aq]ed or \f[B]unlink\f[]\[aq]ed and
  1595. the policy is different for those then a completely different file or
  1596. directory could be acted on.
  1597. .IP \[bu] 2
  1598. Some policies mixed with some functions may result in strange behaviors.
  1599. Not that some of these behaviors and race conditions couldn\[aq]t happen
  1600. outside \f[B]mergerfs\f[] but that they are far more likely to occur on
  1601. account of the attempt to merge together multiple sources of data which
  1602. could be out of sync due to the different policies.
  1603. .IP \[bu] 2
  1604. For consistency its generally best to set \f[B]category\f[] wide
  1605. policies rather than individual \f[B]func\f[]\[aq]s.
  1606. This will help limit the confusion of tools such as
  1607. rsync (http://linux.die.net/man/1/rsync).
  1608. However, the flexibility is there if needed.
  1609. .SH KNOWN ISSUES / BUGS
  1610. .SS directory mtime is not being updated
  1611. .PP
  1612. Remember that the default policy for \f[C]getattr\f[] is \f[C]ff\f[].
  1613. The information for the first directory found will be returned.
  1614. If it wasn\[aq]t the directory which had been updated then it will
  1615. appear outdated.
  1616. .PP
  1617. The reason this is the default is because any other policy would be more
  1618. expensive and for many applications it is unnecessary.
  1619. To always return the directory with the most recent mtime or a faked
  1620. value based on all found would require a scan of all drives.
  1621. .PP
  1622. If you always want the directory information from the one with the most
  1623. recent mtime then use the \f[C]newest\f[] policy for \f[C]getattr\f[].
  1624. .SS \[aq]mv /mnt/pool/foo /mnt/disk1/foo\[aq] removes \[aq]foo\[aq]
  1625. .PP
  1626. This is not a bug.
  1627. .PP
  1628. Run in verbose mode to better understand what\[aq]s happening:
  1629. .IP
  1630. .nf
  1631. \f[C]
  1632. $\ mv\ \-v\ /mnt/pool/foo\ /mnt/disk1/foo
  1633. copied\ \[aq]/mnt/pool/foo\[aq]\ \->\ \[aq]/mnt/disk1/foo\[aq]
  1634. removed\ \[aq]/mnt/pool/foo\[aq]
  1635. $\ ls\ /mnt/pool/foo
  1636. ls:\ cannot\ access\ \[aq]/mnt/pool/foo\[aq]:\ No\ such\ file\ or\ directory
  1637. \f[]
  1638. .fi
  1639. .PP
  1640. \f[C]mv\f[], when working across devices, is copying the source to
  1641. target and then removing the source.
  1642. Since the source \f[B]is\f[] the target in this case, depending on the
  1643. unlink policy, it will remove the just copied file and other files
  1644. across the branches.
  1645. .PP
  1646. If you want to move files to one drive just copy them there and use
  1647. mergerfs.dedup to clean up the old paths or manually remove them from
  1648. the branches directly.
  1649. .SS cached memory appears greater than it should be
  1650. .PP
  1651. Use \f[C]cache.files=off\f[] or \f[C]direct_io=true\f[].
  1652. See the section on page caching.
  1653. .SS NFS clients returning ESTALE / Stale file handle
  1654. .PP
  1655. Be sure to use \f[C]noforget\f[] and \f[C]use_ino\f[] arguments.
  1656. .SS NFS clients don\[aq]t work
  1657. .PP
  1658. Some NFS clients appear to fail when a mergerfs mount is exported.
  1659. Kodi in particular seems to have issues.
  1660. .PP
  1661. Try enabling the \f[C]use_ino\f[] option.
  1662. Some have reported that it fixes the issue.
  1663. .SS rtorrent fails with ENODEV (No such device)
  1664. .PP
  1665. Be sure to set \f[C]cache.files=partial|full|auto\-full\f[] or turn off
  1666. \f[C]direct_io\f[].
  1667. rtorrent and some other applications use
  1668. mmap (http://linux.die.net/man/2/mmap) to read and write to files and
  1669. offer no fallback to traditional methods.
  1670. FUSE does not currently support mmap while using \f[C]direct_io\f[].
  1671. There may be a performance penalty on writes with \f[C]direct_io\f[] off
  1672. as well as the problem of double caching but it\[aq]s the only way to
  1673. get such applications to work.
  1674. If the performance loss is too high for other apps you can mount
  1675. mergerfs twice.
  1676. Once with \f[C]direct_io\f[] enabled and one without it.
  1677. Be sure to set \f[C]dropcacheonclose=true\f[] if not using
  1678. \f[C]direct_io\f[].
  1679. .SS rtorrent fails with files >= 4GiB
  1680. .PP
  1681. This is a kernel bug with mmap and FUSE on 32bit platforms.
  1682. A fix should become available for all LTS releases.
  1683. .PP
  1684. https://marc.info/?l=linux\-fsdevel&m=155550785230874&w=2
  1685. .SS Crashing on OpenVZ
  1686. .PP
  1687. There appears to be a bug in the OpenVZ kernel with regard to how it
  1688. handles ioctl calls.
  1689. It is making invalid requests which leads to a crash.
  1690. As of 2019\-12\-10 there is a bug report filed with OpenVZ but it is not
  1691. yet fixed.
  1692. .SS Plex doesn\[aq]t work with mergerfs
  1693. .PP
  1694. It does.
  1695. If you\[aq]re trying to put Plex\[aq]s config / metadata on mergerfs you
  1696. have to leave \f[C]direct_io\f[] off because Plex is using sqlite3 which
  1697. apparently needs mmap.
  1698. mmap doesn\[aq]t work with \f[C]direct_io\f[].
  1699. To fix this place the data elsewhere or disable \f[C]direct_io\f[] (with
  1700. \f[C]dropcacheonclose=true\f[]).
  1701. Sqlite3 does not need mmap but the developer needs to fall back to
  1702. standard IO if mmap fails.
  1703. .PP
  1704. If the issue is that scanning doesn\[aq]t seem to pick up media then be
  1705. sure to set \f[C]func.getattr=newest\f[] as mentioned above.
  1706. .SS mmap performance is really bad
  1707. .PP
  1708. There is/was a bug (https://lkml.org/lkml/2016/3/16/260) in caching
  1709. which affects overall performance of mmap through FUSE in Linux 4.x
  1710. kernels.
  1711. It is fixed in 4.4.10 and 4.5.4 (https://lkml.org/lkml/2016/5/11/59).
  1712. .SS When a program tries to move or rename a file it fails
  1713. .PP
  1714. Please read the section above regarding rename & link (#rename--link).
  1715. .PP
  1716. The problem is that many applications do not properly handle
  1717. \f[C]EXDEV\f[] errors which \f[C]rename\f[] and \f[C]link\f[] may return
  1718. even though they are perfectly valid situations which do not indicate
  1719. actual drive or OS errors.
  1720. The error will only be returned by mergerfs if using a path preserving
  1721. policy as described in the policy section above.
  1722. If you do not care about path preservation simply change the mergerfs
  1723. policy to the non\-path preserving version.
  1724. For example: \f[C]\-o\ category.create=mfs\f[]
  1725. .PP
  1726. Ideally the offending software would be fixed and it is recommended that
  1727. if you run into this problem you contact the software\[aq]s author and
  1728. request proper handling of \f[C]EXDEV\f[] errors.
  1729. .SS Samba: Moving files / directories fails
  1730. .PP
  1731. Workaround: Copy the file/directory and then remove the original rather
  1732. than move.
  1733. .PP
  1734. This isn\[aq]t an issue with Samba but some SMB clients.
  1735. GVFS\-fuse v1.20.3 and prior (found in Ubuntu 14.04 among others) failed
  1736. to handle certain error codes correctly.
  1737. Particularly \f[B]STATUS_NOT_SAME_DEVICE\f[] which comes from the
  1738. \f[B]EXDEV\f[] which is returned by \f[B]rename\f[] when the call is
  1739. crossing mount points.
  1740. When a program gets an \f[B]EXDEV\f[] it needs to explicitly take an
  1741. alternate action to accomplish its goal.
  1742. In the case of \f[B]mv\f[] or similar it tries \f[B]rename\f[] and on
  1743. \f[B]EXDEV\f[] falls back to a manual copying of data between the two
  1744. locations and unlinking the source.
  1745. In these older versions of GVFS\-fuse if it received \f[B]EXDEV\f[] it
  1746. would translate that into \f[B]EIO\f[].
  1747. This would cause \f[B]mv\f[] or most any application attempting to move
  1748. files around on that SMB share to fail with a IO error.
  1749. .PP
  1750. GVFS\-fuse v1.22.0 (https://bugzilla.gnome.org/show_bug.cgi?id=734568)
  1751. and above fixed this issue but a large number of systems use the older
  1752. release.
  1753. On Ubuntu the version can be checked by issuing
  1754. \f[C]apt\-cache\ showpkg\ gvfs\-fuse\f[].
  1755. Most distros released in 2015 seem to have the updated release and will
  1756. work fine but older systems may not.
  1757. Upgrading gvfs\-fuse or the distro in general will address the problem.
  1758. .PP
  1759. In Apple\[aq]s MacOSX 10.9 they replaced Samba (client and server) with
  1760. their own product.
  1761. It appears their new client does not handle \f[B]EXDEV\f[] either and
  1762. responds similar to older release of gvfs on Linux.
  1763. .SS Trashing files occasionally fails
  1764. .PP
  1765. This is the same issue as with Samba.
  1766. \f[C]rename\f[] returns \f[C]EXDEV\f[] (in our case that will really
  1767. only happen with path preserving policies like \f[C]epmfs\f[]) and the
  1768. software doesn\[aq]t handle the situation well.
  1769. This is unfortunately a common failure of software which moves files
  1770. around.
  1771. The standard indicates that an implementation \f[C]MAY\f[] choose to
  1772. support non\-user home directory trashing of files (which is a
  1773. \f[C]MUST\f[]).
  1774. The implementation \f[C]MAY\f[] also support "top directory trashes"
  1775. which many probably do.
  1776. .PP
  1777. To create a \f[C]$topdir/.Trash\f[] directory as defined in the standard
  1778. use the mergerfs\-tools (https://github.com/trapexit/mergerfs-tools)
  1779. tool \f[C]mergerfs.mktrash\f[].
  1780. .SS tar: Directory renamed before its status could be extracted
  1781. .PP
  1782. Make sure to use the \f[C]use_ino\f[] option.
  1783. .SS Supplemental user groups
  1784. .PP
  1785. Due to the overhead of
  1786. getgroups/setgroups (http://linux.die.net/man/2/setgroups) mergerfs
  1787. utilizes a cache.
  1788. This cache is opportunistic and per thread.
  1789. Each thread will query the supplemental groups for a user when that
  1790. particular thread needs to change credentials and will keep that data
  1791. for the lifetime of the thread.
  1792. This means that if a user is added to a group it may not be picked up
  1793. without the restart of mergerfs.
  1794. However, since the high level FUSE API\[aq]s (at least the standard
  1795. version) thread pool dynamically grows and shrinks it\[aq]s possible
  1796. that over time a thread will be killed and later a new thread with no
  1797. cache will start and query the new data.
  1798. .PP
  1799. The gid cache uses fixed storage to simplify the design and be
  1800. compatible with older systems which may not have C++11 compilers.
  1801. There is enough storage for 256 users\[aq] supplemental groups.
  1802. Each user is allowed up to 32 supplemental groups.
  1803. Linux >= 2.6.3 allows up to 65535 groups per user but most other *nixs
  1804. allow far less.
  1805. NFS allowing only 16.
  1806. The system does handle overflow gracefully.
  1807. If the user has more than 32 supplemental groups only the first 32 will
  1808. be used.
  1809. If more than 256 users are using the system when an uncached user is
  1810. found it will evict an existing user\[aq]s cache at random.
  1811. So long as there aren\[aq]t more than 256 active users this should be
  1812. fine.
  1813. If either value is too low for your needs you will have to modify
  1814. \f[C]gidcache.hpp\f[] to increase the values.
  1815. Note that doing so will increase the memory needed by each thread.
  1816. .PP
  1817. While not a bug some users have found when using containers that
  1818. supplemental groups defined inside the container don\[aq]t work properly
  1819. with regard to permissions.
  1820. This is expected as mergerfs lives outside the container and therefore
  1821. is querying the host\[aq]s group database.
  1822. There might be a hack to work around this (make mergerfs read the
  1823. /etc/group file in the container) but it is not yet implemented and
  1824. would be limited to Linux and the /etc/group DB.
  1825. Preferably users would mount in the host group file into the containers
  1826. or use a standard shared user & groups technology like NIS or LDAP.
  1827. .SS mergerfs or libfuse crashing
  1828. .PP
  1829. First...
  1830. always upgrade to the latest version unless told otherwise.
  1831. .PP
  1832. If using mergerfs below 2.22.0:
  1833. .PP
  1834. If suddenly the mergerfs mount point disappears and
  1835. \f[C]Transport\ endpoint\ is\ not\ connected\f[] is returned when
  1836. attempting to perform actions within the mount directory \f[B]and\f[]
  1837. the version of libfuse (use \f[C]mergerfs\ \-v\f[] to find the version)
  1838. is older than \f[C]2.9.4\f[] its likely due to a bug in libfuse.
  1839. Affected versions of libfuse can be found in Debian Wheezy, Ubuntu
  1840. Precise and others.
  1841. .PP
  1842. In order to fix this please install newer versions of libfuse.
  1843. If using a Debian based distro (Debian,Ubuntu,Mint) you can likely just
  1844. install newer versions of
  1845. libfuse (https://packages.debian.org/unstable/libfuse2) and
  1846. fuse (https://packages.debian.org/unstable/fuse) from the repo of a
  1847. newer release.
  1848. .PP
  1849. If using mergerfs at or above 2.22.0:
  1850. .PP
  1851. First upgrade if possible, check the known bugs section, and contact
  1852. trapexit.
  1853. .SS mergerfs appears to be crashing or exiting
  1854. .PP
  1855. There seems to be an issue with Linux version \f[C]4.9.0\f[] and above
  1856. in which an invalid message appears to be transmitted to libfuse (used
  1857. by mergerfs) causing it to exit.
  1858. No messages will be printed in any logs as its not a proper crash.
  1859. Debugging of the issue is still ongoing and can be followed via the
  1860. fuse\-devel
  1861. thread (https://sourceforge.net/p/fuse/mailman/message/35662577).
  1862. .SS mergerfs under heavy load and memory pressure leads to kernel panic
  1863. .PP
  1864. https://lkml.org/lkml/2016/9/14/527
  1865. .IP
  1866. .nf
  1867. \f[C]
  1868. [25192.515454]\ kernel\ BUG\ at\ /build/linux\-a2WvEb/linux\-4.4.0/mm/workingset.c:346!
  1869. [25192.517521]\ invalid\ opcode:\ 0000\ [#1]\ SMP
  1870. [25192.519602]\ Modules\ linked\ in:\ netconsole\ ip6t_REJECT\ nf_reject_ipv6\ ipt_REJECT\ nf_reject_ipv4\ configfs\ binfmt_misc\ veth\ bridge\ stp\ llc\ nf_conntrack_ipv6\ nf_defrag_ipv6\ xt_conntrack\ ip6table_filter\ ip6_tables\ xt_multiport\ iptable_filter\ ipt_MASQUERADE\ nf_nat_masquerade_ipv4\ xt_comment\ xt_nat\ iptable_nat\ nf_conntrack_ipv4\ nf_defrag_ipv4\ nf_nat_ipv4\ nf_nat\ nf_conntrack\ xt_CHECKSUM\ xt_tcpudp\ iptable_mangle\ ip_tables\ x_tables\ intel_rapl\ x86_pkg_temp_thermal\ intel_powerclamp\ eeepc_wmi\ asus_wmi\ coretemp\ sparse_keymap\ kvm_intel\ ppdev\ kvm\ irqbypass\ mei_me\ 8250_fintek\ input_leds\ serio_raw\ parport_pc\ tpm_infineon\ mei\ shpchp\ mac_hid\ parport\ lpc_ich\ autofs4\ drbg\ ansi_cprng\ dm_crypt\ algif_skcipher\ af_alg\ btrfs\ raid456\ async_raid6_recov\ async_memcpy\ async_pq\ async_xor\ async_tx\ xor\ raid6_pq\ libcrc32c\ raid0\ multipath\ linear\ raid10\ raid1\ i915\ crct10dif_pclmul\ crc32_pclmul\ aesni_intel\ i2c_algo_bit\ aes_x86_64\ drm_kms_helper\ lrw\ gf128mul\ glue_helper\ ablk_helper\ syscopyarea\ cryptd\ sysfillrect\ sysimgblt\ fb_sys_fops\ drm\ ahci\ r8169\ libahci\ mii\ wmi\ fjes\ video\ [last\ unloaded:\ netconsole]
  1871. [25192.540910]\ CPU:\ 2\ PID:\ 63\ Comm:\ kswapd0\ Not\ tainted\ 4.4.0\-36\-generic\ #55\-Ubuntu
  1872. [25192.543411]\ Hardware\ name:\ System\ manufacturer\ System\ Product\ Name/P8H67\-M\ PRO,\ BIOS\ 3904\ 04/27/2013
  1873. [25192.545840]\ task:\ ffff88040cae6040\ ti:\ ffff880407488000\ task.ti:\ ffff880407488000
  1874. [25192.548277]\ RIP:\ 0010:[<ffffffff811ba501>]\ \ [<ffffffff811ba501>]\ shadow_lru_isolate+0x181/0x190
  1875. [25192.550706]\ RSP:\ 0018:ffff88040748bbe0\ \ EFLAGS:\ 00010002
  1876. [25192.553127]\ RAX:\ 0000000000001c81\ RBX:\ ffff8802f91ee928\ RCX:\ ffff8802f91eeb38
  1877. [25192.555544]\ RDX:\ ffff8802f91ee938\ RSI:\ ffff8802f91ee928\ RDI:\ ffff8804099ba2c0
  1878. [25192.557914]\ RBP:\ ffff88040748bc08\ R08:\ 000000000001a7b6\ R09:\ 000000000000003f
  1879. [25192.560237]\ R10:\ 000000000001a750\ R11:\ 0000000000000000\ R12:\ ffff8804099ba2c0
  1880. [25192.562512]\ R13:\ ffff8803157e9680\ R14:\ ffff8803157e9668\ R15:\ ffff8804099ba2c8
  1881. [25192.564724]\ FS:\ \ 0000000000000000(0000)\ GS:ffff88041f280000(0000)\ knlGS:0000000000000000
  1882. [25192.566990]\ CS:\ \ 0010\ DS:\ 0000\ ES:\ 0000\ CR0:\ 0000000080050033
  1883. [25192.569201]\ CR2:\ 00007ffabb690000\ CR3:\ 0000000001e0a000\ CR4:\ 00000000000406e0
  1884. [25192.571419]\ Stack:
  1885. [25192.573550]\ \ ffff8804099ba2c0\ ffff88039e4f86f0\ ffff8802f91ee928\ ffff8804099ba2c8
  1886. [25192.575695]\ \ ffff88040748bd08\ ffff88040748bc58\ ffffffff811b99bf\ 0000000000000052
  1887. [25192.577814]\ \ 0000000000000000\ ffffffff811ba380\ 000000000000008a\ 0000000000000080
  1888. [25192.579947]\ Call\ Trace:
  1889. [25192.582022]\ \ [<ffffffff811b99bf>]\ __list_lru_walk_one.isra.3+0x8f/0x130
  1890. [25192.584137]\ \ [<ffffffff811ba380>]\ ?\ memcg_drain_all_list_lrus+0x190/0x190
  1891. [25192.586165]\ \ [<ffffffff811b9a83>]\ list_lru_walk_one+0x23/0x30
  1892. [25192.588145]\ \ [<ffffffff811ba544>]\ scan_shadow_nodes+0x34/0x50
  1893. [25192.590074]\ \ [<ffffffff811a0e9d>]\ shrink_slab.part.40+0x1ed/0x3d0
  1894. [25192.591985]\ \ [<ffffffff811a53da>]\ shrink_zone+0x2ca/0x2e0
  1895. [25192.593863]\ \ [<ffffffff811a64ce>]\ kswapd+0x51e/0x990
  1896. [25192.595737]\ \ [<ffffffff811a5fb0>]\ ?\ mem_cgroup_shrink_node_zone+0x1c0/0x1c0
  1897. [25192.597613]\ \ [<ffffffff810a0808>]\ kthread+0xd8/0xf0
  1898. [25192.599495]\ \ [<ffffffff810a0730>]\ ?\ kthread_create_on_node+0x1e0/0x1e0
  1899. [25192.601335]\ \ [<ffffffff8182e34f>]\ ret_from_fork+0x3f/0x70
  1900. [25192.603193]\ \ [<ffffffff810a0730>]\ ?\ kthread_create_on_node+0x1e0/0x1e0
  1901. \f[]
  1902. .fi
  1903. .PP
  1904. There is a bug in the kernel.
  1905. A work around appears to be turning off \f[C]splice\f[].
  1906. Don\[aq]t add the \f[C]splice_*\f[] arguments or add
  1907. \f[C]no_splice_write,no_splice_move,no_splice_read\f[].
  1908. This, however, is not guaranteed to work.
  1909. .SS rm: fts_read failed: No such file or directory
  1910. .PP
  1911. NOTE: This is only relevant to mergerfs versions at or below v2.25.x and
  1912. should not occur in more recent versions.
  1913. See the notes on \f[C]unlink\f[].
  1914. .PP
  1915. Not \f[I]really\f[] a bug.
  1916. The FUSE library will move files when asked to delete them as a way to
  1917. deal with certain edge cases and then later delete that file when its
  1918. clear the file is no longer needed.
  1919. This however can lead to two issues.
  1920. One is that these hidden files are noticed by \f[C]rm\ \-rf\f[] or
  1921. \f[C]find\f[] when scanning directories and they may try to remove them
  1922. and they might have disappeared already.
  1923. There is nothing \f[I]wrong\f[] about this happening but it can be
  1924. annoying.
  1925. The second issue is that a directory might not be able to removed on
  1926. account of the hidden file being still there.
  1927. .PP
  1928. Using the \f[B]hard_remove\f[] option will make it so these temporary
  1929. files are not used and files are deleted immediately.
  1930. That has a side effect however.
  1931. Files which are unlinked and then they are still used (in certain forms)
  1932. will result in an error (ENOENT).
  1933. .SH FAQ
  1934. .SS How well does mergerfs scale? Is it "production ready?"
  1935. .PP
  1936. Users have reported running mergerfs on everything from a Raspberry Pi
  1937. to dual socket Xeon systems with >20 cores.
  1938. I\[aq]m aware of at least a few companies which use mergerfs in
  1939. production.
  1940. Open Media Vault (https://www.openmediavault.org) includes mergerfs as
  1941. its sole solution for pooling drives.
  1942. .SS Can mergerfs be used with drives which already have data / are in
  1943. use?
  1944. .PP
  1945. Yes.
  1946. MergerFS is a proxy and does \f[B]NOT\f[] interfere with the normal form
  1947. or function of the drives / mounts / paths it manages.
  1948. .PP
  1949. MergerFS is \f[B]not\f[] a traditional filesystem.
  1950. MergerFS is \f[B]not\f[] RAID.
  1951. It does \f[B]not\f[] manipulate the data that passes through it.
  1952. It does \f[B]not\f[] shard data across drives.
  1953. It merely shards some \f[B]behavior\f[] and aggregates others.
  1954. .SS Can mergerfs be removed without affecting the data?
  1955. .PP
  1956. See the previous question\[aq]s answer.
  1957. .SS What policies should I use?
  1958. .PP
  1959. Unless you\[aq]re doing something more niche the average user is
  1960. probably best off using \f[C]mfs\f[] for \f[C]category.create\f[].
  1961. It will spread files out across your branches based on available space.
  1962. You may want to use \f[C]lus\f[] if you prefer a slightly different
  1963. distribution of data if you have a mix of smaller and larger drives.
  1964. Generally though \f[C]mfs\f[], \f[C]lus\f[], or even \f[C]rand\f[] are
  1965. good for the general use case.
  1966. If you are starting with an imbalanced pool you can use the tool
  1967. \f[B]mergerfs.balance\f[] to redistribute files across the pool.
  1968. .PP
  1969. If you really wish to try to colocate files based on directory you can
  1970. set \f[C]func.create\f[] to \f[C]epmfs\f[] or similar and
  1971. \f[C]func.mkdir\f[] to \f[C]rand\f[] or \f[C]eprand\f[] depending on if
  1972. you just want to colocate generally or on specific branches.
  1973. Either way the \f[I]need\f[] to colocate is rare.
  1974. For instance: if you wish to remove the drive regularly and want the
  1975. data to predictably be on that drive or if you don\[aq]t use backup at
  1976. all and don\[aq]t wish to replace that data piecemeal.
  1977. In which case using path preservation can help but will require some
  1978. manual attention.
  1979. Colocating after the fact can be accomplished using the
  1980. \f[B]mergerfs.consolidate\f[] tool.
  1981. .PP
  1982. Ultimately there is no correct answer.
  1983. It is a preference or based on some particular need.
  1984. mergerfs is very easy to test and experiment with.
  1985. I suggest creating a test setup and experimenting to get a sense of what
  1986. you want.
  1987. .PP
  1988. The reason \f[C]mfs\f[] is not the default \f[C]category.create\f[]
  1989. policy is historical.
  1990. When/if a 3.X gets released it will be changed to minimize confusion
  1991. people often have with path preserving policies.
  1992. .SS What settings should I use?
  1993. .PP
  1994. Depends on what features you want.
  1995. Generally speaking there are no "wrong" settings.
  1996. All settings are performance or feature related.
  1997. The best bet is to read over the available options and choose what fits
  1998. your situation.
  1999. If something isn\[aq]t clear from the documentation please reach out and
  2000. the documentation will be improved.
  2001. .PP
  2002. That said, for the average person, the following should be fine:
  2003. .PP
  2004. \f[C]\-o\ use_ino,cache.files=off,dropcacheonclose=true,allow_other,category.create=mfs\f[]
  2005. .SS Why are all my files ending up on 1 drive?!
  2006. .PP
  2007. Did you start with empty drives?
  2008. Did you explicitly configure a \f[C]category.create\f[] policy?
  2009. Are you using a path preserving policy?
  2010. .PP
  2011. The default create policy is \f[C]epmfs\f[].
  2012. That is a path preserving algorithm.
  2013. With such a policy for \f[C]mkdir\f[] and \f[C]create\f[] with a set of
  2014. empty drives it will select only 1 drive when the first directory is
  2015. created.
  2016. Anything, files or directories, created in that first directory will be
  2017. placed on the same branch because it is preserving paths.
  2018. .PP
  2019. This catches a lot of new users off guard but changing the default would
  2020. break the setup for many existing users.
  2021. If you do not care about path preservation and wish your files to be
  2022. spread across all your drives change to \f[C]mfs\f[] or similar policy
  2023. as described above.
  2024. If you do want path preservation you\[aq]ll need to perform the manual
  2025. act of creating paths on the drives you want the data to land on before
  2026. transferring your data.
  2027. Setting \f[C]func.mkdir=epall\f[] can simplify managing path
  2028. preservation for \f[C]create\f[].
  2029. Or use \f[C]func.mkdir=rand\f[] if you\[aq]re intersted in just grouping
  2030. together directory content by drive.
  2031. .SS Do hard links work?
  2032. .PP
  2033. Yes.
  2034. You need to use \f[C]use_ino\f[] to support proper reporting of inodes.
  2035. .PP
  2036. What mergerfs does not do is fake hard links across branches.
  2037. Read the section "rename & link" for how it works.
  2038. .SS Does mergerfs support CoW / copy\-on\-write?
  2039. .PP
  2040. Not in the sense of a filesystem like BTRFS or ZFS nor in the overlayfs
  2041. or aufs sense.
  2042. It does offer a
  2043. cow\-shell (http://manpages.ubuntu.com/manpages/bionic/man1/cow-shell.1.html)
  2044. like hard link breaking (copy to temp file then rename over original)
  2045. which can be useful when wanting to save space by hardlinking duplicate
  2046. files but wish to treat each name as if it were a unique and separate
  2047. file.
  2048. .SS Why can\[aq]t I see my files / directories?
  2049. .PP
  2050. It\[aq]s almost always a permissions issue.
  2051. Unlike mhddfs and unionfs\-fuse, which runs as root and attempts to
  2052. access content as such, mergerfs always changes its credentials to that
  2053. of the caller.
  2054. This means that if the user does not have access to a file or directory
  2055. than neither will mergerfs.
  2056. However, because mergerfs is creating a union of paths it may be able to
  2057. read some files and directories on one drive but not another resulting
  2058. in an incomplete set.
  2059. .PP
  2060. Whenever you run into a split permission issue (seeing some but not all
  2061. files) try using
  2062. mergerfs.fsck (https://github.com/trapexit/mergerfs-tools) tool to check
  2063. for and fix the mismatch.
  2064. If you aren\[aq]t seeing anything at all be sure that the basic
  2065. permissions are correct.
  2066. The user and group values are correct and that directories have their
  2067. executable bit set.
  2068. A common mistake by users new to Linux is to \f[C]chmod\ \-R\ 644\f[]
  2069. when they should have \f[C]chmod\ \-R\ u=rwX,go=rX\f[].
  2070. .PP
  2071. If using a network filesystem such as NFS, SMB, CIFS (Samba) be sure to
  2072. pay close attention to anything regarding permissioning and users.
  2073. Root squashing and user translation for instance has bitten a few
  2074. mergerfs users.
  2075. Some of these also affect the use of mergerfs from container platforms
  2076. such as Docker.
  2077. .SS Is my OS\[aq]s libfuse needed for mergerfs to work?
  2078. .PP
  2079. No.
  2080. Normally \f[C]mount.fuse\f[] is needed to get mergerfs (or any FUSE
  2081. filesystem to mount using the \f[C]mount\f[] command but in vendoring
  2082. the libfuse library the \f[C]mount.fuse\f[] app has been renamed to
  2083. \f[C]mount.mergerfs\f[] meaning the filesystem type in \f[C]fstab\f[]
  2084. can simply be \f[C]mergerfs\f[].
  2085. .SS Why was libfuse embedded into mergerfs?
  2086. .IP "1." 3
  2087. A significant number of users use mergerfs on distros with old versions
  2088. of libfuse which have serious bugs.
  2089. Requiring updated versions of libfuse on those distros isn\[aq]t
  2090. practical (no package offered, user inexperience, etc.).
  2091. The only practical way to provide a stable runtime on those systems was
  2092. to "vendor" / embed the library into the project.
  2093. .IP "2." 3
  2094. mergerfs was written to use the high level API.
  2095. There are a number of limitations in the HLAPI that make certain
  2096. features difficult or impossible to implement.
  2097. While some of these features could be patched into newer versions of
  2098. libfuse without breaking the public API some of them would require hacky
  2099. code to provide backwards compatibility.
  2100. While it may still be worth working with upstream to address these
  2101. issues in future versions, since the library needs to be vendored for
  2102. stability and compatibility reasons it is preferable / easier to modify
  2103. the API.
  2104. Longer term the plan is to rewrite mergerfs to use the low level API.
  2105. .SS Why did support for system libfuse get removed?
  2106. .PP
  2107. See above first.
  2108. .PP
  2109. If/when mergerfs is rewritten to use the low\-level API then it\[aq]ll
  2110. be plausible to support system libfuse but till then its simply too much
  2111. work to manage the differences across the versions.
  2112. .SS Why use mergerfs over mhddfs?
  2113. .PP
  2114. mhddfs is no longer maintained and has some known stability and security
  2115. issues (see below).
  2116. MergerFS provides a superset of mhddfs\[aq] features and should offer
  2117. the same or maybe better performance.
  2118. .PP
  2119. Below is an example of mhddfs and mergerfs setup to work similarly.
  2120. .PP
  2121. \f[C]mhddfs\ \-o\ mlimit=4G,allow_other\ /mnt/drive1,/mnt/drive2\ /mnt/pool\f[]
  2122. .PP
  2123. \f[C]mergerfs\ \-o\ minfreespace=4G,allow_other,category.create=ff\ /mnt/drive1:/mnt/drive2\ /mnt/pool\f[]
  2124. .SS Why use mergerfs over aufs?
  2125. .PP
  2126. aufs is mostly abandoned and no longer available in many distros.
  2127. .PP
  2128. While aufs can offer better peak performance mergerfs provides more
  2129. configurability and is generally easier to use.
  2130. mergerfs however does not offer the overlay / copy\-on\-write (CoW)
  2131. features which aufs and overlayfs have.
  2132. .SS Why use mergerfs over unionfs?
  2133. .PP
  2134. UnionFS is more like aufs than mergerfs in that it offers overlay / CoW
  2135. features.
  2136. If you\[aq]re just looking to create a union of drives and want
  2137. flexibility in file/directory placement then mergerfs offers that
  2138. whereas unionfs is more for overlaying RW filesystems over RO ones.
  2139. .SS Why use mergerfs over overlayfs?
  2140. .PP
  2141. Same reasons as with unionfs.
  2142. .SS Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation /
  2143. striping?
  2144. .PP
  2145. With simple JBOD / drive concatenation / stripping / RAID0 a single
  2146. drive failure will result in full pool failure.
  2147. mergerfs performs a similar function without the possibility of
  2148. catastrophic failure and the difficulties in recovery.
  2149. Drives may fail, however, all other data will continue to be accessible.
  2150. .PP
  2151. When combined with something like SnapRaid (http://www.snapraid.it)
  2152. and/or an offsite backup solution you can have the flexibility of JBOD
  2153. without the single point of failure.
  2154. .SS Why use mergerfs over ZFS?
  2155. .PP
  2156. MergerFS is not intended to be a replacement for ZFS.
  2157. MergerFS is intended to provide flexible pooling of arbitrary drives
  2158. (local or remote), of arbitrary sizes, and arbitrary filesystems.
  2159. For \f[C]write\ once,\ read\ many\f[] usecases such as bulk media
  2160. storage.
  2161. Where data integrity and backup is managed in other ways.
  2162. In that situation ZFS can introduce a number of costs and limitations as
  2163. described
  2164. here (http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html),
  2165. here (https://markmcb.com/2020/01/07/five-years-of-btrfs/), and
  2166. here (https://utcc.utoronto.ca/~cks/space/blog/solaris/ZFSWhyNoRealReshaping).
  2167. .SS Why use mergerfs over UnRAID?
  2168. .PP
  2169. UnRAID is a full OS and its storage layer, as I understand, is
  2170. proprietary and closed source.
  2171. Users who have experience with both have said they perfer the flexibilty
  2172. offered by mergerfs and for some the fact it is free and open source is
  2173. important.
  2174. .PP
  2175. There are a number of UnRAID users who use mergerfs as well though
  2176. I\[aq]m not entirely familiar with the use case.
  2177. .SS What should mergerfs NOT be used for?
  2178. .IP \[bu] 2
  2179. databases: Even if the database stored data in separate files (mergerfs
  2180. wouldn\[aq]t offer much otherwise) the higher latency of the indirection
  2181. will kill performance.
  2182. If it is a lightly used SQLITE database then it may be fine but
  2183. you\[aq]ll need to test.
  2184. .IP \[bu] 2
  2185. VM images: For the same reasons as databases.
  2186. VM images are accessed very aggressively and mergerfs will introduce too
  2187. much latency (if it works at all).
  2188. .IP \[bu] 2
  2189. As replacement for RAID: mergerfs is just for pooling branches.
  2190. If you need that kind of device performance aggregation or high
  2191. availability you should stick with RAID.
  2192. .SS Can drives be written to directly? Outside of mergerfs while pooled?
  2193. .PP
  2194. Yes, however its not recommended to use the same file from within the
  2195. pool and from without at the same time (particularly writing).
  2196. Especially if using caching of any kind (cache.files, cache.entry,
  2197. cache.attr, cache.negative_entry, cache.symlinks, cache.readdir, etc.)
  2198. as there could be a conflict between cached data and not.
  2199. .SS Why do I get an "out of space" / "no space left on device" / ENOSPC
  2200. error even though there appears to be lots of space available?
  2201. .PP
  2202. First make sure you\[aq]ve read the sections above about policies, path
  2203. preservation, branch filtering, and the options \f[B]minfreespace\f[],
  2204. \f[B]moveonenospc\f[], \f[B]statfs\f[], and \f[B]statfs_ignore\f[].
  2205. .PP
  2206. mergerfs is simply presenting a union of the content within multiple
  2207. branches.
  2208. The reported free space is an aggregate of space available within the
  2209. pool (behavior modified by \f[B]statfs\f[] and \f[B]statfs_ignore\f[]).
  2210. It does not represent a contiguous space.
  2211. In the same way that read\-only filesystems, those with quotas, or
  2212. reserved space report the full theoretical space available.
  2213. .PP
  2214. Due to path preservation, branch tagging, read\-only status, and
  2215. \f[B]minfreespace\f[] settings it is perfectly valid that
  2216. \f[C]ENOSPC\f[] / "out of space" / "no space left on device" be
  2217. returned.
  2218. It is doing what was asked of it: filtering possible branches due to
  2219. those settings.
  2220. Only one error can be returned and if one of the reasons for filtering a
  2221. branch was \f[B]minfreespace\f[] then it will be returned as such.
  2222. \f[B]moveonenospc\f[] is only relevant to writing a file which is too
  2223. large for the drive its currently on.
  2224. .PP
  2225. It is also possible that the filesystem selected has run out of inodes.
  2226. Use \f[C]df\ \-i\f[] to list the total and available inodes per
  2227. filesystem.
  2228. .PP
  2229. If you don\[aq]t care about path preservation then simply change the
  2230. \f[C]create\f[] policy to one which isn\[aq]t.
  2231. \f[C]mfs\f[] is probably what most are looking for.
  2232. The reason its not default is because it was originally set to
  2233. \f[C]epmfs\f[] and changing it now would change people\[aq]s setup.
  2234. Such a setting change will likely occur in mergerfs 3.
  2235. .SS Can mergerfs mounts be exported over NFS?
  2236. .PP
  2237. Yes.
  2238. Due to current usage of libfuse by mergerfs and how NFS interacts with
  2239. it it is necessary to add \f[C]noforget\f[] to mergerfs options to keep
  2240. from getting "stale file handle" errors.
  2241. .PP
  2242. Some clients (Kodi) have issues in which the contents of the NFS mount
  2243. will not be presented but users have found that enabling the
  2244. \f[C]use_ino\f[] option often fixes that problem.
  2245. .SS Can mergerfs mounts be exported over Samba / SMB?
  2246. .PP
  2247. Yes.
  2248. While some users have reported problems it appears to always be related
  2249. to how Samba is setup in relation to permissions.
  2250. .SS How are inodes calculated?
  2251. .PP
  2252. https://github.com/trapexit/mergerfs/blob/master/src/fs_inode.hpp
  2253. .PP
  2254. Originally tried to simply OR st_ino and (st_dev << 32) for 64bit
  2255. systems.
  2256. After a number of years someone finally ran into a collision that lead
  2257. to some problems.
  2258. Traditionally \f[C]dev_t\f[] was 16bit and \f[C]ino_t\f[] was 32bit so
  2259. merging into one 64bit value worked but with both types being able to be
  2260. up to 64bit that is no longer as simple.
  2261. A proper hash seems like the best compromise.
  2262. While totally unique inodes are preferred the overhead which would be
  2263. needed does not seem to be outweighed by the benefits.
  2264. .PP
  2265. While atypical, yes, inodes can be reused and not refer to the same
  2266. file.
  2267. The internal id used to reference a file in FUSE is different from the
  2268. inode value presented.
  2269. The former is the \f[C]nodeid\f[] and is actually a tuple of
  2270. (nodeid,generation).
  2271. That tuple is not user facing.
  2272. The inode is merely metadata passed through the kernel and found using
  2273. the \f[C]stat\f[] family of calls or \f[C]readdir\f[].
  2274. .PP
  2275. From FUSE docs regarding \f[C]use_ino\f[]:
  2276. .IP
  2277. .nf
  2278. \f[C]
  2279. Honor\ the\ st_ino\ field\ in\ the\ functions\ getattr()\ and
  2280. fill_dir().\ This\ value\ is\ used\ to\ fill\ in\ the\ st_ino\ field
  2281. in\ the\ stat(2),\ lstat(2),\ fstat(2)\ functions\ and\ the\ d_ino
  2282. field\ in\ the\ readdir(2)\ function.\ The\ filesystem\ does\ not
  2283. have\ to\ guarantee\ uniqueness,\ however\ some\ applications
  2284. rely\ on\ this\ value\ being\ unique\ for\ the\ whole\ filesystem.
  2285. Note\ that\ this\ does\ *not*\ affect\ the\ inode\ that\ libfuse
  2286. and\ the\ kernel\ use\ internally\ (also\ called\ the\ "nodeid").
  2287. \f[]
  2288. .fi
  2289. .PP
  2290. Generally collision, if it occurs, shouldn\[aq]t be a problem.
  2291. You can turn off the calculation by not using \f[C]use_ino\f[].
  2292. In the future it might be worth creating different strategies for users
  2293. to select from.
  2294. .SS I notice massive slowdowns of writes when enabling cache.files.
  2295. .PP
  2296. When file caching is enabled in any form (\f[C]cache.files!=off\f[] or
  2297. \f[C]direct_io=false\f[]) it will issue \f[C]getxattr\f[] requests for
  2298. \f[C]security.capability\f[] prior to \f[I]every single write\f[].
  2299. This will usually result in a performance degregation, especially when
  2300. using a network filesystem (such as NFS or CIFS/SMB/Samba.)
  2301. Unfortunately at this moment the kernel is not caching the response.
  2302. .PP
  2303. To work around this situation mergerfs offers a few solutions.
  2304. .IP "1." 3
  2305. Set \f[C]security_capability=false\f[].
  2306. It will short curcuit any call and return \f[C]ENOATTR\f[].
  2307. This still means though that mergerfs will receive the request before
  2308. every write but at least it doesn\[aq]t get passed through to the
  2309. underlying filesystem.
  2310. .IP "2." 3
  2311. Set \f[C]xattr=noattr\f[].
  2312. Same as above but applies to \f[I]all\f[] calls to getxattr.
  2313. Not just \f[C]security.capability\f[].
  2314. This will not be cached by the kernel either but mergerfs\[aq] runtime
  2315. config system will still function.
  2316. .IP "3." 3
  2317. Set \f[C]xattr=nosys\f[].
  2318. Results in mergerfs returning \f[C]ENOSYS\f[] which \f[I]will\f[] be
  2319. cached by the kernel.
  2320. No future xattr calls will be forwarded to mergerfs.
  2321. The downside is that also means the xattr based config and query
  2322. functionality won\[aq]t work either.
  2323. .IP "4." 3
  2324. Disable file caching.
  2325. If you aren\[aq]t using applications which use \f[C]mmap\f[] it\[aq]s
  2326. probably simplier to just disable it all together.
  2327. The kernel won\[aq]t send the requests when caching is disabled.
  2328. .SS What are these .fuse_hidden files?
  2329. .PP
  2330. NOTE: mergerfs >= 2.26.0 will not have these temporary files.
  2331. See the notes on \f[C]unlink\f[].
  2332. .PP
  2333. When not using \f[B]hard_remove\f[] libfuse will create
  2334. \&.fuse_hiddenXXXXXXXX files when an opened file is unlinked.
  2335. This is to simplify "use after unlink" usecases.
  2336. There is a possibility these files end up being picked up by software
  2337. scanning directories and not ignoring hidden files.
  2338. This is rarely a problem but a solution is in the works.
  2339. .PP
  2340. The files are cleaned up once the file is finally closed.
  2341. Only if mergerfs crashes or is killed would they be left around.
  2342. They are safe to remove as they are already unlinked files.
  2343. .SS It\[aq]s mentioned that there are some security issues with mhddfs.
  2344. What are they? How does mergerfs address them?
  2345. .PP
  2346. mhddfs (https://github.com/trapexit/mhddfs) manages running as
  2347. \f[B]root\f[] by calling
  2348. getuid() (https://github.com/trapexit/mhddfs/blob/cae96e6251dd91e2bdc24800b4a18a74044f6672/src/main.c#L319)
  2349. and if it returns \f[B]0\f[] then it will
  2350. chown (http://linux.die.net/man/1/chown) the file.
  2351. Not only is that a race condition but it doesn\[aq]t handle other
  2352. situations.
  2353. Rather than attempting to simulate POSIX ACL behavior the proper way to
  2354. manage this is to use seteuid (http://linux.die.net/man/2/seteuid) and
  2355. setegid (http://linux.die.net/man/2/setegid), in effect becoming the
  2356. user making the original call, and perform the action as them.
  2357. This is what mergerfs does and why mergerfs should always run as root.
  2358. .PP
  2359. In Linux setreuid syscalls apply only to the thread.
  2360. GLIBC hides this away by using realtime signals to inform all threads to
  2361. change credentials.
  2362. Taking after \f[B]Samba\f[], mergerfs uses
  2363. \f[B]syscall(SYS_setreuid,...)\f[] to set the callers credentials for
  2364. that thread only.
  2365. Jumping back to \f[B]root\f[] as necessary should escalated privileges
  2366. be needed (for instance: to clone paths between drives).
  2367. .PP
  2368. For non\-Linux systems mergerfs uses a read\-write lock and changes
  2369. credentials only when necessary.
  2370. If multiple threads are to be user X then only the first one will need
  2371. to change the processes credentials.
  2372. So long as the other threads need to be user X they will take a readlock
  2373. allowing multiple threads to share the credentials.
  2374. Once a request comes in to run as user Y that thread will attempt a
  2375. write lock and change to Y\[aq]s credentials when it can.
  2376. If the ability to give writers priority is supported then that flag will
  2377. be used so threads trying to change credentials don\[aq]t starve.
  2378. This isn\[aq]t the best solution but should work reasonably well
  2379. assuming there are few users.
  2380. .SH SUPPORT
  2381. .PP
  2382. Filesystems are complex and difficult to debug.
  2383. mergerfs, while being just a proxy of sorts, is also very difficult to
  2384. debug given the large number of possible settings it can have itself and
  2385. the massive number of environments it can run in.
  2386. When reporting on a suspected issue \f[B]please, please\f[] include as
  2387. much of the below information as possible otherwise it will be difficult
  2388. or impossible to diagnose.
  2389. Also please make sure to read all of the above documentation as it
  2390. includes nearly every known system or user issue previously encountered.
  2391. .PP
  2392. \f[B]Please make sure you are using the latest
  2393. release (https://github.com/trapexit/mergerfs/releases) or have tried it
  2394. in comparison. Old versions, which are often included in distros like
  2395. Debian and Ubuntu, are not ever going to be updated and your bug may
  2396. have been addressed already.\f[]
  2397. .SS Information to include in bug reports
  2398. .IP \[bu] 2
  2399. Version of mergerfs: \f[C]mergerfs\ \-V\f[]
  2400. .IP \[bu] 2
  2401. mergerfs settings: from \f[C]/etc/fstab\f[] or command line execution
  2402. .IP \[bu] 2
  2403. Version of Linux: \f[C]uname\ \-a\f[]
  2404. .IP \[bu] 2
  2405. Versions of any additional software being used
  2406. .IP \[bu] 2
  2407. List of drives, their filesystems, and sizes (before and after issue):
  2408. \f[C]df\ \-h\f[]
  2409. .IP \[bu] 2
  2410. \f[B]All\f[] information about the relevant branches and paths:
  2411. permissions, etc.
  2412. .IP \[bu] 2
  2413. A \f[C]strace\f[] of the app having problems:
  2414. .IP \[bu] 2
  2415. \f[C]strace\ \-f\ \-o\ /tmp/app.strace.txt\ <cmd>\f[]
  2416. .IP \[bu] 2
  2417. A \f[C]strace\f[] of mergerfs while the program is trying to do whatever
  2418. it\[aq]s failing to do:
  2419. .IP \[bu] 2
  2420. \f[C]strace\ \-f\ \-p\ <mergerfsPID>\ \-o\ /tmp/mergerfs.strace.txt\f[]
  2421. .IP \[bu] 2
  2422. \f[B]Precise\f[] directions on replicating the issue.
  2423. Do not leave \f[B]anything\f[] out.
  2424. .IP \[bu] 2
  2425. Try to recreate the problem in the simplist way using standard programs.
  2426. .SS Contact / Issue submission
  2427. .IP \[bu] 2
  2428. github.com: https://github.com/trapexit/mergerfs/issues
  2429. .IP \[bu] 2
  2430. email: trapexit\@spawn.link
  2431. .IP \[bu] 2
  2432. twitter: https://twitter.com/_trapexit
  2433. .IP \[bu] 2
  2434. reddit: https://www.reddit.com/user/trapexit
  2435. .IP \[bu] 2
  2436. discord: https://discord.gg/MpAr69V
  2437. .SS Support development
  2438. .PP
  2439. This software is free to use and released under a very liberal license.
  2440. That said if you like this software and would like to support its
  2441. development donations are welcome.
  2442. .IP \[bu] 2
  2443. PayPal: https://paypal.me/trapexit
  2444. .IP \[bu] 2
  2445. GitHub Sponsors: https://github.com/sponsors/trapexit
  2446. .IP \[bu] 2
  2447. Patreon: https://www.patreon.com/trapexit
  2448. .IP \[bu] 2
  2449. SubscribeStar: https://www.subscribestar.com/trapexit
  2450. .IP \[bu] 2
  2451. Ko\-Fi: https://ko\-fi.com/trapexit
  2452. .IP \[bu] 2
  2453. Bitcoin (BTC): 12CdMhEPQVmjz3SSynkAEuD5q9JmhTDCZA
  2454. .IP \[bu] 2
  2455. Bitcoin Cash (BCH): 1AjPqZZhu7GVEs6JFPjHmtsvmDL4euzMzp
  2456. .IP \[bu] 2
  2457. Ethereum (ETH): 0x09A166B11fCC127324C7fc5f1B572255b3046E94
  2458. .IP \[bu] 2
  2459. Litecoin (LTC): LXAsq6yc6zYU3EbcqyWtHBrH1Ypx4GjUjm
  2460. .IP \[bu] 2
  2461. ZCoin (XZC): a8L5Vz35KdCQe7Y7urK2pcCGau7JsqZ5Gw
  2462. .SH LINKS
  2463. .IP \[bu] 2
  2464. https://spawn.link
  2465. .IP \[bu] 2
  2466. https://github.com/trapexit/mergerfs
  2467. .IP \[bu] 2
  2468. https://github.com/trapexit/mergerfs\-tools
  2469. .IP \[bu] 2
  2470. https://github.com/trapexit/scorch
  2471. .IP \[bu] 2
  2472. https://github.com/trapexit/bbf
  2473. .IP \[bu] 2
  2474. https://github.com/trapexit/backup\-and\-recovery\-howtos
  2475. .SH AUTHORS
  2476. Antonio SJ Musumeci <trapexit@spawn.link>.