btrfs-progs icon indicating copy to clipboard operation
btrfs-progs copied to clipboard

`btrfs filesystem resize` should work on unmounted filesystem

Open MaxG87 opened this issue 3 years ago • 3 comments

The entire episode was completely unrelated to the device of my other ticket, #541 .

Some time ago I wanted to change partitioning of my hard drives. This included that I had to change the sizes of my BtrFS partition, the LUKS container and some LVM too. Anyhow, I got the sizes wrong and made the LVM a tiny bit smaller than the BtrFS partition. Think of 512Gi vs 512G. Please note that the BtrFS was not full. It had plenty of unused space.

Due to the size mismatch, I was unable to mount the BtrFS, because it detected that its partition was smaller than the FS size itself. Because I was unable to mount, I was unable to shrink the filesystem. Because I was unable to shrink it, I was unable to mount it. etc.

In the end I had to shrink the neighbouring LVM partition and increase the LVM of the BtrFS. If there had not been a second LVM, I could have lost my entire partition.

I think that btrfs filesystem resize should be able to resize unmounted filesystems to avoid the problems described above.

MaxG87 avatar Nov 10 '22 19:11 MaxG87

I found that there is btrfs rescue which seems to be able to do the same thing. I am not sure whether I overlooked it when I had that issue or whether it is something new.

If indeed btrfs rescue is the tool to use here, this ticket could be closed. Maybe it could be mentioned in the documentation, e.g. here, though.

MaxG87 avatar Nov 18 '22 11:11 MaxG87

Partial offline resize has been implemented as #1007.

kdave avatar Sep 12 '25 04:09 kdave

It is great to see some progress here! Thank you very much.

The problem at hand wouldn't profit from that, though. The feature allows to increase a filesystem, while here it was too big already.

MaxG87 avatar Sep 14 '25 15:09 MaxG87