Bug 118111 - Resizing BTRFS Volumes smaller than 256MB is not possible
Summary: Resizing BTRFS Volumes smaller than 256MB is not possible
Status: RESOLVED WILL_NOT_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-12 08:38 UTC by Kai Wagner
Modified: 2024-08-19 13:54 UTC (History)
8 users (show)

See Also:
Kernel Version: 4.6
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Kai Wagner 2016-05-12 08:38:50 UTC
At the moment its not possible to resize a btrfs volume smaler than 256M.

Example:

Create a 100MB Volume and try to resize that volume to 200MB. Its not possible and you get the following useless error output: 

"ERROR: unable to resize '/media/test/' - Invalid argument"

The 256MB limit is hardcoded in the ioctl.c file in line 1584.

Option 1: Change this hardcoded limit 

My code fix idear:

OLD:

1584        if (new_size < SZ_256M) {
1585               ret = -EINVAL;
1586               goto out_free;
1587        }

NEW:

1584        if (new_size < old_size) {
1585               ret = -EINVAL;
1586               goto out_free;
1587        }


Option 2: Change the error message to something usefull like (Can't resize this volume because your volume is to small - minimum 256MB)
Comment 1 Cengiz Can 2016-05-22 22:13:10 UTC
Hello Kai,

Thank you for reporting this.

This has been brought to discussion in 2012 and 2014

http://comments.gmane.org/gmane.comp.file-systems.btrfs/36077
http://www.linuxquestions.org/questions/linux-general-1/minimum-partition-size-946423

I'm not 100% sure why there's a hardcoded limit but that error message needs an improvement as you stated.

I'll work on this.
Comment 2 Cengiz Can 2016-11-27 22:51:59 UTC
Hello again Kai, 

I'm quouting #btrfs on FreeNode:

"Since btrfs allocates space for data/metadata in quite large blocks (1GB is typical), these can be smaller on a small fs, but on a really small fs it involves hacks that would be tedious to undo when expanding the filesystem to an usable size, there's an assumption that a filesystem that tiny is used for a test or some other special purpose rather than for real data"

Thus, I think there're no plans to support btrfs volumes < 256MBs right now.
Comment 3 Cengiz Can 2016-11-27 22:58:28 UTC
I think we can mark this as WONTFIX
Comment 4 lakshmipathi 2017-01-08 20:55:35 UTC
(In reply to Cengiz Can from comment #3)
> I think we can mark this as WONTFIX

Cengiz Can, imo, this can be marked as 'fixed' instead of wontfix. assuming the error message is verbose now instead of "ERROR: unable to resize '/media/test/' - Invalid argument"
Comment 6 Cengiz Can 2017-04-26 11:31:53 UTC
(In reply to lakshmipathi from comment #4)
> (In reply to Cengiz Can from comment #3)
> > I think we can mark this as WONTFIX
> 
> Cengiz Can, imo, this can be marked as 'fixed' instead of wontfix. assuming
> the error message is verbose now instead of "ERROR: unable to resize
> '/media/test/' - Invalid argument"

Hello!

Can you point me to the new error message in source? 

http://lxr.free-electrons.com/source/fs/btrfs/ioctl.c#L1594 (4.10) seems to be still returning `-EINVAL`
Comment 7 lakshmipathi 2017-04-26 11:46:04 UTC
(In reply to Cengiz Can from comment #6)
> (In reply to lakshmipathi from comment #4)
> > (In reply to Cengiz Can from comment #3)
> > > I think we can mark this as WONTFIX
> > 
> > Cengiz Can, imo, this can be marked as 'fixed' instead of wontfix. assuming
> > the error message is verbose now instead of "ERROR: unable to resize
> > '/media/test/' - Invalid argument"
> 
> Hello!
> 
> Can you point me to the new error message in source? 
> 
> http://lxr.free-electrons.com/source/fs/btrfs/ioctl.c#L1594 (4.10) seems to
> be still returning `-EINVAL`

As I previously commented, this bug can marked as fixed (instead of marking it as wontfix) if(assuming) the error message is verbose like 'Can't resize this volume because your volume is to small - minimum 256MB' instead of "ERROR: unable to resize '/media/test/' - Invalid argument"
Comment 8 Tomasz Pala 2017-08-04 06:48:58 UTC
Or, if WONTFIX here, this (hint message) could be handled by btrfs-tools. Additionally mkfs.btrfs should tell the user creating such a small fs that it won't be expandable.
Comment 11 David Sterba 2024-08-19 13:54:22 UTC
https://github.com/kdave/btrfs-progs/issues/875 for updating the error message.

Note You need to log in before you can comment on or make changes to this bug.