Skip to contentSkip to conversation

Btrfs RAID1 File System Grew Something Extra

DISCUSSION Garry T. Williams 5 participants 6 messages Dec 18, 2013 – Dec 22, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

I have been using btrfs for my /home partition on my home machine for a few years now. I created the file system RAID1 using two disk partitions. Recently I noticed btrfs fi df shows extra Data, System, and Metadata allocations. And btrfs fi show indicates extra allocations on one of my disk drives accounting for the 20 MiB allocation in the df display.

I'm confused. What does this mean?

    garry@vfr$ sudo btrfs subvolume list /home
    garry@vfr$ sudo btrfs filesystem df /home
    Data, RAID1: total=32.00GiB, used=21.01GiB
--> Data, single: total=8.00MiB, used=0.00
    System, RAID1: total=8.00MiB, used=12.00KiB
--> System, single: total=4.00MiB, used=0.00
    Metadata, RAID1: total=15.00GiB, used=424.60MiB
--> Metadata, single: total=8.00MiB, used=0.00
    garry@vfr$ sudo btrfs filesystem show /home
    Label: none  uuid: 6c3aeff6-9a50-4481-a175-7b98980eb638
	    Total devices 2 FS bytes used 21.43GiB
-->         devid    1 size 373.76GiB used 47.03GiB path /dev/sda4
	    devid    2 size 373.76GiB used 47.01GiB path /dev/sdb4
    Btrfs v3.12
    garry@vfr$

If it matters, I create a snapshot each night and run a rsync backup to another drive and then delete the snapshot.

garry@vfr$ uname -r
3.11.10-200.fc19.x86_64
garry@vfr$ rpm -q btrfs-progs
btrfs-progs-3.12-1.fc19.x86_64
Signature · 1 line
Garry T. Williams
#1 lore raw

Garry,

this is a known bug in mkfs.btrfs, the workaround for now is to run balance on FS having some data. so that unused group- profile will go away.

HTH, Anand

Quoted 34 lines · Garry T. Williams

I have been using btrfs for my /home partition on my home machine for a few years now. I created the file system RAID1 using two disk partitions. Recently I noticed btrfs fi df shows extra Data, System, and Metadata allocations. And btrfs fi show indicates extra allocations on one of my disk drives accounting for the 20 MiB allocation in the df display.

I'm confused. What does this mean?

     garry@vfr$ sudo btrfs subvolume list /home
     garry@vfr$ sudo btrfs filesystem df /home
     Data, RAID1: total=32.00GiB, used=21.01GiB
--> Data, single: total=8.00MiB, used=0.00
     System, RAID1: total=8.00MiB, used=12.00KiB
--> System, single: total=4.00MiB, used=0.00
     Metadata, RAID1: total=15.00GiB, used=424.60MiB
--> Metadata, single: total=8.00MiB, used=0.00
     garry@vfr$ sudo btrfs filesystem show /home
     Label: none  uuid: 6c3aeff6-9a50-4481-a175-7b98980eb638
	    Total devices 2 FS bytes used 21.43GiB
-->         devid    1 size 373.76GiB used 47.03GiB path /dev/sda4
	    devid    2 size 373.76GiB used 47.01GiB path /dev/sdb4
     Btrfs v3.12
     garry@vfr$

If it matters, I create a snapshot each night and run a rsync backup to another drive and then delete the snapshot.

garry@vfr$ uname -r
3.11.10-200.fc19.x86_64
garry@vfr$ rpm -q btrfs-progs
btrfs-progs-3.12-1.fc19.x86_64
#2 lore raw
Quoted 11 lines · On 12-18-13 10:46:29 Anand Jain wrote:
Quoted 6 lines · Garry T. Williams

I have been using btrfs for my /home partition on my home machine for a few years now. I created the file system RAID1 using two disk partitions. Recently I noticed btrfs fi df shows extra Data, System, and Metadata allocations. And btrfs fi show indicates extra allocations on one of my disk drives accounting for the 20 MiB allocation in the df display.

this is a known bug in mkfs.btrfs, the workaround for now is to run balance on FS having some data. so that unused group- profile will go away.

Thanks.

    garry@vfr$ sudo btrfs balance start /home
    Done, had to relocate 50 out of 50 chunks
    garry@vfr$ sudo btrfs filesystem df /home
    Data, RAID1: total=22.00GiB, used=21.02GiB
    System, RAID1: total=32.00MiB, used=12.00KiB
    System, single: total=4.00MiB, used=0.00
    Metadata, RAID1: total=1.00GiB, used=419.60MiB

Hmmm.

Well, it's better, but the extra allocation for System is baffling. I believe that this happened sometime after creating the file system.

Also balance on a RAID1 file system with exactly two drives doesn't make much sense to me. Why would any "chunks" have to be relocated? I'm clearly missing something here.

Signature · 1 line
Garry T. Williams
#3 lore raw
Quoted 23 lines · Garry T. Williams
Quoted 11 lines · On 12-18-13 10:46:29 Anand Jain wrote:
Quoted 6 lines · Garry T. Williams

I have been using btrfs for my /home partition on my home machine for a few years now. I created the file system RAID1 using two disk partitions. Recently I noticed btrfs fi df shows extra Data, System, and Metadata allocations. And btrfs fi show indicates extra allocations on one of my disk drives accounting for the 20 MiB allocation in the df display.

this is a known bug in mkfs.btrfs, the workaround for now is to run balance on FS having some data. so that unused group- profile will go away.

Thanks.

    garry@vfr$ sudo btrfs balance start /home
    Done, had to relocate 50 out of 50 chunks
    garry@vfr$ sudo btrfs filesystem df /home
    Data, RAID1: total=22.00GiB, used=21.02GiB
    System, RAID1: total=32.00MiB, used=12.00KiB
    System, single: total=4.00MiB, used=0.00
    Metadata, RAID1: total=1.00GiB, used=419.60MiB
Quoted 4 lines

Hmmm.

Well, it's better, but the extra allocation for System is baffling. I believe that this happened sometime after creating the file system.

It won't be spontaneously created -- it'll have been there since
the beginning. The first system chunk is "special" and is skipped during balances, so it won't get cleaned up like this.

Quoted 3 lines

Also balance on a RAID1 file system with exactly two drives doesn't make much sense to me. Why would any "chunks" have to be relocated? I'm clearly missing something here.

That's what balance does -- it rewrites every single piece of data
on the filesystem. In this case, you could have used a filter to balance (and hence remove) only the single chunks:

btrfs balance start -mprofiles=single -dprofiles=single -sprofiles=single /mountpoint

Hugo.

Signature · 4 lines
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
   --- One of these days, I'll catch that man without a quotation, ---   
                        and he'll look undressed.                        
#4 lore raw
In reply to Garry T. Williams

Garry T. Williams posted on Tue, 17 Dec 2013 23:12:25 -0500 as excerpted:

Quoted 21 lines · On 12-18-13 10:46:29 Anand Jain wrote:
Quoted 9 lines · Garry T. Williams
Quoted 4 lines

I have been using btrfs for my /home partition on my home machine for a few years now. I created the file system RAID1 using two disk partitions. Recently I noticed btrfs fi df shows extra Data, System, and Metadata allocations.

this is a known bug in mkfs.btrfs, the workaround for now is to run balance on FS having some data. so that unused group- profile will go away.

Thanks.

    garry@vfr$ sudo btrfs balance start /home
    Done, had to relocate 50 out of 50 chunks
    garry@vfr$ sudo btrfs filesystem df /home
    Data, RAID1: total=22.00GiB, used=21.02GiB
    System, RAID1: total=32.00MiB, used=12.00KiB
    System, single: total=4.00MiB, used=0.00
    Metadata, RAID1: total=1.00GiB, used=419.60MiB
Quoted 4 lines

Hmmm.

Well, it's better, but the extra allocation for System is baffling. I believe that this happened sometime after creating the file system.

Keep in mind that btrfs remains under development, still improving old features and growing new ones as well as bugfixing (and of course unfortunately still adding new bugs with the new code occasionally, it comes with the development filesystem territory).

Having seen the same thing happen here, I think the extra allocations were there all the time, but simply weren't originally reported. After some improvements in btrfs fi df, it more accurately reported the empty chunk-stub relics of mkfs.btrfs where it didn't before, so they appeared to be new even if they'd been there all the time. But a balance normally does remove them.

Tho that doesn't explain why the balance didn't remove that 4 MiB single- mode system stub. It did on all my btrfs here. But I run gentoo and build/install gentoo's live-git btrfs-progs, and build/run the mainline development kernel from live-git as well, so I'm well into the 3.13-rcs by now, while you haven't even upgraded to 3.12 yet and are still on 3.11- stable series, which might account for that. Or perhaps another balance would kill the system-stub as well? I don't know.

Quoted 3 lines

Also balance on a RAID1 file system with exactly two drives doesn't make much sense to me. Why would any "chunks" have to be relocated? I'm clearly missing something here.

You haven't read up on how btrfs balance works at the wiki, have you? Which means you're probably missing other information that might be helpful in administering your btrfs as well. It'll likely be worth your while to spend some time reading the user documentation there (and to bookmark it for further reference, too =:^) :

https://btrfs.wiki.kernel.org/

For balance in particular, see:

https://btrfs.wiki.kernel.org/index.php/FAQ#What_does_.22balance.22_do.3F

Also of interest:

https://btrfs.wiki.kernel.org/index.php/Balance_Filters

Of course, the btrfs manpage is also useful.

Basically, unless you limit it with the -d/-m/-s switches and/or filters, balance blindly rewrites/relocates every chunk on the filesystem, cleaning up and if applicable converting between redundancy types as it does so. So all chunks are relocated/rewritten.

But the above documentation should also suggest trying this to see if it addresses that remaining single-mode system chunk stub:

btrfs balance start -fsconvert=raid1 /home

Especially if you're on spinning rust (not SSD), that should take quite a bit less time than a full balance as well, because you're only rebalancing the few MiB of system chunks, not the GiBs of data and metadata.

Hopefully that'll kill the single-mode system stub-chunk. If not, you've probably hit a bug and should report it as such, tho you might wish to try it with the latest 3.12 stable or 3.13-rc first, in case the bug has already been fixed.

Signature · 3 lines
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
#5 lore raw
Quoted 4 lines · Duncan

But the above documentation should also suggest trying this to see if it addresses that remaining single-mode system chunk stub:

btrfs balance start -fsconvert=raid1 /home

Cool man, that fixed it for me. :-)

Regards,
Kai