.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "BTRFS-CHECK" "8" "Sep 17, 2024" "6.11" "BTRFS" .SH NAME btrfs-check \- check or repair a btrfs filesystem .SH SYNOPSIS .sp \fBbtrfs check\fP [options] .SH DESCRIPTION .sp The filesystem checker is used to verify structural integrity of a filesystem and attempt to repair it if requested. It is recommended to unmount the filesystem prior to running the check, but it is possible to start checking a mounted filesystem (see \fI\%\-\-force\fP). .sp By default, \fBbtrfs check\fP will not modify the device but you can reaffirm that by the option \fI\-\-readonly\fP\&. .sp \fBbtrfsck\fP is an alias of \fBbtrfs check\fP command and is now deprecated. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 Do not use \fI\-\-repair\fP unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no \fIfsck\fP successfully repair all types of filesystem corruption. E.g. some other software or hardware bugs can fatally damage a volume. .UNINDENT .UNINDENT .sp The structural integrity check verifies if internal filesystem objects or data structures satisfy the constraints, point to the right objects or are correctly connected together. .sp There are several cross checks that can detect wrong reference counts of shared extents, backreferences, missing extents of inodes, directory and inode connectivity etc. .sp The amount of memory required can be high, depending on the size of the filesystem, similarly the run time. Check the modes that can also affect that. .SH SAFE OR ADVISORY OPTIONS .INDENT 0.0 .TP .B \-b|\-\-backup use the first valid set of backup roots stored in the superblock .sp This can be combined with \fI\-\-super\fP if some of the superblocks are damaged. .UNINDENT .INDENT 0.0 .TP .B \-\-check\-data\-csum verify checksums of data blocks .sp This expects that the filesystem is otherwise OK, and is basically an offline \fIscrub\fP that does not repair data from spare copies. .TP .BI \-\-chunk\-root \ use the given offset \fIbytenr\fP for the chunk tree root .UNINDENT .INDENT 0.0 .TP .B \-E|\-\-subvol\-extents show extent state for the given subvolume .UNINDENT .INDENT 0.0 .TP .BI \-\-mode \ select mode of operation regarding memory and IO .sp The \fIMODE\fP can be one of: .INDENT 7.0 .TP .B original The metadata are read into memory and verified, thus the requirements are high on large filesystems and can even lead to out\-of\-memory conditions. The possible workaround is to export the block device over network to a machine with enough memory. .TP .B lowmem This mode is supposed to address the high memory consumption at the cost of increased IO when it needs to re\-read blocks. This may increase run time. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-p|\-\-progress indicate progress at various checking phases .TP .B \-Q|\-\-qgroup\-report verify qgroup accounting and compare against filesystem accounting .TP .B \-r|\-\-tree\-root use the given offset \(aqbytenr\(aq for the tree root .UNINDENT .INDENT 0.0 .TP .B \-\-readonly (default) run in read\-only mode, this option exists to calm potential panic when users are going to run the checker .UNINDENT .INDENT 0.0 .TP .B \-s|\-\-super use Nth superblock copy, valid values are 0, 1 or 2 if the respective superblock offset is within the device size .sp This can be used to use a different starting point if some of the primary superblock is damaged. .UNINDENT .SH DANGEROUS OPTIONS .INDENT 0.0 .TP .B \-\-repair enable the repair mode and attempt to fix problems where possible .sp \fBNOTE:\fP .INDENT 7.0 .INDENT 3.5 There\(aqs a warning and 10 second delay when this option is run without \fI\-\-force\fP to give users a chance to think twice before running repair, the warnings in documentation have shown to be insufficient. .UNINDENT .UNINDENT .TP .B \-\-init\-csum\-tree create a new checksum tree and recalculate checksums in all files .sp \fBWARNING:\fP .INDENT 7.0 .INDENT 3.5 Do not blindly use this option to fix checksum mismatch problems. .UNINDENT .UNINDENT .TP .B \-\-init\-extent\-tree build the extent tree from scratch .sp \fBWARNING:\fP .INDENT 7.0 .INDENT 3.5 Do not use unless you know what you\(aqre doing. .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-force allow work on a mounted filesystem and skip mount checks. Note that this should work fine on a quiescent or read\-only mounted filesystem but may crash if the device is changed externally, e.g. by the kernel module. .sp \fBNOTE:\fP .INDENT 7.0 .INDENT 3.5 It is possible to run with \-\-repair but on a mounted filesystem that will most likely lead to a corruption unless the filesystem is in a quiescent state which may not be possible to guarantee. .UNINDENT .UNINDENT .sp This option also skips the delay and warning in the repair mode (see \fI\-\-repair\fP). .UNINDENT .SH DEPRECATED OR REMOVED OPTIONS .INDENT 0.0 .TP .B \-\-clear\-space\-cache v1|v2 completely remove the free space cache of the given version .sp See also the \fIclear_cache\fP mount option. .sp \fBWARNING:\fP .INDENT 7.0 .INDENT 3.5 This option is deprecated, please use \fIbtrfs rescue clear\-space\-cache\fP instead, this option would be removed in the future eventually. .UNINDENT .UNINDENT .UNINDENT .SH EXIT STATUS .sp \fBbtrfs check\fP returns a zero exit status if it succeeds. Non zero is returned in case of failure. .SH AVAILABILITY .sp \fBbtrfs\fP is part of btrfs\-progs. Please refer to the documentation at \X'tty: link https://btrfs.readthedocs.io'\fI\%https://btrfs.readthedocs.io\fP\X'tty: link'\&. .SH SEE ALSO .sp \fI\%mkfs.btrfs(8)\fP, \fI\%btrfs\-scrub(8)\fP, \fI\%btrfs\-rescue(8)\fP .\" Generated by docutils manpage writer. .