On Thu, Dec 31, 2020 at 1:58 PM Chris Murphy <lists(a)colorremedies.com> wrote:
And the other one:
btrfs device add /dev/sdXY /mnt/btrfs
btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/btrfs
It's not obvious that 'btrfs dev add' implies a few things:
- mkfs. It will write Btrfs super blocks on this device and zero the
areas that ordinarily get zero'd. If it detects anything it recognizes
like ext4, xfs, another btrfs, maybe mdadm super blocks (not sure) it
will refuse. You'll either need to wipefs the target partition, or use
the -f option when adding the device.
- filesystem resize. Adding a device grows the file system. Removing a
device shrinks it.
- conversion to raid1 will read all data, and write it back out as
raid1 chunks to each of the two devices per block group (i.e. one
block group becomes two chunks, one per device). One day we may have a
kind of optimization like replace and use a scrub to replicate the
data. But right now it will read from devid1 and then write out a new
pair of chunks to both devid1 and devid2. Mirroring on Btrfs is per
blockgroup, it's not mirroring an entire device.
- If you like the idea of doing a regular timed scrub, which reads all
the data on a Btrfs file system, and will report on any problems found
and whether they were fixed up: the 'btrfsmaintenance' package is in
Fedora repo. It contains a bunch of service units and timers for Btrfs
related things, all of them are disabled by default. You can configure
and enable the scrub timer to do a scrub once per month if you wish. I
do a scrub once per month lazy style (manually and when I remember to
do it). I don't do any other maintenance on any of my Btrfs file
systems (either manually or scheduled).
--
Chris Murphy