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.

1099 lines
40 KiB

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
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
9 years ago
9 years ago
9 years ago
  1. .\"t
  2. .TH "mergerfs" "1" "2017\-02\-18" "mergerfs user manual" ""
  3. .SH NAME
  4. .PP
  5. mergerfs \- another (FUSE based) union filesystem
  6. .SH SYNOPSIS
  7. .PP
  8. mergerfs \-o<options> <srcmounts> <mountpoint>
  9. .SH DESCRIPTION
  10. .PP
  11. \f[B]mergerfs\f[] is a union filesystem geared towards simplifying
  12. storage and management of files across numerous commodity storage
  13. devices.
  14. It is similar to \f[B]mhddfs\f[], \f[B]unionfs\f[], and \f[B]aufs\f[].
  15. .SH FEATURES
  16. .IP \[bu] 2
  17. Runs in userspace (FUSE)
  18. .IP \[bu] 2
  19. Configurable behaviors
  20. .IP \[bu] 2
  21. Support for extended attributes (xattrs)
  22. .IP \[bu] 2
  23. Support for file attributes (chattr)
  24. .IP \[bu] 2
  25. Runtime configurable (via xattrs)
  26. .IP \[bu] 2
  27. Safe to run as root
  28. .IP \[bu] 2
  29. Opportunistic credential caching
  30. .IP \[bu] 2
  31. Works with heterogeneous filesystem types
  32. .IP \[bu] 2
  33. Handling of writes to full drives (transparently move file to drive with
  34. capacity)
  35. .IP \[bu] 2
  36. Handles pool of readonly and read/write drives
  37. .SH OPTIONS
  38. .SS options
  39. .IP \[bu] 2
  40. \f[B]defaults\f[]: a shortcut for FUSE\[aq]s \f[B]atomic_o_trunc\f[],
  41. \f[B]auto_cache\f[], \f[B]big_writes\f[], \f[B]default_permissions\f[],
  42. \f[B]splice_move\f[], \f[B]splice_read\f[], and \f[B]splice_write\f[].
  43. These options seem to provide the best performance.
  44. .IP \[bu] 2
  45. \f[B]direct_io\f[]: causes FUSE to bypass caching which can increase
  46. write speeds at the detriment of reads.
  47. Note that not enabling \f[C]direct_io\f[] will cause double caching of
  48. files and therefore less memory for caching generally.
  49. However, \f[C]mmap\f[] does not work when \f[C]direct_io\f[] is enabled.
  50. .IP \[bu] 2
  51. \f[B]minfreespace\f[]: the minimum space value used for creation
  52. policies.
  53. Understands \[aq]K\[aq], \[aq]M\[aq], and \[aq]G\[aq] to represent
  54. kilobyte, megabyte, and gigabyte respectively.
  55. (default: 4G)
  56. .IP \[bu] 2
  57. \f[B]moveonenospc\f[]: when enabled (set to \f[B]true\f[]) if a
  58. \f[B]write\f[] fails with \f[B]ENOSPC\f[] or \f[B]EDQUOT\f[] a scan of
  59. all drives will be done looking for the drive with most free space which
  60. is at least the size of the file plus the amount which failed to write.
  61. An attempt to move the file to that drive will occur (keeping all
  62. metadata possible) and if successful the original is unlinked and the
  63. write retried.
  64. (default: false)
  65. .IP \[bu] 2
  66. \f[B]use_ino\f[]: causes mergerfs to supply file/directory inodes rather
  67. than libfuse.
  68. While not a default it is generally recommended it be enabled so that
  69. hard linked files share the same inode value.
  70. .IP \[bu] 2
  71. \f[B]dropcacheonclose\f[]: when a file is requested to be closed call
  72. \f[C]posix_fadvise\f[] on it first to instruct the kernel that we no
  73. longer need the data and it can drop its cache.
  74. Recommended when \f[B]direct_io\f[] is not enabled to limit double
  75. caching.
  76. (default: false)
  77. .IP \[bu] 2
  78. \f[B]fsname\f[]: sets the name of the filesystem as seen in
  79. \f[B]mount\f[], \f[B]df\f[], etc.
  80. Defaults to a list of the source paths concatenated together with the
  81. longest common prefix removed.
  82. .IP \[bu] 2
  83. \f[B]func.<func>=<policy>\f[]: sets the specific FUSE function\[aq]s
  84. policy.
  85. See below for the list of value types.
  86. Example: \f[B]func.getattr=newest\f[]
  87. .IP \[bu] 2
  88. \f[B]category.<category>=<policy>\f[]: Sets policy of all FUSE functions
  89. in the provided category.
  90. Example: \f[B]category.create=mfs\f[]
  91. .PP
  92. \f[B]NOTE:\f[] Options are evaluated in the order listed so if the
  93. options are \f[B]func.rmdir=rand,category.action=ff\f[] the
  94. \f[B]action\f[] category setting will override the \f[B]rmdir\f[]
  95. setting.
  96. .SS srcmounts
  97. .PP
  98. The srcmounts (source mounts) argument is a colon (\[aq]:\[aq])
  99. delimited list of paths to be included in the pool.
  100. It does not matter if the paths are on the same or different drives nor
  101. does it matter the filesystem.
  102. Used and available space will not be duplicated for paths on the same
  103. device and any features which aren\[aq]t supported by the underlying
  104. filesystem (such as file attributes or extended attributes) will return
  105. the appropriate errors.
  106. .PP
  107. To make it easier to include multiple source mounts mergerfs supports
  108. globbing (http://linux.die.net/man/7/glob).
  109. \f[B]The globbing tokens MUST be escaped when using via the shell else
  110. the shell itself will expand it.\f[]
  111. .IP
  112. .nf
  113. \f[C]
  114. $\ mergerfs\ \-o\ defaults,allow_other,use_ino\ /mnt/disk\\*:/mnt/cdrom\ /media/drives
  115. \f[]
  116. .fi
  117. .PP
  118. The above line will use all mount points in /mnt prefixed with
  119. \f[B]disk\f[] and the \f[B]cdrom\f[].
  120. .PP
  121. To have the pool mounted at boot or otherwise accessable from related
  122. tools use \f[B]/etc/fstab\f[].
  123. .IP
  124. .nf
  125. \f[C]
  126. #\ <file\ system>\ \ \ \ \ \ \ \ <mount\ point>\ \ <type>\ \ \ \ \ \ \ \ \ <options>\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <dump>\ \ <pass>
  127. /mnt/disk*:/mnt/cdrom\ \ /media/drives\ \ fuse.mergerfs\ \ defaults,allow_other,use_ino\ \ 0\ \ \ \ \ \ \ 0
  128. \f[]
  129. .fi
  130. .PP
  131. \f[B]NOTE:\f[] the globbing is done at mount or xattr update time (see
  132. below).
  133. If a new directory is added matching the glob after the fact it will not
  134. be automatically included.
  135. .PP
  136. \f[B]NOTE:\f[] for mounting via \f[B]fstab\f[] to work you must have
  137. \f[B]mount.fuse\f[] installed.
  138. For Ubuntu/Debian it is included in the \f[B]fuse\f[] package.
  139. .SH FUNCTIONS / POLICIES / CATEGORIES
  140. .PP
  141. The POSIX filesystem API has a number of functions.
  142. \f[B]creat\f[], \f[B]stat\f[], \f[B]chown\f[], etc.
  143. In mergerfs these functions are grouped into 3 categories:
  144. \f[B]action\f[], \f[B]create\f[], and \f[B]search\f[].
  145. Functions and categories can be assigned a policy which dictates how
  146. \f[B]mergerfs\f[] behaves.
  147. Any policy can be assigned to a function or category though some are not
  148. very practical.
  149. For instance: \f[B]rand\f[] (random) may be useful for file creation
  150. (create) but could lead to very odd behavior if used for \f[C]chmod\f[]
  151. (though only if there were more than one copy of the file).
  152. .PP
  153. Policies, when called to create, will ignore drives which are readonly
  154. or have less than \f[B]minfreespace\f[].
  155. This allows for read/write and readonly drives to be mixed together and
  156. keep drives which may remount as readonly on error from further
  157. affecting the pool.
  158. .SS Function / Category classifications
  159. .PP
  160. .TS
  161. tab(@);
  162. l l.
  163. T{
  164. Category
  165. T}@T{
  166. FUSE Functions
  167. T}
  168. _
  169. T{
  170. action
  171. T}@T{
  172. chmod, chown, link, removexattr, rename, rmdir, setxattr, truncate,
  173. unlink, utimens
  174. T}
  175. T{
  176. create
  177. T}@T{
  178. create, mkdir, mknod, symlink
  179. T}
  180. T{
  181. search
  182. T}@T{
  183. access, getattr, getxattr, ioctl, listxattr, open, readlink
  184. T}
  185. T{
  186. N/A
  187. T}@T{
  188. fallocate, fgetattr, fsync, ftruncate, ioctl, read, readdir, release,
  189. statfs, write
  190. T}
  191. .TE
  192. .PP
  193. Due to FUSE limitations \f[B]ioctl\f[] behaves differently if its acting
  194. on a directory.
  195. It\[aq]ll use the \f[B]getattr\f[] policy to find and open the directory
  196. before issuing the \f[B]ioctl\f[].
  197. In other cases where something may be searched (to confirm a directory
  198. exists across all source mounts) \f[B]getattr\f[] will also be used.
  199. .SS Policy descriptions
  200. .PP
  201. .TS
  202. tab(@);
  203. l l.
  204. T{
  205. Policy
  206. T}@T{
  207. Description
  208. T}
  209. _
  210. T{
  211. all
  212. T}@T{
  213. Search category: acts like \f[B]ff\f[].
  214. Action category: apply to all found.
  215. Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and
  216. \f[B]symlink\f[] it will apply to all found.
  217. \f[B]create\f[] works like \f[B]ff\f[].
  218. It will exclude readonly drives and those with free space less than
  219. \f[B]minfreespace\f[].
  220. T}
  221. T{
  222. epall (existing path, all)
  223. T}@T{
  224. Search category: acts like \f[B]epff\f[].
  225. Action category: apply to all found.
  226. Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and
  227. \f[B]symlink\f[] it will apply to all existing paths found.
  228. \f[B]create\f[] works like \f[B]epff\f[].
  229. It will exclude readonly drives and those with free space less than
  230. \f[B]minfreespace\f[].
  231. T}
  232. T{
  233. epff
  234. T}@T{
  235. Given the order of the drives, as defined at mount time or when
  236. configured via the xattr interface, act on the first one found where the
  237. path already exists.
  238. For \f[B]create\f[] category it will exclude readonly drives and those
  239. with free space less than \f[B]minfreespace\f[] (unless there is no
  240. other option).
  241. Falls back to \f[B]ff\f[].
  242. T}
  243. T{
  244. eplfs (existing path, least free space)
  245. T}@T{
  246. If the path exists on multiple drives use the one with the least free
  247. space.
  248. For \f[B]create\f[] category it will exclude readonly drives and those
  249. with free space less than \f[B]minfreespace\f[].
  250. Falls back to \f[B]lfs\f[].
  251. T}
  252. T{
  253. eplus (existing path, least used space)
  254. T}@T{
  255. If the path exists on multiple drives use the one with the least used
  256. space.
  257. For \f[B]create\f[] category it will exclude readonly drives and those
  258. with free space less than \f[B]minfreespace\f[].
  259. Falls back to \f[B]lus\f[].
  260. T}
  261. T{
  262. epmfs (existing path, most free space)
  263. T}@T{
  264. If the path exists on multiple drives use the one with the most free
  265. space.
  266. For \f[B]create\f[] category it will exclude readonly drives and those
  267. with free space less than \f[B]minfreespace\f[].
  268. Falls back to \f[B]mfs\f[].
  269. T}
  270. T{
  271. eprand (existing path, random)
  272. T}@T{
  273. Calls \f[B]epall\f[] and then randomizes.
  274. T}
  275. T{
  276. erofs
  277. T}@T{
  278. Exclusively return \f[B]\-1\f[] with \f[B]errno\f[] set to
  279. \f[B]EROFS\f[].
  280. By setting \f[B]create\f[] functions to this you can in effect turn the
  281. filesystem readonly.
  282. T}
  283. T{
  284. ff (first found)
  285. T}@T{
  286. Given the order of the drives, as defined at mount time or when
  287. configured via xattr interface, act on the first one found.
  288. For \f[B]create\f[] category it will exclude readonly drives and those
  289. with free space less than \f[B]minfreespace\f[] (unless there is no
  290. other option).
  291. T}
  292. T{
  293. lfs (least free space)
  294. T}@T{
  295. Pick the drive with the least available free space.
  296. For \f[B]create\f[] category it will exclude readonly drives and those
  297. with free space less than \f[B]minfreespace\f[].
  298. Falls back to \f[B]mfs\f[].
  299. T}
  300. T{
  301. lus (least used space)
  302. T}@T{
  303. Pick the drive with the least used space.
  304. For \f[B]create\f[] category it will exclude readonly drives and those
  305. with free space less than \f[B]minfreespace\f[].
  306. Falls back to \f[B]mfs\f[].
  307. T}
  308. T{
  309. mfs (most free space)
  310. T}@T{
  311. Pick the drive with the most available free space.
  312. For \f[B]create\f[] category it will exclude readonly drives.
  313. Falls back to \f[B]ff\f[].
  314. T}
  315. T{
  316. newest (newest file)
  317. T}@T{
  318. Pick the file / directory with the largest mtime.
  319. For \f[B]create\f[] category it will exclude readonly drives and those
  320. with free space less than \f[B]minfreespace\f[] (unless there is no
  321. other option).
  322. T}
  323. T{
  324. rand (random)
  325. T}@T{
  326. Calls \f[B]all\f[] and then randomizes.
  327. T}
  328. .TE
  329. .PP
  330. \f[B]epff\f[], \f[B]eplfs\f[], \f[B]eplus\f[], and \f[B]epmf\f[] are
  331. path preserving policies.
  332. As the descriptions above explain they will only consider drives where
  333. the path being accessed exists.
  334. Non\-path preserving policies will clone paths as necessary.
  335. .SS Defaults
  336. .PP
  337. .TS
  338. tab(@);
  339. l l.
  340. T{
  341. Category
  342. T}@T{
  343. Policy
  344. T}
  345. _
  346. T{
  347. action
  348. T}@T{
  349. all
  350. T}
  351. T{
  352. create
  353. T}@T{
  354. epmfs
  355. T}
  356. T{
  357. search
  358. T}@T{
  359. ff
  360. T}
  361. .TE
  362. .SS rename & link
  363. .PP
  364. rename (http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky
  365. function in a merged system.
  366. Normally if a rename can\[aq]t be done atomically due to the source and
  367. destination paths existing on different mount points it will return
  368. \f[B]\-1\f[] with \f[B]errno = EXDEV\f[].
  369. The atomic rename is most critical for replacing files in place
  370. atomically (such as securing writing to a temp file and then replacing a
  371. target).
  372. The problem is that by merging multiple paths you can have N instances
  373. of the source and destinations on different drives.
  374. This can lead to several undesirable situtations with or without errors
  375. and it\[aq]s not entirely obvious what to do when an error occurs.
  376. .PP
  377. Originally mergerfs would return EXDEV whenever a rename was requested
  378. which was cross directory in any way.
  379. This made the code simple and was technically complient with POSIX
  380. requirements.
  381. However, many applications fail to handle EXDEV at all and treat it as a
  382. normal error or they only partially support EXDEV (don\[aq]t respond the
  383. same as \f[C]mv\f[] would).
  384. Such apps include: gvfsd\-fuse v1.20.3 and prior, Finder / CIFS/SMB
  385. client in Apple OSX 10.9+, NZBGet, Samba\[aq]s recycling bin feature.
  386. .IP \[bu] 2
  387. If using a \f[B]create\f[] policy which tries to preserve directory
  388. paths (epff,eplfs,eplus,epmfs)
  389. .IP \[bu] 2
  390. Using the \f[B]rename\f[] policy get the list of files to rename
  391. .IP \[bu] 2
  392. For each file attempt rename:
  393. .RS 2
  394. .IP \[bu] 2
  395. If failure with ENOENT run \f[B]create\f[] policy
  396. .IP \[bu] 2
  397. If create policy returns the same drive as currently evaluating then
  398. clone the path
  399. .IP \[bu] 2
  400. Re\-attempt rename
  401. .RE
  402. .IP \[bu] 2
  403. If \f[B]any\f[] of the renames succeed the higher level rename is
  404. considered a success
  405. .IP \[bu] 2
  406. If \f[B]no\f[] renames succeed the first error encountered will be
  407. returned
  408. .IP \[bu] 2
  409. On success:
  410. .RS 2
  411. .IP \[bu] 2
  412. Remove the target from all drives with no source file
  413. .IP \[bu] 2
  414. Remove the source from all drives which failed to rename
  415. .RE
  416. .IP \[bu] 2
  417. If using a \f[B]create\f[] policy which does \f[B]not\f[] try to
  418. preserve directory paths
  419. .IP \[bu] 2
  420. Using the \f[B]rename\f[] policy get the list of files to rename
  421. .IP \[bu] 2
  422. Using the \f[B]getattr\f[] policy get the target path
  423. .IP \[bu] 2
  424. For each file attempt rename:
  425. .RS 2
  426. .IP \[bu] 2
  427. If the source drive != target drive:
  428. .IP \[bu] 2
  429. Clone target path from target drive to source drive
  430. .IP \[bu] 2
  431. Rename
  432. .RE
  433. .IP \[bu] 2
  434. If \f[B]any\f[] of the renames succeed the higher level rename is
  435. considered a success
  436. .IP \[bu] 2
  437. If \f[B]no\f[] renames succeed the first error encountered will be
  438. returned
  439. .IP \[bu] 2
  440. On success:
  441. .RS 2
  442. .IP \[bu] 2
  443. Remove the target from all drives with no source file
  444. .IP \[bu] 2
  445. Remove the source from all drives which failed to rename
  446. .RE
  447. .PP
  448. The the removals are subject to normal entitlement checks.
  449. .PP
  450. The above behavior will help minimize the likelihood of EXDEV being
  451. returned but it will still be possible.
  452. To remove the possibility all together mergerfs would need to perform
  453. the as \f[B]mv\f[] does when it receives EXDEV normally.
  454. .PP
  455. \f[B]link\f[] uses the same basic strategy.
  456. .SS readdir
  457. .PP
  458. readdir (http://linux.die.net/man/3/readdir) is different from all other
  459. filesystem functions.
  460. While it could have it\[aq]s own set of policies to tweak its behavior
  461. at this time it provides a simple union of files and directories found.
  462. Remember that any action or information queried about these files and
  463. directories come from the respective function.
  464. For instance: an \f[B]ls\f[] is a \f[B]readdir\f[] and for each
  465. file/directory returned \f[B]getattr\f[] is called.
  466. Meaning the policy of \f[B]getattr\f[] is responsible for choosing the
  467. file/directory which is the source of the metadata you see in an
  468. \f[B]ls\f[].
  469. .SS statvfs
  470. .PP
  471. statvfs (http://linux.die.net/man/2/statvfs) normalizes the source
  472. drives based on the fragment size and sums the number of adjusted blocks
  473. and inodes.
  474. This means you will see the combined space of all sources.
  475. Total, used, and free.
  476. The sources however are dedupped based on the drive so multiple sources
  477. on the same drive will not result in double counting it\[aq]s space.
  478. .SH BUILDING
  479. .PP
  480. \f[B]NOTE:\f[] Prebuilt packages can be found at:
  481. https://github.com/trapexit/mergerfs/releases
  482. .PP
  483. First get the code from github (http://github.com/trapexit/mergerfs).
  484. .IP
  485. .nf
  486. \f[C]
  487. $\ git\ clone\ https://github.com/trapexit/mergerfs.git
  488. $\ #\ or
  489. $\ wget\ https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs\-<ver>.tar.gz
  490. \f[]
  491. .fi
  492. .SS Debian / Ubuntu
  493. .IP
  494. .nf
  495. \f[C]
  496. $\ sudo\ apt\-get\ install\ g++\ pkg\-config\ git\ git\-buildpackage\ pandoc\ debhelper\ libfuse\-dev\ libattr1\-dev\ python
  497. $\ cd\ mergerfs
  498. $\ make\ deb
  499. $\ sudo\ dpkg\ \-i\ ../mergerfs_version_arch.deb
  500. \f[]
  501. .fi
  502. .SS Fedora
  503. .IP
  504. .nf
  505. \f[C]
  506. $\ su\ \-
  507. #\ dnf\ install\ rpm\-build\ fuse\-devel\ libattr\-devel\ pandoc\ gcc\-c++\ git\ make\ which\ python
  508. #\ cd\ mergerfs
  509. #\ make\ rpm
  510. #\ rpm\ \-i\ rpmbuild/RPMS/<arch>/mergerfs\-<verion>.<arch>.rpm
  511. \f[]
  512. .fi
  513. .SS Generically
  514. .PP
  515. Have git, python, pkg\-config, pandoc, libfuse, libattr1 installed.
  516. .IP
  517. .nf
  518. \f[C]
  519. $\ cd\ mergerfs
  520. $\ make
  521. $\ make\ man
  522. $\ sudo\ make\ install
  523. \f[]
  524. .fi
  525. .SH RUNTIME
  526. .SS \&.mergerfs pseudo file
  527. .IP
  528. .nf
  529. \f[C]
  530. <mountpoint>/.mergerfs
  531. \f[]
  532. .fi
  533. .PP
  534. There is a pseudo file available at the mount point which allows for the
  535. runtime modification of certain \f[B]mergerfs\f[] options.
  536. The file will not show up in \f[B]readdir\f[] but can be
  537. \f[B]stat\f[]\[aq]ed and manipulated via
  538. {list,get,set}xattrs (http://linux.die.net/man/2/listxattr) calls.
  539. .PP
  540. Even if xattrs are disabled for mergerfs the
  541. {list,get,set}xattrs (http://linux.die.net/man/2/listxattr) calls
  542. against this pseudo file will still work.
  543. .PP
  544. Any changes made at runtime are \f[B]not\f[] persisted.
  545. If you wish for values to persist they must be included as options
  546. wherever you configure the mounting of mergerfs (fstab).
  547. .SS Keys
  548. .PP
  549. Use \f[C]xattr\ \-l\ /mount/point/.mergerfs\f[] to see all supported
  550. keys.
  551. Some are informational and therefore readonly.
  552. .SS user.mergerfs.srcmounts
  553. .PP
  554. Used to query or modify the list of source mounts.
  555. When modifying there are several shortcuts to easy manipulation of the
  556. list.
  557. .PP
  558. .TS
  559. tab(@);
  560. l l.
  561. T{
  562. Value
  563. T}@T{
  564. Description
  565. T}
  566. _
  567. T{
  568. [list]
  569. T}@T{
  570. set
  571. T}
  572. T{
  573. +<[list]
  574. T}@T{
  575. prepend
  576. T}
  577. T{
  578. +>[list]
  579. T}@T{
  580. append
  581. T}
  582. T{
  583. \-[list]
  584. T}@T{
  585. remove all values provided
  586. T}
  587. T{
  588. \-<
  589. T}@T{
  590. remove first in list
  591. T}
  592. T{
  593. \->
  594. T}@T{
  595. remove last in list
  596. T}
  597. .TE
  598. .SS minfreespace
  599. .PP
  600. Input: interger with an optional multiplier suffix.
  601. \f[B]K\f[], \f[B]M\f[], or \f[B]G\f[].
  602. .PP
  603. Output: value in bytes
  604. .SS moveonenospc
  605. .PP
  606. Input: \f[B]true\f[] and \f[B]false\f[]
  607. .PP
  608. Ouput: \f[B]true\f[] or \f[B]false\f[]
  609. .SS categories / funcs
  610. .PP
  611. Input: short policy string as described elsewhere in this document
  612. .PP
  613. Output: the policy string except for categories where its funcs have
  614. multiple types.
  615. In that case it will be a comma separated list
  616. .SS Example
  617. .IP
  618. .nf
  619. \f[C]
  620. [trapexit:/tmp/mount]\ $\ xattr\ \-l\ .mergerfs
  621. user.mergerfs.srcmounts:\ /tmp/a:/tmp/b
  622. user.mergerfs.minfreespace:\ 4294967295
  623. user.mergerfs.moveonenospc:\ false
  624. \&...
  625. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.category.search\ .mergerfs
  626. ff
  627. [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.category.search\ newest\ .mergerfs
  628. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.category.search\ .mergerfs
  629. newest
  630. [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.srcmounts\ +/tmp/c\ .mergerfs
  631. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.srcmounts\ .mergerfs
  632. /tmp/a:/tmp/b:/tmp/c
  633. [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.srcmounts\ =/tmp/c\ .mergerfs
  634. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.srcmounts\ .mergerfs
  635. /tmp/c
  636. [trapexit:/tmp/mount]\ $\ xattr\ \-w\ user.mergerfs.srcmounts\ \[aq]+</tmp/a:/tmp/b\[aq]\ .mergerfs
  637. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.srcmounts\ .mergerfs
  638. /tmp/a:/tmp/b:/tmp/c
  639. \f[]
  640. .fi
  641. .SS file / directory xattrs
  642. .PP
  643. While they won\[aq]t show up when using
  644. listxattr (http://linux.die.net/man/2/listxattr) \f[B]mergerfs\f[]
  645. offers a number of special xattrs to query information about the files
  646. served.
  647. To access the values you will need to issue a
  648. getxattr (http://linux.die.net/man/2/getxattr) for one of the following:
  649. .IP \[bu] 2
  650. \f[B]user.mergerfs.basepath:\f[] the base mount point for the file given
  651. the current getattr policy
  652. .IP \[bu] 2
  653. \f[B]user.mergerfs.relpath:\f[] the relative path of the file from the
  654. perspective of the mount point
  655. .IP \[bu] 2
  656. \f[B]user.mergerfs.fullpath:\f[] the full path of the original file
  657. given the getattr policy
  658. .IP \[bu] 2
  659. \f[B]user.mergerfs.allpaths:\f[] a NUL (\[aq]\[aq]) separated list of
  660. full paths to all files found
  661. .IP
  662. .nf
  663. \f[C]
  664. [trapexit:/tmp/mount]\ $\ ls
  665. A\ B\ C
  666. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.fullpath\ A
  667. /mnt/a/full/path/to/A
  668. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.basepath\ A
  669. /mnt/a
  670. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.relpath\ A
  671. /full/path/to/A
  672. [trapexit:/tmp/mount]\ $\ xattr\ \-p\ user.mergerfs.allpaths\ A\ |\ tr\ \[aq]\\0\[aq]\ \[aq]\\n\[aq]
  673. /mnt/a/full/path/to/A
  674. /mnt/b/full/path/to/A
  675. \f[]
  676. .fi
  677. .SH TOOLING
  678. .IP \[bu] 2
  679. https://github.com/trapexit/mergerfs\-tools
  680. .IP \[bu] 2
  681. mergerfs.ctl: A tool to make it easier to query and configure mergerfs
  682. at runtime
  683. .IP \[bu] 2
  684. mergerfs.fsck: Provides permissions and ownership auditing and the
  685. ability to fix them
  686. .IP \[bu] 2
  687. mergerfs.dedup: Will help identify and optionally remove duplicate files
  688. .IP \[bu] 2
  689. mergerfs.mktrash: Creates FreeDesktop.org Trash specification compatible
  690. directories on a mergerfs mount
  691. .IP \[bu] 2
  692. https://github.com/trapexit/scorch
  693. .IP \[bu] 2
  694. scorch: A tool to help discover silent corruption of files
  695. .SH TIPS / NOTES
  696. .IP \[bu] 2
  697. The recommended options are
  698. \f[B]defaults,allow_other,direct_io,use_ino\f[].
  699. .IP \[bu] 2
  700. Run mergerfs as \f[C]root\f[] unless you\[aq]re merging paths which are
  701. owned by the same user otherwise strange permission issues may arise.
  702. .IP \[bu] 2
  703. https://github.com/trapexit/backup\-and\-recovery\-howtos : A set of
  704. guides / howtos on creating a data storage system, backing it up,
  705. maintaining it, and recovering from failure.
  706. .IP \[bu] 2
  707. If you don\[aq]t see some directories / files you expect in a merged
  708. point be sure the user has permission to all the underlying directories.
  709. Use \f[C]mergerfs.fsck\f[] to audit the drive for out of sync
  710. permissions.
  711. .IP \[bu] 2
  712. Do \f[I]not\f[] use \f[C]direct_io\f[] if you expect applications (such
  713. as rtorrent) to mmap (http://linux.die.net/man/2/mmap) files.
  714. It is not currently supported in FUSE w/ \f[C]direct_io\f[] enabled.
  715. .IP \[bu] 2
  716. Since POSIX gives you only error or success on calls its difficult to
  717. determine the proper behavior when applying the behavior to multiple
  718. targets.
  719. \f[B]mergerfs\f[] will return an error only if all attempts of an action
  720. fail.
  721. Any success will lead to a success returned.
  722. This means however that some odd situations may arise.
  723. .IP \[bu] 2
  724. Kodi (http://kodi.tv), Plex (http://plex.tv),
  725. Subsonic (http://subsonic.org), etc.
  726. can use directory mtime (http://linux.die.net/man/2/stat) to more
  727. efficiently determine whether to scan for new content rather than simply
  728. performing a full scan.
  729. If using the default \f[B]getattr\f[] policy of \f[B]ff\f[] its possible
  730. \f[B]Kodi\f[] will miss an update on account of it returning the first
  731. directory found\[aq]s \f[B]stat\f[] info and its a later directory on
  732. another mount which had the \f[B]mtime\f[] recently updated.
  733. To fix this you will want to set \f[B]func.getattr=newest\f[].
  734. Remember though that this is just \f[B]stat\f[].
  735. If the file is later \f[B]open\f[]\[aq]ed or \f[B]unlink\f[]\[aq]ed and
  736. the policy is different for those then a completely different file or
  737. directory could be acted on.
  738. .IP \[bu] 2
  739. Some policies mixed with some functions may result in strange behaviors.
  740. Not that some of these behaviors and race conditions couldn\[aq]t happen
  741. outside \f[B]mergerfs\f[] but that they are far more likely to occur on
  742. account of attempt to merge together multiple sources of data which
  743. could be out of sync due to the different policies.
  744. .IP \[bu] 2
  745. For consistency its generally best to set \f[B]category\f[] wide
  746. policies rather than individual \f[B]func\f[]\[aq]s.
  747. This will help limit the confusion of tools such as
  748. rsync (http://linux.die.net/man/1/rsync).
  749. However, the flexibility is there if needed.
  750. .SH KNOWN ISSUES / BUGS
  751. .SS directory mtime is not being updated
  752. .PP
  753. Remember that the default policy for \f[C]getattr\f[] is \f[C]ff\f[].
  754. The information for the first directory found will be returned.
  755. If it wasn\[aq]t the directory which had been updated then it will
  756. appear outdated.
  757. .PP
  758. The reason this is the default is because any other policy would be far
  759. more expensive and for many applications it is unnecessary.
  760. To always return the directory with the most recent mtime or a faked
  761. value based on all found would require a scan of all drives.
  762. That alone is far more expensive than \f[C]ff\f[] but would also
  763. possibly spin up sleeping drives.
  764. .PP
  765. If you always want the directory information from the one with the most
  766. recent mtime then use the \f[C]newest\f[] policy for \f[C]getattr\f[].
  767. .SS cached memory appears greater than it should be
  768. .PP
  769. Use the \f[C]direct_io\f[] option as described above.
  770. Due to what mergerfs is doing there ends up being two caches of a file
  771. under normal usage.
  772. One from the underlying filesystem and one from mergerfs.
  773. Enabling \f[C]direct_io\f[] removes the mergerfs cache.
  774. This saves on memory but means the kernel needs to communicate with
  775. mergerfs more often and can therefore result in slower speeds.
  776. .PP
  777. Since enabling \f[C]direct_io\f[] disables \f[C]mmap\f[] this is not an
  778. ideal situation however write speeds should be increased.
  779. .PP
  780. If \f[C]direct_io\f[] is disabled it is probably a good idea to enable
  781. \f[C]dropcacheonclose\f[] to minimize double caching.
  782. .SS NFS clients don\[aq]t work
  783. .PP
  784. Some NFS clients appear to fail when a mergerfs mount is exported.
  785. Kodi in particular seems to have issues.
  786. .PP
  787. Try enabling the \f[C]use_ino\f[] option.
  788. Some have reported that it fixes the issue.
  789. .SS rtorrent fails with ENODEV (No such device)
  790. .PP
  791. Be sure to turn off \f[C]direct_io\f[].
  792. rtorrent and some other applications use
  793. mmap (http://linux.die.net/man/2/mmap) to read and write to files and
  794. offer no failback to traditional methods.
  795. FUSE does not currently support mmap while using \f[C]direct_io\f[].
  796. There will be a performance penalty on writes with \f[C]direct_io\f[]
  797. off as well as the problem of double caching but it\[aq]s the only way
  798. to get such applications to work.
  799. If the performance loss is too high for other apps you can mount
  800. mergerfs twice.
  801. Once with \f[C]direct_io\f[] enabled and one without it.
  802. .SS mmap performance is really bad
  803. .PP
  804. There is a bug (https://lkml.org/lkml/2016/3/16/260) in caching which
  805. affects overall performance of mmap through FUSE in Linux 4.x kernels.
  806. It is fixed in 4.4.10 and 4.5.4 (https://lkml.org/lkml/2016/5/11/59).
  807. .SS Trashing files occasionally fails
  808. .PP
  809. This is the same issue as with Samba.
  810. \f[C]rename\f[] returns \f[C]EXDEV\f[] (in our case that will really
  811. only happen with path preserving policies like \f[C]epmfs\f[]) and the
  812. software doesn\[aq]t handle the situtation well.
  813. This is unfortunately a common failure of software which moves files
  814. around.
  815. The standard indicates that an implementation \f[C]MAY\f[] choose to
  816. support non\-user home directory trashing of files (which is a
  817. \f[C]MUST\f[]).
  818. The implementation \f[C]MAY\f[] also support "top directory trashes"
  819. which many probably do.
  820. .PP
  821. To create a \f[C]$topdir/.Trash\f[] directory as defined in the standard
  822. use the mergerfs\-tools (https://github.com/trapexit/mergerfs-tools)
  823. tool \f[C]mergerfs.mktrash\f[].
  824. .SS Samba: Moving files / directories fails
  825. .PP
  826. Workaround: Copy the file/directory and then remove the original rather
  827. than move.
  828. .PP
  829. This isn\[aq]t an issue with Samba but some SMB clients.
  830. GVFS\-fuse v1.20.3 and prior (found in Ubuntu 14.04 among others) failed
  831. to handle certain error codes correctly.
  832. Particularly \f[B]STATUS_NOT_SAME_DEVICE\f[] which comes from the
  833. \f[B]EXDEV\f[] which is returned by \f[B]rename\f[] when the call is
  834. crossing mount points.
  835. When a program gets an \f[B]EXDEV\f[] it needs to explicitly take an
  836. alternate action to accomplish it\[aq]s goal.
  837. In the case of \f[B]mv\f[] or similar it tries \f[B]rename\f[] and on
  838. \f[B]EXDEV\f[] falls back to a manual copying of data between the two
  839. locations and unlinking the source.
  840. In these older versions of GVFS\-fuse if it received \f[B]EXDEV\f[] it
  841. would translate that into \f[B]EIO\f[].
  842. This would cause \f[B]mv\f[] or most any application attempting to move
  843. files around on that SMB share to fail with a IO error.
  844. .PP
  845. GVFS\-fuse v1.22.0 (https://bugzilla.gnome.org/show_bug.cgi?id=734568)
  846. and above fixed this issue but a large number of systems use the older
  847. release.
  848. On Ubuntu the version can be checked by issuing
  849. \f[C]apt\-cache\ showpkg\ gvfs\-fuse\f[].
  850. Most distros released in 2015 seem to have the updated release and will
  851. work fine but older systems may not.
  852. Upgrading gvfs\-fuse or the distro in general will address the problem.
  853. .PP
  854. In Apple\[aq]s MacOSX 10.9 they replaced Samba (client and server) with
  855. their own product.
  856. It appears their new client does not handle \f[B]EXDEV\f[] either and
  857. responds similar to older release of gvfs on Linux.
  858. .SS Supplemental user groups
  859. .PP
  860. Due to the overhead of
  861. getgroups/setgroups (http://linux.die.net/man/2/setgroups) mergerfs
  862. utilizes a cache.
  863. This cache is opportunistic and per thread.
  864. Each thread will query the supplemental groups for a user when that
  865. particular thread needs to change credentials and will keep that data
  866. for the lifetime of the thread.
  867. This means that if a user is added to a group it may not be picked up
  868. without the restart of mergerfs.
  869. However, since the high level FUSE API\[aq]s (at least the standard
  870. version) thread pool dynamically grows and shrinks it\[aq]s possible
  871. that over time a thread will be killed and later a new thread with no
  872. cache will start and query the new data.
  873. .PP
  874. The gid cache uses fixed storage to simplify the design and be
  875. compatible with older systems which may not have C++11 compilers.
  876. There is enough storage for 256 users\[aq] supplemental groups.
  877. Each user is allowed upto 32 supplemental groups.
  878. Linux >= 2.6.3 allows upto 65535 groups per user but most other *nixs
  879. allow far less.
  880. NFS allowing only 16.
  881. The system does handle overflow gracefully.
  882. If the user has more than 32 supplemental groups only the first 32 will
  883. be used.
  884. If more than 256 users are using the system when an uncached user is
  885. found it will evict an existing user\[aq]s cache at random.
  886. So long as there aren\[aq]t more than 256 active users this should be
  887. fine.
  888. If either value is too low for your needs you will have to modify
  889. \f[C]gidcache.hpp\f[] to increase the values.
  890. Note that doing so will increase the memory needed by each thread.
  891. .SS mergerfs or libfuse crashing
  892. .PP
  893. If suddenly the mergerfs mount point disappears and
  894. \f[C]Transport\ endpoint\ is\ not\ connected\f[] is returned when
  895. attempting to perform actions within the mount directory \f[B]and\f[]
  896. the version of libfuse (use \f[C]mergerfs\ \-v\f[] to find the version)
  897. is older than \f[C]2.9.4\f[] its likely due to a bug in libfuse.
  898. Affected versions of libfuse can be found in Debian Wheezy, Ubuntu
  899. Precise and others.
  900. .PP
  901. In order to fix this please install newer versions of libfuse.
  902. If using a Debian based distro (Debian,Ubuntu,Mint) you can likely just
  903. install newer versions of
  904. libfuse (https://packages.debian.org/unstable/libfuse2) and
  905. fuse (https://packages.debian.org/unstable/fuse) from the repo of a
  906. newer release.
  907. .SS mergerfs appears to be crashing or exiting
  908. .PP
  909. There seems to be an issue with Linux version \f[C]4.9.0\f[] and above
  910. in which an invalid message appears to be transmitted to libfuse (used
  911. by mergerfs) causing it to exit.
  912. No messages will be printed in any logs as its not a proper crash.
  913. Debugging of the issue is still ongoing and can be followed via the
  914. fuse\-devel
  915. thread (https://sourceforge.net/p/fuse/mailman/message/35662577).
  916. .SS mergerfs under heavy load and memory preasure leads to kernel panic
  917. .PP
  918. https://lkml.org/lkml/2016/9/14/527
  919. .IP
  920. .nf
  921. \f[C]
  922. [25192.515454]\ kernel\ BUG\ at\ /build/linux\-a2WvEb/linux\-4.4.0/mm/workingset.c:346!
  923. [25192.517521]\ invalid\ opcode:\ 0000\ [#1]\ SMP
  924. [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]
  925. [25192.540910]\ CPU:\ 2\ PID:\ 63\ Comm:\ kswapd0\ Not\ tainted\ 4.4.0\-36\-generic\ #55\-Ubuntu
  926. [25192.543411]\ Hardware\ name:\ System\ manufacturer\ System\ Product\ Name/P8H67\-M\ PRO,\ BIOS\ 3904\ 04/27/2013
  927. [25192.545840]\ task:\ ffff88040cae6040\ ti:\ ffff880407488000\ task.ti:\ ffff880407488000
  928. [25192.548277]\ RIP:\ 0010:[<ffffffff811ba501>]\ \ [<ffffffff811ba501>]\ shadow_lru_isolate+0x181/0x190
  929. [25192.550706]\ RSP:\ 0018:ffff88040748bbe0\ \ EFLAGS:\ 00010002
  930. [25192.553127]\ RAX:\ 0000000000001c81\ RBX:\ ffff8802f91ee928\ RCX:\ ffff8802f91eeb38
  931. [25192.555544]\ RDX:\ ffff8802f91ee938\ RSI:\ ffff8802f91ee928\ RDI:\ ffff8804099ba2c0
  932. [25192.557914]\ RBP:\ ffff88040748bc08\ R08:\ 000000000001a7b6\ R09:\ 000000000000003f
  933. [25192.560237]\ R10:\ 000000000001a750\ R11:\ 0000000000000000\ R12:\ ffff8804099ba2c0
  934. [25192.562512]\ R13:\ ffff8803157e9680\ R14:\ ffff8803157e9668\ R15:\ ffff8804099ba2c8
  935. [25192.564724]\ FS:\ \ 0000000000000000(0000)\ GS:ffff88041f280000(0000)\ knlGS:0000000000000000
  936. [25192.566990]\ CS:\ \ 0010\ DS:\ 0000\ ES:\ 0000\ CR0:\ 0000000080050033
  937. [25192.569201]\ CR2:\ 00007ffabb690000\ CR3:\ 0000000001e0a000\ CR4:\ 00000000000406e0
  938. [25192.571419]\ Stack:
  939. [25192.573550]\ \ ffff8804099ba2c0\ ffff88039e4f86f0\ ffff8802f91ee928\ ffff8804099ba2c8
  940. [25192.575695]\ \ ffff88040748bd08\ ffff88040748bc58\ ffffffff811b99bf\ 0000000000000052
  941. [25192.577814]\ \ 0000000000000000\ ffffffff811ba380\ 000000000000008a\ 0000000000000080
  942. [25192.579947]\ Call\ Trace:
  943. [25192.582022]\ \ [<ffffffff811b99bf>]\ __list_lru_walk_one.isra.3+0x8f/0x130
  944. [25192.584137]\ \ [<ffffffff811ba380>]\ ?\ memcg_drain_all_list_lrus+0x190/0x190
  945. [25192.586165]\ \ [<ffffffff811b9a83>]\ list_lru_walk_one+0x23/0x30
  946. [25192.588145]\ \ [<ffffffff811ba544>]\ scan_shadow_nodes+0x34/0x50
  947. [25192.590074]\ \ [<ffffffff811a0e9d>]\ shrink_slab.part.40+0x1ed/0x3d0
  948. [25192.591985]\ \ [<ffffffff811a53da>]\ shrink_zone+0x2ca/0x2e0
  949. [25192.593863]\ \ [<ffffffff811a64ce>]\ kswapd+0x51e/0x990
  950. [25192.595737]\ \ [<ffffffff811a5fb0>]\ ?\ mem_cgroup_shrink_node_zone+0x1c0/0x1c0
  951. [25192.597613]\ \ [<ffffffff810a0808>]\ kthread+0xd8/0xf0
  952. [25192.599495]\ \ [<ffffffff810a0730>]\ ?\ kthread_create_on_node+0x1e0/0x1e0
  953. [25192.601335]\ \ [<ffffffff8182e34f>]\ ret_from_fork+0x3f/0x70
  954. [25192.603193]\ \ [<ffffffff810a0730>]\ ?\ kthread_create_on_node+0x1e0/0x1e0
  955. \f[]
  956. .fi
  957. .PP
  958. There is a bug in the kernel.
  959. A work around appears to be turning off \f[C]splice\f[].
  960. Add \f[C]no_splice_write,no_splice_move,no_splice_read\f[] to
  961. mergerfs\[aq] options.
  962. Should be placed after \f[C]defaults\f[] if it is used since it will
  963. turn them on.
  964. This however is not guaranteed to work.
  965. .SH FAQ
  966. .SS Why use mergerfs over mhddfs?
  967. .PP
  968. mhddfs is no longer maintained and has some known stability and security
  969. issues (see below).
  970. MergerFS provides a superset of mhddfs\[aq] features and should offer
  971. the same or maybe better performance.
  972. .SS Why use mergerfs over aufs?
  973. .PP
  974. While aufs can offer better peak performance mergerfs offers more
  975. configurability and is generally easier to use.
  976. mergerfs however does not offer the overlay / copy\-on\-write (COW)
  977. features which aufs and overlayfs have.
  978. .SS Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation /
  979. striping?
  980. .PP
  981. With simple JBOD / drive concatenation / stripping / RAID0 a single
  982. drive failure will lead to full pool failure.
  983. mergerfs performs a similar behavior without the catastrophic failure
  984. and general lack of recovery.
  985. Drives can fail and all other data will continue to be accessable.
  986. .PP
  987. When combined with something like SnapRaid (http://www.snapraid.it)
  988. and/or an offsite full backup solution you can have the flexibilty of
  989. JBOD without the single point of failure.
  990. .SS Why use mergerfs over ZFS?
  991. .PP
  992. MergerFS is not intended to be a replacement for ZFS.
  993. MergerFS is intended to provide flexible pooling of arbitrary drives
  994. (local or remote), of arbitrary sizes, and arbitrary filesystems.
  995. For \f[C]write\ once,\ read\ many\f[] usecases such as media storage.
  996. And where data integrity and backup can be managed in other ways.
  997. In that situation ZFS can introduce major maintance and cost burdens as
  998. described
  999. here (http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html).
  1000. .SS Can drives be written to directly? Outside of mergerfs while pooled?
  1001. .PP
  1002. Yes.
  1003. It will be represented immediately in the pool as the policies would
  1004. describe.
  1005. .SS Why do I get an "out of space" error even though the system says
  1006. there\[aq]s lots of space left?
  1007. .PP
  1008. Please reread the sections above about policies, path preserving, and
  1009. the \f[B]moveonenospc\f[] option.
  1010. If the policy is path preserving and a drive is almost full and the
  1011. drive the policy would pick then the writing of the file may fill the
  1012. drive and receive ENOSPC errors.
  1013. That is expected with those settings.
  1014. If you don\[aq]t want that: enable \f[B]moveonenospc\f[] and don\[aq]t
  1015. use a path preserving policy.
  1016. .SS Can mergerfs mounts be exported over NFS?
  1017. .PP
  1018. Yes.
  1019. Some clients (Kodi) have issues but users have found that enabling the
  1020. \f[C]use_ino\f[] option often address the problem.
  1021. .SS Can mergerfs mounts be exported over Samba / SMB?
  1022. .PP
  1023. Yes.
  1024. .SS How are inodes calculated?
  1025. .PP
  1026. mergerfs\-inode = (original\-inode | (device\-id << 32))
  1027. .PP
  1028. While \f[C]ino_t\f[] is 64 bits only a few filesystems use more than 32.
  1029. Similarly, while \f[C]dev_t\f[] is also 64 bits it was traditionally 16
  1030. bits.
  1031. Bitwise or\[aq]ing them together should work most of the time.
  1032. While totally unique inodes are preferred the overhead which would be
  1033. needed does not seem to outweighted by the benefits.
  1034. .SS It\[aq]s mentioned that there are some security issues with mhddfs.
  1035. What are they? How does mergerfs address them?
  1036. .PP
  1037. mhddfs (https://github.com/trapexit/mhddfs) manages running as
  1038. \f[B]root\f[] by calling
  1039. getuid() (https://github.com/trapexit/mhddfs/blob/cae96e6251dd91e2bdc24800b4a18a74044f6672/src/main.c#L319)
  1040. and if it returns \f[B]0\f[] then it will
  1041. chown (http://linux.die.net/man/1/chown) the file.
  1042. Not only is that a race condition but it doesn\[aq]t handle many other
  1043. situations.
  1044. Rather than attempting to simulate POSIX ACL behavior the proper way to
  1045. manage this is to use seteuid (http://linux.die.net/man/2/seteuid) and
  1046. setegid (http://linux.die.net/man/2/setegid), in effect becoming the
  1047. user making the original call, and perform the action as them.
  1048. This is what mergerfs does.
  1049. .PP
  1050. In Linux setreuid syscalls apply only to the thread.
  1051. GLIBC hides this away by using realtime signals to inform all threads to
  1052. change credentials.
  1053. Taking after \f[B]Samba\f[], mergerfs uses
  1054. \f[B]syscall(SYS_setreuid,...)\f[] to set the callers credentials for
  1055. that thread only.
  1056. Jumping back to \f[B]root\f[] as necessary should escalated privileges
  1057. be needed (for instance: to clone paths between drives).
  1058. .PP
  1059. For non\-Linux systems mergerfs uses a read\-write lock and changes
  1060. credentials only when necessary.
  1061. If multiple threads are to be user X then only the first one will need
  1062. to change the processes credentials.
  1063. So long as the other threads need to be user X they will take a readlock
  1064. allowing multiple threads to share the credentials.
  1065. Once a request comes in to run as user Y that thread will attempt a
  1066. write lock and change to Y\[aq]s credentials when it can.
  1067. If the ability to give writers priority is supported then that flag will
  1068. be used so threads trying to change credentials don\[aq]t starve.
  1069. This isn\[aq]t the best solution but should work reasonably well
  1070. assuming there are few users.
  1071. .SH SUPPORT
  1072. .SS Issues with the software
  1073. .IP \[bu] 2
  1074. github.com: https://github.com/trapexit/mergerfs/issues
  1075. .IP \[bu] 2
  1076. email: trapexit\@spawn.link
  1077. .IP \[bu] 2
  1078. twitter: https://twitter.com/_trapexit
  1079. .SS Support development
  1080. .IP \[bu] 2
  1081. Gratipay: https://gratipay.com/~trapexit
  1082. .IP \[bu] 2
  1083. BitCoin: 12CdMhEPQVmjz3SSynkAEuD5q9JmhTDCZA
  1084. .SH LINKS
  1085. .IP \[bu] 2
  1086. http://github.com/trapexit/mergerfs
  1087. .IP \[bu] 2
  1088. http://github.com/trapexit/mergerfs\-tools
  1089. .IP \[bu] 2
  1090. http://github.com/trapexit/scorch
  1091. .IP \[bu] 2
  1092. http://github.com/trapexit/backup\-and\-recovery\-howtos
  1093. .SH AUTHORS
  1094. Antonio SJ Musumeci <trapexit@spawn.link>.