Bug 20932 - Can not resize btrfs partition
Summary: Can not resize btrfs partition
Status: RESOLVED OBSOLETE
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_btrfs@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-22 14:51 UTC by Christian Stadelmann
Modified: 2013-04-30 16:01 UTC (History)
1 user (show)

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


Attachments

Description Christian Stadelmann 2010-10-22 14:51:10 UTC
System: Ubuntu 10.10 64Bit Desktop with
Linux Kernel 2.6.35.22.23 (reported by apt)
btrfs-tools (debian package) version 0.19+20100601-3

parted -l returns (for /dev/sda ):
--------------------------------
Model: ATA OCZ-AGILITY2 (scsi)
Disk /dev/sda: 60,0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 4      32,3kB  98,7MB  98,7MB  primary   ext4         boot
 2      98,7MB  33,8GB  33,7GB  extended
 5      101MB   10,0GB  9921MB  logical   btrfs
 1      33,8GB  53,5GB  19,7GB  primary   ext4
---------------------------------
with /dev/sda4 mounted as /boot and /dev/sda5 mounted as /, I tried different ways to resize my btrfs partition but without success:

christian@PC-2:~$ sudo btrfs filesystem resize max /
Resize '/' of 'max'
ERROR: unable to resize '/'
christian@PC-2:~$ sudo btrfs filesystem resize +2g /
Resize '/' of '+2g'
ERROR: unable to resize '/'
christian@PC-2:~$ sudo btrfs filesystem resize +2m /
Resize '/' of '+2m'
ERROR: unable to resize '/'
christian@PC-2:~$ sudo btrfs filesystem resize +2k /
Resize '/' of '+2k'
ERROR: unable to resize '/'
christian@PC-2:~$

reducing size does not throw any errors but does not seem to change anything:
christian@PC-2:~$ sudo btrfs filesystem resize -1g /
Resize '/' of '-1g'
christian@PC-2:~$

but even after reboot parted shows the same partition size as before "resizing". The only strange thing is, "adding" this "removed" 1g of size once does not throw an error:
christian@PC-2:~$ sudo btrfs filesystem resize -1g /
Resize '/' of '-1g'
christian@PC-2:~$ sudo btrfs filesystem resize +1g /
Resize '/' of '+1g'
christian@PC-2:~$ sudo btrfs filesystem resize +1g /
Resize '/' of '+1g'
ERROR: unable to resize '/'
christian@PC-2:~$ 

why doesn't
btrfs filesystem resize max /
resize the btrfs partition so no more free space is left in the extended partition /dev/sda2 ?

Do you need more information to answer/solve this bug?
Comment 1 Christian Stadelmann 2010-10-22 15:15:33 UTC
using devids (as recommended here:
http://comments.gmane.org/gmane.comp.file-systems.btrfs/6859?set_lines=100000
) doesn't work for me. console output:

christian@PC-2:~$ sudo btrfs filesystem show
failed to read /dev/sr0
Label: none  uuid: 57ded06d-35f8-4486-b156-d1fe7d18229a
	Total devices 1 FS bytes used 6.63GB
	devid    1 size 9.24GB used 8.85GB path /dev/sda5

Btrfs Btrfs v0.19
christian@PC-2:~$ sudo btrfs filesystem resize 1:max /
Resize '/' of '1:max'
ERROR: unable to resize '/'
christian@PC-2:~$ 


This bug may be related with
http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg05737.html
Comment 2 Christian Stadelmann 2010-10-22 15:45:47 UTC
partition info from cfdisk:
-----------------------------
Partition Table for /dev/sda

               First       Last
 # Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
 4 Primary           0      192779     63      192780 Linux (83)           Boot
 2 Primary      192780    66027149      0    65834370 Extended (05)        None
 5 Logical      192780    19572735*  3828#   19379956*Linux (83)           None
   Logical    19572736*   66027149      0    46454414*Free Space           None
 1 Primary    66027150   104534954      0    38507805 Linux (83)           None
   Primary   104534955   117226304      0    12691350 Free Space           None
Comment 3 Josef Bacik 2013-04-30 16:01:40 UTC
Closing, if this is still affecting you on a newer kernel please reopen.

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