1

The excerpt from here: https://linuxhint.com/resize_a_btrfs_filesystem/

The Btrfs filesystem can be resized online (when the filesystem is mounted), but if you want to resize a partition that is added to a Btrfs filesystem, you will have to do it offline (when the filesystem is not mounted). You can grow/expand or shrink a Btrfs filesystem online and grow/expand or shrink a Btrfs partition offline.

What is the difference between a Btrfs filesystem and a Btrfs partition in this context?

What i believe is that the partition is just a space range on a disk, which is written in some partition table. And the filesystem is the data structure inside that space range. How does this fit in the context of Btrfs resizing in the mentioned article?

EDIT: what would be the reasons for rezising/shrinking a filesystem without shrinking its partition? Is it possible for two filesystems to be on the same partition? I want to online shrink Btrfs and create a new partition with the freed space, but this confuses me.

1 Answer 1

0

Yes, the partition is a set of blocks described by the partition table. You can’t touch it while the filesystem is mounted.

The btrfs filesystem is the structure which permits the organisation by file on one or multiple partition. You can manipulate it while it is mounted.

3
  • Could you elaborate more on what would be the reasons for rezising/shrinking a filesystem without shrinking its partition? Is it possible for two filesystems to be on the same partition? I want to online shrink Btrfs and create a new partition with the freed space, but this confuses me.
    – Lyubomir
    Oct 26, 2021 at 16:56
  • If you shrink a partition without having shrinked the filesystem you may have data loss. Then the way to shrink the partition is 1/ shrink the volume, 2/ shrink the partition. The code for shrinking the file system is in the Linux kernel, which explains why you need it mounted. This code is inside the Btrfs sub system which doesn’t deal with partition resizing. This code moves all the blocks which would be out of the partition if you decide to shrink the partition to the same size. Once done, you can unmount the filesystem, use your partition editor and shrink the partition. Oct 26, 2021 at 17:37
  • About different file systems on the same partition, you can’t, but you have the sub-volumes which are a kind of different file systems on the same partition. One advantage of different sub-volumes is the management of snapshot which is made separately per sub-volumes. Oct 26, 2021 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .