linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Resize a btrfs File System : no enough free space... why ?!?
@ 2016-10-01  8:42 Nicolas Pujol
  2016-10-01 11:04 ` Duncan
  2016-10-01 19:57 ` Chris Murphy
  0 siblings, 2 replies; 4+ messages in thread
From: Nicolas Pujol @ 2016-10-01  8:42 UTC (permalink / raw)
  To: linux-btrfs

Dears,

I added a news disk to my RAID5 array so I now have 4 * 2Tio disks,
with an +/-6Tio available capacity. On the RAID I have only one LVM
volume to manage all this space :
$ lvdisplay
  --- Logical volume ---
  LV Path                /dev/VG1/Vol3
  LV Name                Vol3
  VG Name                VG1
  LV UUID                dEGmTz-Fj0Z-qbOf-xn67-D5D8-5BNY-EwCsoF
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 1
  LV Size                5,46 TiB
  Current LE             1430795
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

After increased the RAID, then the LVM, I resize the BTRFS :
$ btrfs filesystem resize 1:max /mnt/RAID

Now I have 5,5T available:
# df -h /mnt/RAID
Sys. de fichiers     Taille Utilisé Dispo Uti% Monté sur
/dev/mapper/VG1-Vol3   5,5T    3,5T  1,9T  66% /mnt/RAID

# btrfs fi show
Label: none  uuid: 8dbd4ab0-e3d9-417d-b69b-dfdb51475e7e
    Total devices 1 FS bytes used 43.70GiB
    devid    1 size 100.00GiB used 79.04GiB path /dev/sdc3

Label: none  uuid: b8fd880f-fa7f-4f8b-bf40-1619e4931207
    Total devices 1 FS bytes used 3.46TiB
    devid    1 size 5.46TiB used 3.61TiB path /dev/mapper/VG1-Vol3

# btrfs fi df /mnt/RAID
Data, single: total=3.48TiB, used=3.46TiB
System, DUP: total=8.00MiB, used=416.00KiB
System, single: total=4.00MiB, used=0.00B
Metadata, DUP: total=69.62GiB, used=5.86GiB
Metadata, single: total=8.00MiB, used=0.00B
GlobalReserve, single: total=512.00MiB, used=0.00B

Unfortunately, I want to change the RAID chunk size because it is only
4K so I have to update the size of BTRFS before. Now, array size is
5860537608 so I want to reduce to 5860537344k :
$ btrfs filesystem resize 1:5860537344k /mnt/RAID
Resize '/mnt/RAID' of '1:5860537344k'
ERROR: unable to resize '/mnt/RAID': no enough free space

I tried severals tips but without any success:
# btrfs balance start -v -dusage=0 /mnt/RAID
# btrfs balance start -v -dusage=5 /mnt/RAID
# btrfs filesystem defragment /mnt/RAID

Like I don't understand the error, do you know why I can not resize
the BTRFS partition while 2TB are free?

For information:
# uname -a
Linux PC-NPL 4.6.4-1-ARCH #1 SMP PREEMPT Mon Jul 11 19:12:32 CEST 2016
x86_64 GNU/Linux

# btrfs --version
btrfs-progs v4.6.1

# mdadm --detail /dev/md127
/dev/md127:
        Version : 1.2
  Creation Time : Thu Jun 16 21:32:53 2011
     Raid Level : raid5
     Array Size : 5860537608 (5589.04 GiB 6001.19 GB)
  Used Dev Size : 1953512536 (1863.01 GiB 2000.40 GB)
   Raid Devices : 4
  Total Devices : 4
    Persistence : Superblock is persistent

    Update Time : Sat Oct  1 09:45:38 2016
          State : clean
 Active Devices : 4
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 0

         Layout : parity-last
     Chunk Size : 4K

           Name : PC-NPL.localdomain:0
           UUID : f225928d:d977588a:058808df:cc6c53ca
         Events : 989508

    Number   Major   Minor   RaidDevice State
       1       8       49        0      active sync   /dev/sdd1
       4       8       65        1      active sync   /dev/sde1
       3       8        1        2      active sync   /dev/sda1
       5       8       17        3      active sync   /dev/sdb1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Resize a btrfs File System : no enough free space... why ?!?
  2016-10-01  8:42 Resize a btrfs File System : no enough free space... why ?!? Nicolas Pujol
@ 2016-10-01 11:04 ` Duncan
  2016-10-01 19:57 ` Chris Murphy
  1 sibling, 0 replies; 4+ messages in thread
From: Duncan @ 2016-10-01 11:04 UTC (permalink / raw)
  To: linux-btrfs

Nicolas Pujol posted on Sat, 01 Oct 2016 10:42:32 +0200 as excerpted:

> Like I don't understand the error, do you know why I can not resize the
> BTRFS partition while 2TB are free?
> 
> For information:
> # uname -a Linux PC-NPL 4.6.4-1-ARCH #1 SMP PREEMPT Mon Jul 11 19:12:32
> CEST 2016 x86_64 GNU/Linux

You might try 4.7 or the very close 4.8 or its last rc.  Some ENOSPC fix 
patches went in recently and may well fix your problem.  I know they're 
in mainline now, but IDR whether it made 4.7 or not.

Hopefully that eliminates your problem; they've been reported to do it 
for others running into ENOSPC issues. =:^)

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Resize a btrfs File System : no enough free space... why ?!?
  2016-10-01  8:42 Resize a btrfs File System : no enough free space... why ?!? Nicolas Pujol
  2016-10-01 11:04 ` Duncan
@ 2016-10-01 19:57 ` Chris Murphy
  2016-10-01 22:32   ` Nicolas Pujol
  1 sibling, 1 reply; 4+ messages in thread
From: Chris Murphy @ 2016-10-01 19:57 UTC (permalink / raw)
  To: Nicolas Pujol; +Cc: Btrfs BTRFS

On Sat, Oct 1, 2016 at 2:42 AM, Nicolas Pujol <nicolas.pujol@gmail.com> wrote:

> Unfortunately, I want to change the RAID chunk size because it is only
> 4K so I have to update the size of BTRFS before. Now, array size is
> 5860537608 so I want to reduce to 5860537344k :
> $ btrfs filesystem resize 1:5860537344k /mnt/RAID
> Resize '/mnt/RAID' of '1:5860537344k'
> ERROR: unable to resize '/mnt/RAID': no enough free space

Try
btrfs fi resize -1m /mnt/RAID

If that fails also try something bigger maybe -100m

If that fails also...

# btrfs fi df /mnt/RAID
Data, single: total=3.48TiB, used=3.46TiB
System, DUP: total=8.00MiB, used=416.00KiB
System, single: total=4.00MiB, used=0.00B
Metadata, DUP: total=69.62GiB, used=5.86GiB
Metadata, single: total=8.00MiB, used=0.00B
GlobalReserve, single: total=512.00MiB, used=0.00B


Maybe try to get rid of these unused single block groups for system
and metadata:

btrfs balance start -mconvert=dup,soft

And try resize again. If it still doesn't work:

btrfs balance start -musage=25

You've got 70GiB worth of allocation for metadata, but only 6GiB is
being used, so maybe get rid of that unused portion with a partial
balance. Then try again.

I'd do only one change at a time, and see at which point it
(hopefully) works. Because none of these things should be needed, but
then if they are, the error message needs to be cleared up. So I'm
kinda setting you up to collect enough information to file a bug.




-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Resize a btrfs File System : no enough free space... why ?!?
  2016-10-01 19:57 ` Chris Murphy
@ 2016-10-01 22:32   ` Nicolas Pujol
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Pujol @ 2016-10-01 22:32 UTC (permalink / raw)
  To: Chris Murphy; +Cc: Btrfs BTRFS

Hi, Thank you for your help.

I tried all the commands, but without success so I check again the
disk size. Unfortunately I made a mistake :-/
# lvdisplay --units=k
--- Logical volume ---
  LV Path                /dev/VG1/Vol3
  LV Size                5860536320,00 KiB

So when I use this command that's was too big:
# btrfs filesystem resize 1:5860537344k /mnt/RAID
Resize '/mnt/RAID' of '1:5860537344k'
ERROR: unable to resize '/mnt/RAID': no enough free space

I success to resize with this command to be also accepted with an 128k
mdadm chunk :
# btrfs filesystem resize 1:5860196352k /mnt/RAID

Now everything is working so I'm sorry for this mistake.

Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-01 22:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-01  8:42 Resize a btrfs File System : no enough free space... why ?!? Nicolas Pujol
2016-10-01 11:04 ` Duncan
2016-10-01 19:57 ` Chris Murphy
2016-10-01 22:32   ` Nicolas Pujol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).