0

I have a disk with LVM with two logical volumes media and root. The former is almost empty the latter is almost full, so I wanted to resize both.

The logical volume media is dm-crypt + BtrFS. In order to resize the filesystem, the LUKS container and the logical volume, I ran the following commands:

sudo btrfs filesystem resize 1T /mnt
sudo umount /mnt
sudo cryptsetup close /dev/mapper/luks-container
sudo lvresize --size 1T /dev/mapper/hdd-media

Now I cannot mount /dev/mapper/luks-container anymore. The relevant output is

[ 2853.075049] BTRFS info (device dm-2): disk space caching is enabled
[ 2853.075058] BTRFS info (device dm-2): has skinny extents
[ 2853.079920] BTRFS error (device dm-2): device total_bytes should be at most 1099494850560 but found 1099511627776
[ 2853.079926] BTRFS error (device dm-2): failed to read chunk tree: -22
[ 2853.081181] BTRFS error (device dm-2): open_ctree failed

So apparently, both 1T sizes differed slightly and the BrtFS would like to be bigger than it can. This is no problem at all, I could just shrink it a little more, but for that I would have to mount it, which is impossible.

How could I fix this situation? How could I shrink the BtrFS a bit further without being able to mount it?

1 Answers1

0

I found a workaround. Instead of shrinking an unmountable filesystem, I increased the size of the logical volume a bit.

sudo lvresize --size 1025G /dev/mapper/hdd-media

Note that I had to close the LUKS container in order to make the file system mountable for this.

Since this is only a workaround and not an answer to the question above, I will not accept it.