BTRFS: changing disk


I have another disk to replace the /dev/sdb disk.
The question is:
as the partition /dev/sdb1 is part of a btrfs volume/device on the old disk, extending the /dev/sda1 partition, should I, before removing the current disk, backup the datas somewhere and remove /dev/sda1 and /dev/sdb1 from the “volume/device” called /datas1 ?

After those manipulations I would create btrfs partitions on the new disk, and then add the /dev/sda1, /dev/sdb1 – from the new disk – to the “volume/device” called /datas1.

The order of the commands would be (without backups)

btrfs device remove /dev/sdb1 /datas1
fdisk /dev/sde (to create the different partitions including the one would become /dev/sdb1 once (this disk currently external) installed as internal after physically removing the /dev/sdb disk)
btrfs device add -f /dev/sdb1 /datas1

I suppose it will work.

From man btrfs-device:

   remove [options] <device>|<devid> <device>|<devid>...] <path> 
          Remove device(s) from a filesystem identified by <path> 

          Device removal must satisfy the profile constraints, otherwise the command fails. The filesystem must be converted to profile(s) that would allow the removal. This can typically happen when going down from 2  devices 
          to 1 and using the RAID1 profile. See the section TYPICAL USECASES. 

          The operation can take long as it needs to move all data from the device. 

         ** It is possible to delete the device that was used to mount the filesystem.** The device entry in the mount table will be replaced by another device name with the lowest device id. 

The file system survives. No restore from backup required (but you should have one anyway). Do the following:

  1. Create a partition (“device”) on the new drive, say /dev/sdc1; should be large enough to hold all data.
  2. Add device /dev/sdc1 to the existing file system: btrfs device add /dev/sdc1 /datas1
  3. Remove device /dev/sdb1: btrfs device remove /dev/sdb1 /datas1
  4. Remove device /dev/sda1: btrfs device remove /dev/sda1 /datas1

Now all data sit on device /dev/sdc1.

Thank you I should have finalized this afternoon…