I was out of disk space so I cleaned up my old snapshots like I usually do. This time,
df -h / insisted on showing "no space available" while
btrfs fi df / shows a couple of GB's of space, so I decided to run a
btrfs balance failed due to "not enough space" errors, I searched the net and directed to this blog post which advises to workaround this problem by temporarily adding a small device (even a USB pendrive) to be able to run
btrfs balance, then remove it when done.
I added my pendrive to my rootfs:
btrfs dev add /dev/sdc1 /
No errors shown and now I had some free space. I run
btrfs balance and when it's finished, I tried to remove the pendrive:
sudo btrfs dev del /dev/sdc1 / ERROR: error removing device '/dev/sdc1': unable to go below two devices on raid1
BTRFS somehow decided to use the drive in RAID1 profile for Metadata and System data:
$ sudo btrfs fi usage / Overall: Device size: 864.53GiB Device allocated: 857.05GiB Device unallocated: 7.48GiB Device missing: 0.00B Used: 830.28GiB Free (estimated): 24.93GiB (min: 21.23GiB) Data ratio: 1.00 Metadata ratio: 2.00 Global reserve: 512.00MiB (used: 0.00B) Data,single: Size:828.01GiB, Used:810.56GiB /dev/mapper/masa-root 828.01GiB Data,RAID1: Size:2.02GiB, Used:2.01GiB /dev/mapper/masa-root 2.02GiB /dev/sdc1 2.02GiB Data,DUP: Size:2.00GiB, Used:1.94GiB /dev/sdc1 4.00GiB Metadata,RAID1: Size:2.97GiB, Used:131.61MiB /dev/mapper/masa-root 2.97GiB /dev/sdc1 2.97GiB Metadata,DUP: Size:7.50GiB, Used:5.78GiB /dev/mapper/masa-root 15.01GiB System,RAID1: Size:32.00MiB, Used:128.00KiB /dev/mapper/masa-root 32.00MiB /dev/sdc1 32.00MiB Unallocated: /dev/mapper/masa-root 1.97GiB /dev/sdc1 5.51GiB
How can I properly remove this temporary device?