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...



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.

| improve this answer | |

Boot from a livecd and perform the check from there.

| improve this answer | |
  • Is that the ONLY way? – Dave Dec 10 '15 at 23:54
  • You need to run some operating system from RAM. Using a livecd is a very simple way to do that. – EEAA Dec 10 '15 at 23:55
  • 1
    It's a server, that's why I'm concerned. Thank you for the input :) – Dave Dec 10 '15 at 23:59
  • 1
    Is that the ONLY way? - Well if you had a spare filesystem, you could copy any essential files to perform the check to another filesystem, then do a piviot_root() to the new filesystem. Perform the check and pivot back. But if you don't know what this means, and your system isn't already setup for it, then doing this will almost certainly be an order of magnitude more complicated then using a livecd. – Zoredache Dec 11 '15 at 0:12
  • 1
    @Zoredache You're right on both counts. You can copy to a spare, but, IMO, it should be on a separate physical disk (e.g. current disk might be in "early fail" mode). Also, copying from a corrupted FS can make it more corrupt sometimes. Livecd is the way to go, and if I were OP, I'd take the server offline ASAP and boot the livecd ASAP. I've had to deal with massive corruption before (inc. replacing partially failing disks) and OP's situation is not one to be fooling around with – Craig Estey Dec 11 '15 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.