software:linux:btrfs
This is an old revision of the document!
Table of Contents
btrfs check
From: https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-check
btrfs check /dev/sb2 btrfs check --repair \dev\sb2
btrfs scrub
From: https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
btrfs scrub start -Bd $mountpoint btrfs scrub is used to scrub a btrfs filesystem, which will read all data and metadata blocks from all devices and verify checksums. Automatically repair corrupted blocks if there’s a correct copy available. start [-BdqrRf] [-c <ioprio_class> -n <ioprio_classdata>] <path>|<device> Start a scrub on all devices of the filesystem identified by path or on a single device. If a scrub is already running, the new one fails. Without options, scrub is started as a background process. The default IO priority of scrub is the idle class. The priority can be configured similar to the ionice(1) syntax using -c and -n options. Options -B do not background and print scrub statistics when finished -d print separate statistics for each device of the filesystem (-B only) at the end -q be quiet, omit error messages and statistics -r run in read-only mode, do not attempt to correct anything, can be run on a read-only filesystem -R print raw statistics per-device instead of a summary -c <ioprio_class> set IO priority class (see ionice(1) manpage) -n <ioprio_classdata> set IO priority classdata (see ionice(1) manpage) -f force starting new scrub even if a scrub is already running, this can useful when scrub status file is damaged and reports a running scrub although it is not, but should not normally be necessary status [-d] <path>|<device>
BTRFS restoring a corrupt filesystem from another “tree location”
From: http://ram.kossboss.com/btrfs-restoring-a-corrupt-filesystem-from-another-tree-location/
Here is how you restore a really corrupt btrfs filesystem using btrfs restore.
PRE STEPS (realizing the filesystem is really corrupt by trying simple mounts and
restores):
* assume your volume name is /dev/md127 and that you have an available /root folder
to dump temp data to and that you will be dumping your restore to /USB
* you can change any of those variable if thats not the case
Here we assume the filesystem is so corrupt that its not mounting regulary:
# mount /dev/md127 /data
mount: wrong fs type, bad option, bad superblock on /dev/md127,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
btrfs file system
From: https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices
1 Multiple devices
1.1 Current status
1.2 Raid 5 and Raid6
1.3 Filesystem creation
1.4 Device scanning
1.5 Adding new devices
1.5.1 Conversion
1.6 Removing devices
1.7 Replacing failed devices
1.8 Registration in /etc/fstab
Same info as above
btrfsck
From: https://btrfs.wiki.kernel.org/index.php/Btrfsck
Before trying fsck
If you have a broken filesystem, you should probably look at the recovery or repair tools or you can read Marc MERLIN's page that explains the different ways to check and fix a btrfs filesystem.
In a nutshell, you should look at:
btrfs scrub to detect issues on live filesystems
look at btrfs detected errors in syslog (look at Marc's blog above on how to use sec.pl to do this)
mount -o ro,recovery to mount a filesystem with issues
btrfs-zero-log might help in specific cases. Go read Btrfs-zero-log
btrfs restore will help you copy data off a broken btrfs filesystem. See its page: Restore
btrfs check --repair, aka btrfsck is your last option if the ones above have not worked.
software/linux/btrfs.1478824727.txt.gz · Last modified: by superwizard
