As a short introduction I'm going to tell you, what kind of setup I have and what I want to achieve. After that I try to explain my problem. Since this is my first question on U&L I have to apologize for it being possibly strange. It's fairly long so maybe new users of BTRFS or Debian can benefit from my experiences or even use it as somewhat kind of a tutorial.
Basic hardware setup
I've got a mainboard and a CPU out of the Haswell generation with some RAM and two SSD.
(Note: To make a proper diagnosis I got nothing more connected together except these parts. If you need further information about these parts please feel free to ask for more details.)
I want to install Debian Jessie onto both SSD with BTRFS in mode RAID 1 mirroring both drives, so that if one fails I can still continue with the other in a degraded mode.
What I achieved yet
Since Jessie is the testing at the moment, I started a clean install with its predecessor Wheezy because I got problems with installation of the testing branch in the past. During the install I partitioned the first drive (say A) manually the following way:
- only one single partition (containing all future mount points using all available space on the drive),
- formatting in BTRFS and
- leaving the swap partition.
The installation succeeded on A as expected and after that I upgraded to Jessie (by editing
/etc/apt/sources.list and doing
apt-get update && dist-upgrade. I performed a reboot. It showed well having Kernel 3.14-2-amd64 now.
After that I started preparing the other drive (say B). I copied the partition table of A with
sfdisk -d /dev/sda > /tmp/sda.pt and dumped it back to B with
sfdisk /dev/sdb < /tmp/sda.pt.
So now I was ready to add the device and perform the conversion to a RAID 1 with the following commands:
mount /dev/sda1 /mnt btrfs device add /dev/sdb1 /mnt btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt
Until here everything succeeded as I see a RAID 1 with
btrfs filesystem show containing
/dev/sda1 alias A and
/dev/sdb1 alias B. Additionally
blkid lists both drives with having same UUID and different UUID_SUB.
I left the mount points in
/etc/fstab almost untouched by only adding some mount options relevant to the SSD:
UUID=01234567-89ab-cdef-0123-456789abcdef / btrfs defaults,noatime,nodiratime,discard 0 1
After a restart the system booted into the OS fully. The above commands
btrfs filesystem show and
blkid still show the same results. RAID 1 seems to be running.
My problem and my questions
Before a cold start of the system I unplugged B (simulating a full device error), so that only A was available and thought of BTRFS still starting up in degraded mode. But that's not the case. I'm getting errors of initramfs being not able to find the device.
Is that the expected behaviour of BTRFS or is something wrong with my initramfs? (Maybe it's the way BTRFS is telling me one drive got destroyed while being offline.)
a. Is it or is it not possible to start-up with only one drive A, plugin (hot-swap) a new drive C and resync online?
b. On btrfs.wiki.kernel.org it's mentioned to first mount a failed device in degraded mode and then add the new one. Is that the only way?
(Remark to myself: I will test plugging in another naked device C and look what happens. Maybe I can answer these questions by myself after working through a german source on wiki.ubuntuusers.de.)
How do I make drive B become also bootable (just in case the drive A is destroyed)? Is
/bootsynchronized? Do I only need to install GRUB onto device B with
grub-install /dev/sdbor do I have to do something more?
Is it useful to use the mount option
ssdin fstab, because it seems like it's not as btrfs.wiki.kernel.org states it is enabled automatically? To me it seems like it's only necessary if the OS can't detect the SSD properly.