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.

2394 lines
92 KiB

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