How to btrfs check a root partition

I'm sure the reason I'm having a brain fart is because it's late, but how can I go about performing a btrfs check on the root partition?

The device needs to be unmounted, which can't happen because it's the root partition...

Thanks


Solution 1:

If you're using systemd, you can pass the kernel parameter fsck.mode=force to check all filesystems. This will repair all "safe" errors.

If you still have issues (check your logs), pass fsck.repair=yes in addition to the above, which will attempt to repair everything.

For the source of this and other options (eg shutdown -F) for upstart and sysvinit init, see here.

Solution 2:

Boot from a livecd and perform the check from there.