On Fri, Nov 10, 2023 at 09:13:07PM -0500, Jude DaShiell wrote:
I've got a corrupted btrfs partition. Does the archlinux install disk have btrfsck on it? If yes, I'll probably need to run btrfs --repair /dev/sda2 on the system. If repair goes badly, I'll have to reinstall the system.
Hi, Jude. The arch iso does indeed have btrfs-progs, but running a --repair is not always the correct course of action for a broken btrfs mount. For certain issues, it can make things worse. I would suggest asking for advice on the btrfs kernel mailing list: linux-btrfs@vger.kernel.org You should give the exact error messages / dmesg output you get when attempting to mount the btrfs partition.
I would like to know how to prevent btrfs corruption in the first place.
Generally speaking, btrfs is fairly robust against corruption. There are a few things that it is more sensitive to than other filesystems, however. Faulty RAM can cause metadata corruptions that render a btrfs filesystem unmountable. It's often advised to do a memtest on your system if you get unexpected filesystem errors. Cheap storage media that lies about FLUSH command completions is very likely to corrupt btrfs in the event of a system crash or unexpected poweroff. And the parity raid modes (raid 5 / 6) are still considered experimental and cannot be relied upon for repairing corrupted data. --Sean