Re: fsck.btrfs

Hugo Mills
2012-12-22T14:27:33Z

On Sat, Dec 22, 2012 at 08:44:13AM -0500, Gene Czarcinski
wrote:
> I am new to btrfs and have begun exploring and testing it.  One of
> these tests is to install Fedora 18 into a btrfs volume only leaving
> /boot and swap on regular partitions.  BTW, this is on
> qemu/kvm/libvirt virtuals.
>
> I discovered an error was occurring during bootup because systemd
> was attempting to start fsck.btrfs and it was missing.
>
> 1. Would btrfsck be the appropriate program to run at bootup?  If it
> is, with what parameters?

   No, it''s not necessary to run an fs checker on every boot. You can
either turn off the checks in fstab, or symlink /sbin/fsck.btrfs to
/bin/true.

> 2.  Should there be a fsck.btrfs but it has not been written yet?
>
> 3. Does btrfs even need a "fsck.btrfs"?

   There is a need for checking/fixing tools, but not as much as with
many other filesystems. For example, btrfs will verify checksums on
read, and everything is checksummed (including metadata); blocks
failing the checksum can be corrected if there is another copy
available (e.g. RAID-1 or DUP, in the case of default metadata). Other
forms of minor corruption (missing backrefs, etc) are dealt with by
the kernel as it finds them.

   Some more serious forms of corruption are also dealt with by the
kernel -- for example, looking for earlier tree roots with the -o
recovery mount option, which should always be your first port of call
with an unmountable filesystem.

   That said, there''s things that the kernel code can''t cope
with
(extent tree corruption, loss of the chunk tree), and those should be
done off-line by btrfsck. We don''t have chunk tree rebuild capability
yet, but it was something that Chris was working on a while ago.

   So btrfsck should not be used unless you know that there''s
something fundamentally wrong and that btrfsck can fix it. It''s not a
generic "catch-all" thing like many other FS''s fsck tools.
With btrfs,
if it mounts, it''s probably OK.

> I get the distinct impression that "btrfs is not your
father''s
> filesystem" and thus need to be looked at very differently.

   Indeed. :)

   Hugo.

--
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ==  PGP
key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
  --- But people have always eaten people,  / what else is there to ---
         eat?  / If the Juju had meant us not to eat people / he
                     wouldn''t have made us of meat.