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)
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.
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.
I think we can mark this as WONTFIX
(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"
(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`
(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"
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.
https://github.com/kdave/btrfs-progs/issues/875 for updating the error message.