How to extend btrfs partition

I have a virtual machine with openSUSE where I want extend /dev/sda2 partition which is 10 GB to 20 GB.

Here is output of “fdisk -l” :

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00014a8e

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 3051519 3049472 1.5G 82 Linux swap / Solaris
/dev/sda2 * 3051520 24033279 20981760 10G 83 Linux
/dev/sda3 24033280 31457279 7424000 3.6G 83 Linux

Here is output of “btrfs filesystem show”:
Label: none uuid: 7cb7d036-47d2-4b06-a592-fbdc40da6ef5
Total devices 1 FS bytes used 8.12GiB
devid 1 size 10.00GiB used 10.00GiB path /dev/sda2

Here is a command I am trying in order to extend “btrfs filesystem resize max /dev/sda2” and here is it’s output:
ERROR: resize works on mounted filesystems and accepts only
directories as argument. Passing file containing a btrfs image
would resize the underlying filesystem instead of the image.

Could anybody suggest me what I am doing wrong?

You do understand that you can not make a partition bigger with out space to expand it into??? Partitions use continues space on a drive. Also Generally you have to change the partition size before you can change the file system size.

Sure, I do understand. The size of the disk is 20 GB, there are 10 GB of free space.

That is exactly what I need, to change /dev/sda2 partition size, to extend it to 20 GB…

But sd3 is in the way. it has to be continues space. First move sd3 then expand sd2 and then increase file system to fill

Got it, will google how to do it.

If you want to use btrfs 20 GB is not enough space for a / (root) partition.
Together with the subvolumes you’ll need 50 GB -> for / (root) or higher. I’m using 90 GB to 100 GB.

You can use BTRFS but need to turn snapper off or greatly reduce the number of snapshots kept

Without complete info impossible to provide advice

Virtualization technology (KVM, Xen, Virtualbox, VMware, etc)
Virtual disk format (vdi, vhd, vmdsk, raw, qcow, etc)

And, because this is specifically about virtualization disks, this post belongs in the Virtualization forum… and you may even find other prior posts on this topic in that Forum.


I beg to disagree with that statement. It has nothing to do with the subvolumes, as they are excluded from the snapshot of the root partition. It’s the overuse of snapshots that tends to unnecessarily and quickly fill up the partition.

My Tumbleweed partition wrt used space hasn’t exceeded 20GB, mainly due to configuring-out hourly “timeline snapshots” completely, and reducing the retention of the “numbered” snapshot pairs generated for YaST/zypper changes. On Tumbleweed those package upgrades are regular and significant in size. Originally I only put it on 35GB Btrfs partition to cope with the massive “zypper dup” when re-basing on new distribution releases (no longer happens with TW) with plenty to spare.

In a VM I ran 13.2/KDE4 with btrfs and Snapper on a 10GB VDI for testing. No Timeline snaphots, and retaining just four to six Numbered snapshots, makes it doable along with manually running snapper deletions as and when required. That VM is now easily running Leap 42.1 Beta1/Xfce with Btrfs and Snapper for testing. Yes, it’s extreme but sufficient for the job.

I would argue strongly that the average desktop user doesn’t need to retain many snapshots, assuming they want to use Snapper with Btrfs for recovery in the first place. :wink:

Virtualization technology: VMware Player
Virtual disk format: vmdk

I’ll will look at virtualization forum