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.

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