0

A lot of guides on how to mount a btrfs filesystem say you can use any device in the filesystem to mount.

Ex: if a filesystem has sda1, sdb1, and sdc1 in it, you can mount using any of those devices.

But if sda1 fails, and that was what is in the /etc/fstab file to be mounted, what would happen? I assume it would fail. So how would I ensure the btrfs filesystem is mounted even if a device has failed?

cclloyd
  • 882

1 Answers1

0

Do not use sda1 or such in fstab. Use UUID=.

In case of Btrfs, each device being a part of the same filesystem will report the same UUID. You can confirm this by querying all the relevant devices with blkid. Also btrfs filesystem show will show you that a single filesystem uses a single UUID, no matter how many devices are involved.

Btrfs uses this UUID to identify devices that belong to the same filesystem. It uses it even if you mount by specifying /dev/sda1 or so. That's why cloning with dd or similar tools is problematic.

But even if you specify UUID= in fstab and one of the devices is missing, the filesystem won't mount. You need the degraded option to mount such filesystem (if possible). Specifying degraded in fstab (and/or in Grub config) is possible and you may want it in a remote server, so in case of trouble the system still boots, continues to operate, admins can access remotely and try to fix. But if you have physical access to the machine, consider not specifying degraded in fstab. I would prefer my local computer not to mount a problematic filesystem (and therefore to raise my attention) than to mount automatically in a degraded mode and risk I overlook the problem.