18

Following derobert's trick to resize the underlying filesystem when resizing a LVM volume:

lvm> lvextend -r -l +100%FREE /dev/VolGroup00/lvolhome
fsck from util-linux 2.25.2
/sbin/fsck.btrfs: BTRFS file system.
  Size of logical volume VolGroup00/lvolhome changed from 3.04 GiB (777 extents) to 14.94 GiB (3824 extents).
  Logical volume lvolhome successfully resized
fsadm: Filesystem "btrfs" on device "/dev/mapper/VolGroup00-lvolhome" is not supported by this tool
  fsadm failed: 1

The "problem" is that fsadm tool doesn't support btrfs resizing. Dispirited, I decided to do it the hard way (aka manually):

sudo btrfs filesystem resize max /dev/mapper/VolGroup00-lvolhome
ERROR: can't access '/dev/mapper/VolGroup00-lvolhome'

Well, btrfs can't "access" the device, but it can detect it:

> sudo btrfs filesystem show 
Label: none  uuid: 53330630-9670-4110-8f04-5a39bfa86478
    Total devices 1 FS bytes used 2.75GiB
    devid    1 size 3.04GiB used 3.03GiB path /dev/mapper/VolGroup00-lvolhome

So, what gives? How to resize my btrfs partition inside the logical volume?

Braiam
  • 35,991

2 Answers2

20

Well, that was embarrassing. BTRFS needs to be mounted to be able to resize the partition.

How do I resize a partition? (shrink/grow)

In order to demonstrate and test the back references, Btrfs devel team has added an online resizer, which can both grow and shrink the filesystem via the btrfs commands.

First, ensure that your filesystem is mounted.

So, it doesn't matter that I was using a LVM volume, as long as it was mounted.

Braiam
  • 35,991
13

BTRFS takes filesystem mount point as an argument, not a device path.

In other words, intead of this:

btrfs filesystem resize max /dev/vg/lvhome

You should use actual path where the said volume was mounted:

btrfs filesystem resize max /home
sanmai
  • 1,426