btrfs.txt 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. BTRFS
  2. =====
  3. Btrfs is a copy on write filesystem for Linux aimed at
  4. implementing advanced features while focusing on fault tolerance,
  5. repair and easy administration. Initially developed by Oracle, Btrfs
  6. is licensed under the GPL and open for contribution from anyone.
  7. Linux has a wealth of filesystems to choose from, but we are facing a
  8. number of challenges with scaling to the large storage subsystems that
  9. are becoming common in today's data centers. Filesystems need to scale
  10. in their ability to address and manage large storage, and also in
  11. their ability to detect, repair and tolerate errors in the data stored
  12. on disk. Btrfs is under heavy development, and is not suitable for
  13. any uses other than benchmarking and review. The Btrfs disk format is
  14. not yet finalized.
  15. The main Btrfs features include:
  16. * Extent based file storage (2^64 max file size)
  17. * Space efficient packing of small files
  18. * Space efficient indexed directories
  19. * Dynamic inode allocation
  20. * Writable snapshots
  21. * Subvolumes (separate internal filesystem roots)
  22. * Object level mirroring and striping
  23. * Checksums on data and metadata (multiple algorithms available)
  24. * Compression
  25. * Integrated multiple device support, with several raid algorithms
  26. * Online filesystem check (not yet implemented)
  27. * Very fast offline filesystem check
  28. * Efficient incremental backup and FS mirroring (not yet implemented)
  29. * Online filesystem defragmentation
  30. Mount Options
  31. =============
  32. When mounting a btrfs filesystem, the following option are accepted.
  33. Unless otherwise specified, all options default to off.
  34. alloc_start=<bytes>
  35. Debugging option to force all block allocations above a certain
  36. byte threshold on each block device. The value is specified in
  37. bytes, optionally with a K, M, or G suffix, case insensitive.
  38. Default is 1MB.
  39. autodefrag
  40. Detect small random writes into files and queue them up for the
  41. defrag process. Works best for small files; Not well suited for
  42. large database workloads.
  43. check_int
  44. check_int_data
  45. check_int_print_mask=<value>
  46. These debugging options control the behavior of the integrity checking
  47. module (the BTRFS_FS_CHECK_INTEGRITY config option required).
  48. check_int enables the integrity checker module, which examines all
  49. block write requests to ensure on-disk consistency, at a large
  50. memory and CPU cost.
  51. check_int_data includes extent data in the integrity checks, and
  52. implies the check_int option.
  53. check_int_print_mask takes a bitmask of BTRFSIC_PRINT_MASK_* values
  54. as defined in fs/btrfs/check-integrity.c, to control the integrity
  55. checker module behavior.
  56. See comments at the top of fs/btrfs/check-integrity.c for more info.
  57. compress
  58. compress=<type>
  59. compress-force
  60. compress-force=<type>
  61. Control BTRFS file data compression. Type may be specified as "zlib"
  62. "lzo" or "no" (for no compression, used for remounting). If no type
  63. is specified, zlib is used. If compress-force is specified,
  64. all files will be compressed, whether or not they compress well.
  65. If compression is enabled, nodatacow and nodatasum are disabled.
  66. degraded
  67. Allow mounts to continue with missing devices. A read-write mount may
  68. fail with too many devices missing, for example if a stripe member
  69. is completely missing.
  70. device=<devicepath>
  71. Specify a device during mount so that ioctls on the control device
  72. can be avoided. Especialy useful when trying to mount a multi-device
  73. setup as root. May be specified multiple times for multiple devices.
  74. discard
  75. Issue frequent commands to let the block device reclaim space freed by
  76. the filesystem. This is useful for SSD devices, thinly provisioned
  77. LUNs and virtual machine images, but may have a significant
  78. performance impact. (The fstrim command is also available to
  79. initiate batch trims from userspace).
  80. enospc_debug
  81. Debugging option to be more verbose in some ENOSPC conditions.
  82. fatal_errors=<action>
  83. Action to take when encountering a fatal error:
  84. "bug" - BUG() on a fatal error. This is the default.
  85. "panic" - panic() on a fatal error.
  86. flushoncommit
  87. The 'flushoncommit' mount option forces any data dirtied by a write in a
  88. prior transaction to commit as part of the current commit. This makes
  89. the committed state a fully consistent view of the file system from the
  90. application's perspective (i.e., it includes all completed file system
  91. operations). This was previously the behavior only when a snapshot is
  92. created.
  93. inode_cache
  94. Enable free inode number caching. Defaults to off due to an overflow
  95. problem when the free space crcs don't fit inside a single page.
  96. max_inline=<bytes>
  97. Specify the maximum amount of space, in bytes, that can be inlined in
  98. a metadata B-tree leaf. The value is specified in bytes, optionally
  99. with a K, M, or G suffix, case insensitive. In practice, this value
  100. is limited by the root sector size, with some space unavailable due
  101. to leaf headers. For a 4k sectorsize, max inline data is ~3900 bytes.
  102. metadata_ratio=<value>
  103. Specify that 1 metadata chunk should be allocated after every <value>
  104. data chunks. Off by default.
  105. noacl
  106. Disable support for Posix Access Control Lists (ACLs). See the
  107. acl(5) manual page for more information about ACLs.
  108. nobarrier
  109. Disables the use of block layer write barriers. Write barriers ensure
  110. that certain IOs make it through the device cache and are on persistent
  111. storage. If used on a device with a volatile (non-battery-backed)
  112. write-back cache, this option will lead to filesystem corruption on a
  113. system crash or power loss.
  114. nodatacow
  115. Disable data copy-on-write for newly created files. Implies nodatasum,
  116. and disables all compression.
  117. nodatasum
  118. Disable data checksumming for newly created files.
  119. notreelog
  120. Disable the tree logging used for fsync and O_SYNC writes.
  121. recovery
  122. Enable autorecovery attempts if a bad tree root is found at mount time.
  123. Currently this scans a list of several previous tree roots and tries to
  124. use the first readable.
  125. skip_balance
  126. Skip automatic resume of interrupted balance operation after mount.
  127. May be resumed with "btrfs balance resume."
  128. space_cache (*)
  129. Enable the on-disk freespace cache.
  130. nospace_cache
  131. Disable freespace cache loading without clearing the cache.
  132. clear_cache
  133. Force clearing and rebuilding of the disk space cache if something
  134. has gone wrong.
  135. ssd
  136. nossd
  137. ssd_spread
  138. Options to control ssd allocation schemes. By default, BTRFS will
  139. enable or disable ssd allocation heuristics depending on whether a
  140. rotational or nonrotational disk is in use. The ssd and nossd options
  141. can override this autodetection.
  142. The ssd_spread mount option attempts to allocate into big chunks
  143. of unused space, and may perform better on low-end ssds. ssd_spread
  144. implies ssd, enabling all other ssd heuristics as well.
  145. subvol=<path>
  146. Mount subvolume at <path> rather than the root subvolume. <path> is
  147. relative to the top level subvolume.
  148. subvolid=<ID>
  149. Mount subvolume specified by an ID number rather than the root subvolume.
  150. This allows mounting of subvolumes which are not in the root of the mounted
  151. filesystem.
  152. You can use "btrfs subvolume list" to see subvolume ID numbers.
  153. subvolrootid=<objectid> (deprecated)
  154. Mount subvolume specified by <objectid> rather than the root subvolume.
  155. This allows mounting of subvolumes which are not in the root of the mounted
  156. filesystem.
  157. You can use "btrfs subvolume show " to see the object ID for a subvolume.
  158. thread_pool=<number>
  159. The number of worker threads to allocate. The default number is equal
  160. to the number of CPUs + 2, or 8, whichever is smaller.
  161. user_subvol_rm_allowed
  162. Allow subvolumes to be deleted by a non-root user. Use with caution.
  163. MAILING LIST
  164. ============
  165. There is a Btrfs mailing list hosted on vger.kernel.org. You can
  166. find details on how to subscribe here:
  167. http://vger.kernel.org/vger-lists.html#linux-btrfs
  168. Mailing list archives are available from gmane:
  169. http://dir.gmane.org/gmane.comp.file-systems.btrfs
  170. IRC
  171. ===
  172. Discussion of Btrfs also occurs on the #btrfs channel of the Freenode
  173. IRC network.
  174. UTILITIES
  175. =========
  176. Userspace tools for creating and manipulating Btrfs file systems are
  177. available from the git repository at the following location:
  178. http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs.git
  179. git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git
  180. These include the following tools:
  181. mkfs.btrfs: create a filesystem
  182. btrfsctl: control program to create snapshots and subvolumes:
  183. mount /dev/sda2 /mnt
  184. btrfsctl -s new_subvol_name /mnt
  185. btrfsctl -s snapshot_of_default /mnt/default
  186. btrfsctl -s snapshot_of_new_subvol /mnt/new_subvol_name
  187. btrfsctl -s snapshot_of_a_snapshot /mnt/snapshot_of_new_subvol
  188. ls /mnt
  189. default snapshot_of_a_snapshot snapshot_of_new_subvol
  190. new_subvol_name snapshot_of_default
  191. Snapshots and subvolumes cannot be deleted right now, but you can
  192. rm -rf all the files and directories inside them.
  193. btrfsck: do a limited check of the FS extent trees.
  194. btrfs-debug-tree: print all of the FS metadata in text form. Example:
  195. btrfs-debug-tree /dev/sda2 >& big_output_file