10

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?

  • 1
    does it work with the mountpoint instead of device name? – frostschutz Dec 22 '14 at 19:07
  • 1
    yes, it's supposed to be the path to the btrfs mount (not the path to a block device). Also, you may need to specify a devid (from btrfs fi show) if you have more than one device in the fs. – derobert Dec 22 '14 at 19:09
  • @frostschutz yes, it does. Curious. – Braiam Dec 22 '14 at 19:11
11

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.

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.