Dark's Code Dump

Possibly useful

Resizing BTRFS RAID 1 on LVM

Grow:

lvextend -L+100G /dev/hdd1/slash 
lvextend -L+100G /dev/hdd2/slash 
btrfs fi resize 1:max / 
btrfs fi resize 2:max / 

Shrink:

btrfs fi res 1:-20G / 
btrfs fi res 2:-20G / 
lvreduce -L-20G /dev/hdd1/slash 
lvreduce -L-20G /dev/hdd2/slash
  • This assumes each disk is an independent volume group as far as LVM is concerned. This is probably the only sane way to have BTRFS RAID on LVM anyway.
  • It is critically important to specify each device separately - i.e. 1: and then separately 2:. You must add more commands if you have more than 2 devices. The (terrible) default is to alter device 1 only.
  • I have verified that the units are equivalent - i.e. what btrfs calls 1G is exactly the same number of bytes as what lvreduce calls 1G.
  • btrfs fi res is synchronous, no need to wait between commands
  • All of this must (not just can, but must) be done online with the filesystem mounted

Leave a Reply