I have a 2 disk btrfs RAID1.
One disk is sda/cr_ata-ST8000VN004-3CP101_WWZ7KJ9J
The second disk is sdb/raid2
The third and damaged one is sde/raid1
I used yast partitioner to partition the new drive raw but with encryption, both disk in the RAID1 are encrypted.
I followed this: https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices.html#Replacing_failed_devices
After inputting the sudo btrfs replace start 1 /dev/mapper/cr_ata-ST8000VN004-3CP101_WWZ7KJ9J /mnt/raid
btrfs complains there is a partition already and to use the -f flag to overwrite. And so I did. It finished witouth errors but I had to rebalance to convert chunks to RAID1. That went well too.
I unmounted and remounted, no problem. I edited my crypttab to change the UUID of the old drive to the new drive. Fstab has the btrfs UUID that didn’t change.
Now, when I reboot, the system idles waiting for the OLD drive by UUID to mount. So I put it back online via dock to boot, and now the system complains it can’t mount, so I continue and now after putting sudo btrfs filesystem show
WARNING: adding device /dev/mapper/raid1 gen 43963 but found an existing device /dev/mapper/cr_ata-ST8000VN004-3CP101_WWZ7KJ9J gen 44318
ERROR: cannot scan /dev/mapper/raid1: File exists
What did I do wrong or how can I replace my failing hard drive but also keep encryption and preferably keeping the name “raid1” instead of “cr_ata-ST8000VN004-3CP101_WWZ7KJ9J” ?
With the length of your initial post, I knew my opine on your issue(s) would be taken out of context, so I thought resources on the subject might help. My bad! I still believe others out there have addressed your problem/confusion much better than I could. Good Luck!
When starting up, the system idles with a message like: waiting for diskbyUUID… and unless I reconnect the OLD, DAMAGED drive, it won’t continue booting.
I formatted the new sda drive without a filesystem but with LUKS2 enabled.
As you see, this output does not show any UUID so it would have been useless for comparing with the message anyway. But it shows 4 LUKS devices and your /etc/crypttab shows only 3 lines. Next wild guess - initrd contains /etc/crypttab with no more existing device (which also explains how it gets activated to start with).
If I follow your story correctly, this is the removed device (or, better, the LUKS container for the removed device). Then unplug it and rebuild initrd.
I find it rather surprising that you could set up a BtrFS RAID1 with encrypted disks, but still being not aware that a normal user is not allowed to change the system configuration. Having to use root protects the system from bad software and from user mistakes. Learn to like it!