summaryrefslogtreecommitdiff
path: root/Documentation/btrfs.5
blob: 433e6dd6052d9854c9768a9aef9b81916e854e8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
'\" t
.\"     Title: btrfs-man5
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 12/05/2018
.\"    Manual: Btrfs Manual
.\"    Source: Btrfs v4.19.1
.\"  Language: English
.\"
.TH "BTRFS\-MAN5" "5" "12/05/2018" "Btrfs v4\&.19\&.1" "Btrfs Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
btrfs-man5 \- topics about the BTRFS filesystem (mount options, supported file attributes and other)
.SH "DESCRIPTION"
.sp
This document describes topics related to BTRFS that are not specific to the tools\&. Currently covers:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
mount options
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
filesystem features
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  3." 4.2
.\}
filesystem limits
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  4." 4.2
.\}
file attributes
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 5.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  5." 4.2
.\}
control device
.RE
.SH "MOUNT OPTIONS"
.sp
This section describes mount options specific to BTRFS\&. For the generic mount options please refer to \fBmount\fR(8) manpage\&. The options are sorted alphabetically (discarding the \fIno\fR prefix)\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
most mount options apply to the whole filesystem and only options in the first mounted subvolume will take effect\&. This is due to lack of implementation and may change in the future\&. This means that (for example) you can\(cqt set per\-subvolume \fInodatacow\fR, \fInodatasum\fR, or \fIcompress\fR using mount options\&. This should eventually be fixed, but it has proved to be difficult to implement correctly within the Linux VFS framework\&.
.sp .5v
.RE
.PP
\fBacl\fR, \fBnoacl\fR
.RS 4
(default: on)
.sp
Enable/disable support for Posix Access Control Lists (ACLs)\&. See the
\fBacl\fR(5) manual page for more information about ACLs\&.
.sp
The support for ACL is build\-time configurable (BTRFS_FS_POSIX_ACL) and mount fails if
\fIacl\fR
is requested but the feature is not compiled in\&.
.RE
.PP
\fBautodefrag\fR, \fBnoautodefrag\fR
.RS 4
(since: 3\&.0, default: off)
.sp
Enable automatic file defragmentation\&. When enabled, small random writes into files (in a range of tens of kilobytes, currently it\(cqs 64K) are detected and queued up for the defragmentation process\&. Not well suited for large database workloads\&.
.sp
The read latency may increase due to reading the adjacent blocks that make up the range for defragmentation, successive write will merge the blocks in the new location\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBWarning\fR
.ps -1
.br
Defragmenting with Linux kernel versions < 3\&.9 or \(>= 3\&.14\-rc2 as well as with Linux stable kernel versions \(>= 3\&.10\&.31, \(>= 3\&.12\&.12 or \(>= 3\&.13\&.4 will break up the reflinks of COW data (for example files copied with
\fBcp \-\-reflink\fR, snapshots or de\-duplicated data)\&. This may cause considerable increase of space usage depending on the broken up reflinks\&.
.sp .5v
.RE
.RE
.PP
\fBbarrier\fR, \fBnobarrier\fR
.RS 4
(default: on)
.sp
Ensure that all IO write operations make it through the device cache and are stored permanently when the filesystem is at its consistency checkpoint\&. This typically means that a flush command is sent to the device that will synchronize all pending data and ordinary metadata blocks, then writes the superblock and issues another flush\&.
.sp
The write flushes incur a slight hit and also prevent the IO block scheduler to reorder requests in a more effective way\&. Disabling barriers gets rid of that penalty but will most certainly lead to a corrupted filesystem in case of a crash or power loss\&. The ordinary metadata blocks could be yet unwritten at the time the new superblock is stored permanently, expecting that the block pointers to metadata were stored permanently before\&.
.sp
On a device with a volatile battery\-backed write\-back cache, the
\fInobarrier\fR
option will not lead to filesystem corruption as the pending blocks are supposed to make it to the permanent storage\&.
.RE
.PP
\fBcheck_int\fR, \fBcheck_int_data\fR, \fBcheck_int_print_mask=\fR\fB\fIvalue\fR\fR
.RS 4
(since: 3\&.0, default: off)
.sp
These debugging options control the behavior of the integrity checking module (the BTRFS_FS_CHECK_INTEGRITY config option required)\&. The main goal is to verify that all blocks from a given transaction period are properly linked\&.
.sp
\fIcheck_int\fR
enables the integrity checker module, which examines all block write requests to ensure on\-disk consistency, at a large memory and CPU cost\&.
.sp
\fIcheck_int_data\fR
includes extent data in the integrity checks, and implies the
\fIcheck_int\fR
option\&.
.sp
\fIcheck_int_print_mask\fR
takes a bitmask of BTRFSIC_PRINT_MASK_* values as defined in
\fIfs/btrfs/check\-integrity\&.c\fR, to control the integrity checker module behavior\&.
.sp
See comments at the top of
\fIfs/btrfs/check\-integrity\&.c\fR
for more information\&.
.RE
.PP
\fBclear_cache\fR
.RS 4
Force clearing and rebuilding of the disk space cache if something has gone wrong\&. See also:
\fIspace_cache\fR\&.
.RE
.PP
\fBcommit=\fR\fB\fIseconds\fR\fR
.RS 4
(since: 3\&.12, default: 30)
.sp
Set the interval of periodic transaction commit when data are synchronized to permanent storage\&. Higher interval values lead to larger amount of unwritten data, which has obvious consequences when the system crashes\&. The upper bound is not forced, but a warning is printed if it\(cqs more than 300 seconds (5 minutes)\&. Use with care\&.
.RE
.PP
\fBcompress\fR, \fBcompress=\fR\fB\fItype\fR\fR, \fBcompress\-force\fR, \fBcompress\-force=\fR\fB\fItype\fR\fR
.RS 4
(default: off)
.sp
Control BTRFS file data compression\&. Type may be specified as
\fIzlib\fR,
\fIlzo\fR,
\fIzstd\fR
or
\fIno\fR
(for no compression, used for remounting)\&. If no type is specified,
\fIzlib\fR
is used\&. If
\fIcompress\-force\fR
is specified, then compression will always be attempted, but the data may end up uncompressed if the compression would make them larger\&.
.sp
Otherwise some simple heuristics are applied to detect an incompressible file\&. If the first blocks written to a file are not compressible, the whole file is permanently marked to skip compression\&. As this is too simple, the
\fIcompress\-force\fR
is a workaround that will compress most of the files at the cost of some wasted CPU cycles on failed attempts\&. Since kernel 4\&.15, a set of heuristic algorithms have been improved by using frequency sampling, repeated pattern detection and Shannon entropy calculation to avoid that\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
If compression is enabled,
\fInodatacow\fR
and
\fInodatasum\fR
are disabled\&.
.sp .5v
.RE
.RE
.PP
\fBdatacow\fR, \fBnodatacow\fR
.RS 4
(default: on)
.sp
Enable data copy\-on\-write for newly created files\&.
\fINodatacow\fR
implies
\fInodatasum\fR, and disables
\fIcompression\fR\&. All files created under
\fInodatacow\fR
are also set the NOCOW file attribute (see
\fBchattr\fR(1))\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
If
\fInodatacow\fR
or
\fInodatasum\fR
are enabled, compression is disabled\&.
.sp .5v
.RE
Updates in\-place improve performance for workloads that do frequent overwrites, at the cost of potential partial writes, in case the write is interrupted (system crash, device failure)\&.
.RE
.PP
\fBdatasum\fR, \fBnodatasum\fR
.RS 4
(default: on)
.sp
Enable data checksumming for newly created files\&.
\fIDatasum\fR
implies
\fIdatacow\fR, ie\&. the normal mode of operation\&. All files created under
\fInodatasum\fR
inherit the "no checksums" property, however there\(cqs no corresponding file attribute (see
\fBchattr\fR(1))\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
If
\fInodatacow\fR
or
\fInodatasum\fR
are enabled, compression is disabled\&.
.sp .5v
.RE
There is a slight performance gain when checksums are turned off, the corresponding metadata blocks holding the checksums do not need to updated\&. The cost of checksumming of the blocks in memory is much lower than the IO, modern CPUs feature hardware support of the checksumming algorithm\&.
.RE
.PP
\fBdegraded\fR
.RS 4
(default: off)
.sp
Allow mounts with less devices than the RAID profile constraints require\&. A read\-write mount (or remount) may fail when there are too many devices missing, for example if a stripe member is completely missing from RAID0\&.
.sp
Since 4\&.14, the constraint checks have been improved and are verified on the chunk level, not an the device level\&. This allows degraded mounts of filesystems with mixed RAID profiles for data and metadata, even if the device number constraints would not be satisfied for some of the profiles\&.
.sp
Example: metadata \(em raid1, data \(em single, devices \(em /dev/sda, /dev/sdb
.sp
Suppose the data are completely stored on
\fIsda\fR, then missing
\fIsdb\fR
will not prevent the mount, even if 1 missing device would normally prevent (any)
\fIsingle\fR
profile to mount\&. In case some of the data chunks are stored on
\fIsdb\fR, then the constraint of single/data is not satisfied and the filesystem cannot be mounted\&.
.RE
.PP
\fBdevice=\fR\fB\fIdevicepath\fR\fR
.RS 4
Specify a path to a device that will be scanned for BTRFS filesystem during mount\&. This is usually done automatically by a device manager (like udev) or using the
\fBbtrfs device scan\fR
command (eg\&. run from the initial ramdisk)\&. In cases where this is not possible the
\fIdevice\fR
mount option can help\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
booting eg\&. a RAID1 system may fail even if all filesystem\(cqs
\fIdevice\fR
paths are provided as the actual device nodes may not be discovered by the system at that point\&.
.sp .5v
.RE
.RE
.PP
\fBdiscard\fR, \fBnodiscard\fR
.RS 4
(default: off)
.sp
Enable discarding of freed file blocks\&. This is useful for SSD devices, thinly provisioned LUNs, or virtual machine images; however, every storage layer must support discard for it to work\&. if the backing device does not support asynchronous queued TRIM, then this operation can severely degrade performance, because a synchronous TRIM operation will be attempted instead\&. Queued TRIM requires newer than SATA revision 3\&.1 chipsets and devices\&.
.RE
.sp
If it is not necessary to immediately discard freed blocks, then the \fBfstrim\fR tool can be used to discard all free blocks in a batch\&. Scheduling a TRIM during a period of low system activity will prevent latent interference with the performance of other operations\&. Also, a device may ignore the TRIM command if the range is too small, so running a batch discard has a greater probability of actually discarding the blocks\&.
.sp
If discarding is not necessary to be done at the block freeing time, there\(cqs \fBfstrim\fR(8) tool that lets the filesystem discard all free blocks in a batch, possibly not much interfering with other operations\&. Also, the device may ignore the TRIM command if the range is too small, so running the batch discard can actually discard the blocks\&.
.PP
\fBenospc_debug\fR, \fBnoenospc_debug\fR
.RS 4
(default: off)
.sp
Enable verbose output for some ENOSPC conditions\&. It\(cqs safe to use but can be noisy if the system reaches near\-full state\&.
.RE
.PP
\fBfatal_errors=\fR\fB\fIaction\fR\fR
.RS 4
(since: 3\&.4, default: bug)
.sp
Action to take when encountering a fatal error\&.
.PP
\fBbug\fR
.RS 4
\fIBUG()\fR
on a fatal error, the system will stay in the crashed state and may be still partially usable, but reboot is required for full operation
.RE
.PP
\fBpanic\fR
.RS 4
\fIpanic()\fR
on a fatal error, depending on other system configuration, this may be followed by a reboot\&. Please refer to the documentation of kernel boot parameters, eg\&.
\fIpanic\fR,
\fIoops\fR
or
\fIcrashkernel\fR\&.
.RE
.RE
.PP
\fBflushoncommit\fR, \fBnoflushoncommit\fR
.RS 4
(default: off)
.sp
This option forces any data dirtied by a write in a prior transaction to commit as part of the current commit, effectively a full filesystem sync\&.
.sp
This makes the committed state a fully consistent view of the file system from the application\(cqs perspective (i\&.e\&. it includes all completed file system operations)\&. This was previously the behavior only when a snapshot was created\&.
.sp
When off, the filesystem is consistent but buffered writes may last more than one transaction commit\&.
.RE
.PP
\fBfragment=\fR\fB\fItype\fR\fR
.RS 4
(depends on compile\-time option BTRFS_DEBUG, since: 4\&.4, default: off)
.sp
A debugging helper to intentionally fragment given
\fItype\fR
of block groups\&. The type can be
\fIdata\fR,
\fImetadata\fR
or
\fIall\fR\&. This mount option should not be used outside of debugging environments and is not recognized if the kernel config option
\fIBTRFS_DEBUG\fR
is not enabled\&.
.RE
.PP
\fBinode_cache\fR, \fBnoinode_cache\fR
.RS 4
(since: 3\&.0, default: off)
.sp
Enable free inode number caching\&. Not recommended to use unless files on your filesystem get assigned inode numbers that are approaching 2^64\&. Normally, new files in each subvolume get assigned incrementally (plus one from the last time) and are not reused\&. The mount option turns on caching of the existing inode numbers and reuse of inode numbers of deleted files\&.
.sp
This option may slow down your system at first run, or after mounting without the option\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
Defaults to off due to a potential overflow problem when the free space checksums don\(cqt fit inside a single page\&.
.sp .5v
.RE
Don\(cqt use this option unless you really need it\&. The inode number limit on 64bit system is 2^64, which is practically enough for the whole filesystem lifetime\&. Due to implementation of linux VFS layer, the inode numbers on 32bit systems are only 32 bits wide\&. This lowers the limit significantly and makes it possible to reach it\&. In such case, this mount option will help\&. Alternatively, files with high inode numbers can be copied to a new subvolume which will effectively start the inode numbers from the beginning again\&.
.RE
.PP
\fBlogreplay\fR, \fBnologreplay\fR
.RS 4
(default: on, even read\-only)
.sp
Enable/disable log replay at mount time\&. See also
\fItreelog\fR\&. Note that
\fInologreplay\fR
is the same as
\fInorecovery\fR\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBWarning\fR
.ps -1
.br
currently, the tree log is replayed even with a read\-only mount! To disable that behaviour, mount also with
\fInologreplay\fR\&.
.sp .5v
.RE
.RE
.PP
\fBmax_inline=\fR\fB\fIbytes\fR\fR
.RS 4
(default: min(2048, page size) )
.sp
Specify the maximum amount of space, that can be inlined in a metadata B\-tree leaf\&. The value is specified in bytes, optionally with a K suffix (case insensitive)\&. In practice, this value is limited by the filesystem block size (named
\fIsectorsize\fR
at mkfs time), and memory page size of the system\&. In case of sectorsize limit, there\(cqs some space unavailable due to leaf headers\&. For example, a 4k sectorsize, maximum size of inline data is about 3900 bytes\&.
.sp
Inlining can be completely turned off by specifying 0\&. This will increase data block slack if file sizes are much smaller than block size but will reduce metadata consumption in return\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
the default value has changed to 2048 in kernel 4\&.6\&.
.sp .5v
.RE
.RE
.PP
\fBmetadata_ratio=\fR\fB\fIvalue\fR\fR
.RS 4
(default: 0, internal logic)
.sp
Specifies that 1 metadata chunk should be allocated after every
\fIvalue\fR
data chunks\&. Default behaviour depends on internal logic, some percent of unused metadata space is attempted to be maintained but is not always possible if there\(cqs not enough space left for chunk allocation\&. The option could be useful to override the internal logic in favor of the metadata allocation if the expected workload is supposed to be metadata intense (snapshots, reflinks, xattrs, inlined files)\&.
.RE
.PP
\fBnorecovery\fR
.RS 4
(since: 4\&.5, default: off)
.sp
Do not attempt any data recovery at mount time\&. This will disable
\fIlogreplay\fR
and avoids other write operations\&. Note that this option is the same as
\fInologreplay\fR\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
The opposite option
\fIrecovery\fR
used to have different meaning but was changed for consistency with other filesystems, where
\fInorecovery\fR
is used for skipping log replay\&. BTRFS does the same and in general will try to avoid any write operations\&.
.sp .5v
.RE
.RE
.PP
\fBrescan_uuid_tree\fR
.RS 4
(since: 3\&.12, default: off)
.sp
Force check and rebuild procedure of the UUID tree\&. This should not normally be needed\&.
.RE
.PP
\fBskip_balance\fR
.RS 4
(since: 3\&.3, default: off)
.sp
Skip automatic resume of an interrupted balance operation\&. The operation can later be resumed with
\fBbtrfs balance resume\fR, or the paused state can be removed with
\fBbtrfs balance cancel\fR\&. The default behaviour is to resume an interrupted balance immediately after a volume is mounted\&.
.RE
.PP
\fBspace_cache\fR, \fBspace_cache=\fR\fB\fIversion\fR\fR, \fBnospace_cache\fR
.RS 4
(\fInospace_cache\fR
since: 3\&.2,
\fIspace_cache=v1\fR
and
\fIspace_cache=v2\fR
since 4\&.5, default:
\fIspace_cache=v1\fR)
.sp
Options to control the free space cache\&. The free space cache greatly improves performance when reading block group free space into memory\&. However, managing the space cache consumes some resources, including a small amount of disk space\&.
.sp
There are two implementations of the free space cache\&. The original one, referred to as
\fIv1\fR, is the safe default\&. The
\fIv1\fR
space cache can be disabled at mount time with
\fInospace_cache\fR
without clearing\&.
.sp
On very large filesystems (many terabytes) and certain workloads, the performance of the
\fIv1\fR
space cache may degrade drastically\&. The
\fIv2\fR
implementation, which adds a new B\-tree called the free space tree, addresses this issue\&. Once enabled, the
\fIv2\fR
space cache will always be used and cannot be disabled unless it is cleared\&. Use
\fIclear_cache,space_cache=v1\fR
or
\fIclear_cache,nospace_cache\fR
to do so\&. If
\fIv2\fR
is enabled, kernels without
\fIv2\fR
support will only be able to mount the filesystem in read\-only mode\&. The
\fBbtrfs\fR(8) command currently only has read\-only support for
\fIv2\fR\&. A read\-write command may be run on a
\fIv2\fR
filesystem by clearing the cache, running the command, and then remounting with
\fIspace_cache=v2\fR\&.
.sp
If a version is not explicitly specified, the default implementation will be chosen, which is
\fIv1\fR\&.
.RE
.PP
\fBssd\fR, \fBssd_spread\fR, \fBnossd\fR, \fBnossd_spread\fR
.RS 4
(default: SSD autodetected)
.sp
Options to control SSD allocation schemes\&. By default, BTRFS will enable or disable SSD optimizations depending on status of a device with respect to rotational or non\-rotational type\&. This is determined by the contents of
\fI/sys/block/DEV/queue/rotational\fR)\&. If it is 0, the
\fIssd\fR
option is turned on\&. The option
\fInossd\fR
will disable the autodetection\&.
.sp
The optimizations make use of the absence of the seek penalty that\(cqs inherent for the rotational devices\&. The blocks can be typically written faster and are not offloaded to separate threads\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
Since 4\&.14, the block layout optimizations have been dropped\&. This used to help with first generations of SSD devices\&. Their FTL (flash translation layer) was not effective and the optimization was supposed to improve the wear by better aligning blocks\&. This is no longer true with modern SSD devices and the optimization had no real benefit\&. Furthermore it caused increased fragmentation\&. The layout tuning has been kept intact for the option
\fIssd_spread\fR\&.
.sp .5v
.RE
The
\fIssd_spread\fR
mount option attempts to allocate into bigger and aligned chunks of unused space, and may perform better on low\-end SSDs\&.
\fIssd_spread\fR
implies
\fIssd\fR, enabling all other SSD heuristics as well\&. The option
\fInossd\fR
will disable all SSD options while
\fInossd_spread\fR
only disables
\fIssd_spread\fR\&.
.RE
.PP
\fBsubvol=\fR\fB\fIpath\fR\fR
.RS 4
Mount subvolume from
\fIpath\fR
rather than the toplevel subvolume\&. The
\fIpath\fR
is always treated as relative to the toplevel subvolume\&. This mount option overrides the default subvolume set for the given filesystem\&.
.RE
.PP
\fBsubvolid=\fR\fB\fIsubvolid\fR\fR
.RS 4
Mount subvolume specified by a
\fIsubvolid\fR
number rather than the toplevel subvolume\&. You can use
\fBbtrfs subvolume list\fR
of
\fBbtrfs subvolume show\fR
to see subvolume ID numbers\&. This mount option overrides the default subvolume set for the given filesystem\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
if both
\fIsubvolid\fR
and
\fIsubvol\fR
are specified, they must point at the same subvolume, otherwise the mount will fail\&.
.sp .5v
.RE
.RE
.PP
\fBthread_pool=\fR\fB\fInumber\fR\fR
.RS 4
(default: min(NRCPUS + 2, 8) )
.sp
The number of worker threads to start\&. NRCPUS is number of on\-line CPUs detected at the time of mount\&. Small number leads to less parallelism in processing data and metadata, higher numbers could lead to a performance hit due to increased locking contention, process scheduling, cache\-line bouncing or costly data transfers between local CPU memories\&.
.RE
.PP
\fBtreelog\fR, \fBnotreelog\fR
.RS 4
(default: on)
.sp
Enable the tree logging used for
\fIfsync\fR
and
\fIO_SYNC\fR
writes\&. The tree log stores changes without the need of a full filesystem sync\&. The log operations are flushed at sync and transaction commit\&. If the system crashes between two such syncs, the pending tree log operations are replayed during mount\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBWarning\fR
.ps -1
.br
currently, the tree log is replayed even with a read\-only mount! To disable that behaviour, also mount with
\fInologreplay\fR\&.
.sp .5v
.RE
The tree log could contain new files/directories, these would not exist on a mounted filesystem if the log is not replayed\&.
.RE
.PP
\fBusebackuproot\fR, \fBnousebackuproot\fR
.RS 4
(since: 4\&.6, default: off)
.sp
Enable autorecovery attempts if a bad tree root is found at mount time\&. Currently this scans a backup list of several previous tree roots and tries to use the first readable\&. This can be used with read\-only mounts as well\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
This option has replaced
\fIrecovery\fR\&.
.sp .5v
.RE
.RE
.PP
\fBuser_subvol_rm_allowed\fR
.RS 4
(default: off)
.sp
Allow subvolumes to be deleted by their respective owner\&. Otherwise, only the root user can do that\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
historically, any user could create a snapshot even if he was not owner of the source subvolume, the subvolume deletion has been restricted for that reason\&. The subvolume creation has been restricted but this mount option is still required\&. This is a usability issue\&. Since 4\&.18, the
\fBrmdir\fR(2) syscall can delete an empty subvolume just like an ordinary directory\&. Whether this is possible can be detected at runtime, see
\fIrmdir_subvol\fR
feature in
\fIFILESYSTEM FEATURES\fR\&.
.sp .5v
.RE
.RE
.SS "DEPRECATED MOUNT OPTIONS"
.sp
List of mount options that have been removed, kept for backward compatibility\&.
.PP
\fBalloc_start=\fR\fB\fIbytes\fR\fR
.RS 4
(default: 1M, minimum: 1M, deprecated since: 4\&.13)
.sp
Debugging option to force all block allocations above a certain byte threshold on each block device\&. The value is specified in bytes, optionally with a K, M, or G suffix (case insensitive)\&.
.RE
.PP
\fBrecovery\fR
.RS 4
(since: 3\&.2, default: off, deprecated since: 4\&.5)
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
this option has been replaced by
\fIusebackuproot\fR
and should not be used but will work on 4\&.5+ kernels\&.
.sp .5v
.RE
.RE
.PP
\fBsubvolrootid=\fR\fB\fIobjectid\fR\fR
.RS 4
(irrelevant since: 3\&.2, formally deprecated since: 3\&.10)
.sp
A workaround option from times (pre 3\&.2) when it was not possible to mount a subvolume that did not reside directly under the toplevel subvolume\&.
.RE
.SS "NOTES ON GENERIC MOUNT OPTIONS"
.sp
Some of the general mount options from \fBmount\fR(8) that affect BTRFS and are worth mentioning\&.
.PP
\fBnoatime\fR
.RS 4
under read intensive work\-loads, specifying
\fInoatime\fR
significantly improves performance because no new access time information needs to be written\&. Without this option, the default is
\fIrelatime\fR, which only reduces the number of inode atime updates in comparison to the traditional
\fIstrictatime\fR\&. The worst case for atime updates under
\fIrelatime\fR
occurs when many files are read whose atime is older than 24 h and which are freshly snapshotted\&. In that case the atime is updated
\fIand\fR
COW happens \- for each file \- in bulk\&. See also
\m[blue]\fBhttps://lwn\&.net/Articles/499293/\fR\m[]
\-
\fIAtime and btrfs: a bad combination? (LWN, 2012\-05\-31)\fR\&.
.sp
Note that
\fInoatime\fR
may break applications that rely on atime uptimes like the venerable Mutt (unless you use maildir mailboxes)\&.
.RE
.SH "FILESYSTEM FEATURES"
.sp
The basic set of filesystem features gets extended over time\&. The backward compatibility is maintained and the features are optional, need to be explicitly asked for so accidental use will not create incompatibilities\&.
.sp
There are several classes and the respective tools to manage the features:
.PP
at mkfs time only
.RS 4
This is namely for core structures, like the b\-tree nodesize, see
\fBmkfs\&.btrfs\fR(8) for more details\&.
.RE
.PP
after mkfs, on an unmounted filesystem
.RS 4
Features that may optimize internal structures or add new structures to support new functionality, see
\fBbtrfstune\fR(8)\&. The command
\fBbtrfs inspect\-internal dump\-super device\fR
will dump a superblock, you can map the value of
\fIincompat_flags\fR
to the features listed below
.RE
.PP
after mkfs, on a mounted filesystem
.RS 4
The features of a filesystem (with a given UUID) are listed in
\fB/sys/fs/btrfs/UUID/features/\fR, one file per feature\&. The status is stored inside the file\&. The value
\fI1\fR
is for enabled and active, while
\fI0\fR
means the feature was enabled at mount time but turned off afterwards\&.
.sp
Whether a particular feature can be turned on a mounted filesystem can be found in the directory
\fB/sys/fs/btrfs/features/\fR, one file per feature\&. The value
\fI1\fR
means the feature can be enabled\&.
.RE
.sp
List of features (see also \fBmkfs\&.btrfs\fR(8) section \fIFILESYSTEM FEATURES\fR):
.PP
\fBbig_metadata\fR
.RS 4
(since: 3\&.4)
.sp
the filesystem uses
\fInodesize\fR
for metadata blocks, this can be bigger than the page size
.RE
.PP
\fBcompress_lzo\fR
.RS 4
(since: 2\&.6\&.38)
.sp
the
\fIlzo\fR
compression has been used on the filesystem, either as a mount option or via
\fBbtrfs filesystem defrag\fR\&.
.RE
.PP
\fBcompress_zstd\fR
.RS 4
(since: 4\&.14)
.sp
the
\fIzstd\fR
compression has been used on the filesystem, either as a mount option or via
\fBbtrfs filesystem defrag\fR\&.
.RE
.PP
\fBdefault_subvol\fR
.RS 4
(since: 2\&.6\&.34)
.sp
the default subvolume has been set on the filesystem
.RE
.PP
\fBextended_iref\fR
.RS 4
(since: 3\&.7)
.sp
increased hardlink limit per file in a directory to 65536, older kernels supported a varying number of hardlinks depending on the sum of all file name sizes that can be stored into one metadata block
.RE
.PP
\fBmixed_backref\fR
.RS 4
(since: 2\&.6\&.31)
.sp
the last major disk format change, improved backreferences, now default
.RE
.PP
\fBmixed_groups\fR
.RS 4
(since: 2\&.6\&.37)
.sp
mixed data and metadata block groups, ie\&. the data and metadata are not separated and occupy the same block groups, this mode is suitable for small volumes as there are no constraints how the remaining space should be used (compared to the split mode, where empty metadata space cannot be used for data and vice versa)
.sp
on the other hand, the final layout is quite unpredictable and possibly highly fragmented, which means worse performance
.RE
.PP
\fBno_holes\fR
.RS 4
(since: 3\&.14)
.sp
improved representation of file extents where holes are not explicitly stored as an extent, saves a few percent of metadata if sparse files are used
.RE
.PP
\fBraid56\fR
.RS 4
(since: 3\&.9)
.sp
the filesystem contains or contained a raid56 profile of block groups
.RE
.PP
\fBrmdir_subvol\fR
.RS 4
(since: 4\&.18)
.sp
indicate that
\fBrmdir\fR(2) syscall can delete an empty subvolume just like an ordinary directory\&. Note that this feature only depends on the kernel version\&.
.RE
.PP
\fBskinny_metadata\fR
.RS 4
(since: 3\&.10)
.sp
reduced\-size metadata for extent references, saves a few percent of metadata
.RE
.SH "FILESYSTEM LIMITS"
.PP
maximum file name length
.RS 4
255
.RE
.PP
maximum symlink target length
.RS 4
depends on the
\fInodesize\fR
value, for 4k it\(cqs 3949 bytes, for larger nodesize it\(cqs 4095
.sp
The symlink target may not be a valid path, ie the path name components can exceed the limits, there\(cqs no content validation at
\fBsymlink\fR(3) creation\&.
.RE
.PP
maximum number of inodes
.RS 4
2^64 but depends on the available metadata space as the inodes are created dynamically
.RE
.PP
inode numbers
.RS 4
minimum number: 256 (for subvolumes), regular files and directories: 257
.RE
.PP
maximum file length
.RS 4
inherent limit of btrfs is 2^64 (16 EiB) but the linux VFS limit is 2^63 (8 EiB)
.RE
.PP
maximum number of subvolumes
.RS 4
2^64 but depends on the available metadata space, the space consumed by all subvolume metadata includes bookkeeping of the shared extents can be large (MiB, GiB)
.RE
.PP
maximum number of hardlinks of a file in a directory
.RS 4
65536 when the
\fBextref\fR
feature is turned on during mkfs (default), roughly 100 otherwise
.RE
.SH "FILE ATTRIBUTES"
.sp
The btrfs filesystem supports setting the following file attributes using the \fBchattr\fR(1) utility:
.PP
\fBa\fR
.RS 4
\fIappend only\fR, new writes are always written at the end of the file
.RE
.PP
\fBA\fR
.RS 4
\fIno atime updates\fR
.RE
.PP
\fBc\fR
.RS 4
\fIcompress data\fR, all data written after this attribute is set will be compressed\&. Please note that compression is also affected by the mount options or the parent directory attributes\&.
.sp
When set on a directory, all newly created files will inherit this attribute\&.
.RE
.PP
\fBC\fR
.RS 4
\fIno copy\-on\-write\fR, file modifications are done in\-place
.sp
When set on a directory, all newly created files will inherit this attribute\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
due to implementation limitations, this flag can be set/unset only on empty files\&.
.sp .5v
.RE
.RE
.PP
\fBd\fR
.RS 4
\fIno dump\fR, makes sense with 3rd party tools like
\fBdump\fR(8), on BTRFS the attribute can be set/unset but no other special handling is done
.RE
.PP
\fBD\fR
.RS 4
\fIsynchronous directory updates\fR, for more details search
\fBopen\fR(2) for
\fIO_SYNC\fR
and
\fIO_DSYNC\fR
.RE
.PP
\fBi\fR
.RS 4
\fIimmutable\fR, no file data and metadata changes allowed even to the root user as long as this attribute is set (obviously the exception is unsetting the attribute)
.RE
.PP
\fBS\fR
.RS 4
\fIsynchronous updates\fR, for more details search
\fBopen\fR(2) for
\fIO_SYNC\fR
and
\fIO_DSYNC\fR
.RE
.PP
\fBX\fR
.RS 4
\fIno compression\fR, permanently turn off compression on the given file\&. Any compression mount options will not affect this file\&.
.sp
When set on a directory, all newly created files will inherit this attribute\&.
.RE
.sp
No other attributes are supported\&. For the complete list please refer to the \fBchattr\fR(1) manual page\&.
.SH "CONTROL DEVICE"
.sp
There\(cqs a character special device \fB/dev/btrfs\-control\fR with major and minor numbers 10 and 234 (the device can be found under the \fImisc\fR category)\&.
.sp
.if n \{\
.RS 4
.\}
.nf
$ ls \-l /dev/btrfs\-control
crw\-\-\-\-\-\-\- 1 root root 10, 234 Jan  1 12:00 /dev/btrfs\-control
.fi
.if n \{\
.RE
.\}
.sp
The device accepts some ioctl calls that can perform following actions on the filesystem module:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
scan devices for btrfs filesystem (ie\&. to let multi\-device filesystems mount automatically) and register them with the kernel module
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
similar to scan, but also wait until the device scanning process is finished for a given filesystem
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
get the supported features (can be also found under
\fI/sys/fs/btrfs/features\fR)
.RE
.sp
The device is usually created by a system device node manager (eg\&. udev), but can be created manually:
.sp
.if n \{\
.RS 4
.\}
.nf
# mknod \-\-mode=600 c 10 234 /dev/btrfs\-control
.fi
.if n \{\
.RE
.\}
.sp
The control device is not strictly required but the device scanning will not work and a workaround would need to be used to mount a multi\-device filesystem\&. The mount option \fIdevice\fR can trigger the device scanning during mount\&.
.SH "SEE ALSO"
.sp
\fBacl\fR(5), \fBbtrfs\fR(8), \fBchattr\fR(1), \fBfstrim\fR(8), \fBioctl\fR(2), \fBmkfs\&.btrfs\fR(8), \fBmount\fR(8)