Confusing output of btrfs fi df
Hello
Yesterday I created a btrfs-filesystem on two disk, using raid1 for data and metadata. I then mounted it and rsynced several TB of data onto it.
mkfs.btrfs -m raid1 -d raid1 /dev/sdf /dev/sdg
The command btrfs fi df /mnt/btrfs result in the following output:
Data, RAID1: total=2.64TiB, used=2.22TiB
Data, single: total=8.00MiB, used=0.00
System, RAID1: total=8.00MiB, used=380.00KiB
System, single: total=4.00MiB, used=0.00
Metadata, RAID1: total=4.00GiB, used=2.94GiB
Metadata, single: total=8.00MiB, used=0.00
I am a bit confused because of the "single"-entries. They are not shown in the UseCases-example on the btrfs-website and I wonder if I did something wrong.
I also would like to know if its possible to label a multi-disk filesystem after creation.
For your information, I am using Btrfs v3.12+20131125 and kernel 3.11.10-7 64bit. My distribution is an openSUSE 13.1.
Yours
Stefan
Quoted 17 lines · Stefan Malte Schumacher
Hello
Yesterday I created a btrfs-filesystem on two disk, using raid1 for data and metadata. I then mounted it and rsynced several TB of data onto it.
mkfs.btrfs -m raid1 -d raid1
/dev/sdf/dev/sdgThe command btrfs fi df
/mnt/btrfsresult in the following output:Data, RAID1: total=2.64TiB, used=2.22TiB
Data, single: total=8.00MiB, used=0.00
System, RAID1: total=8.00MiB, used=380.00KiB
System, single: total=4.00MiB, used=0.00
Metadata, RAID1: total=4.00GiB, used=2.94GiB
Metadata, single: total=8.00MiB, used=0.00
Quoted 3 lines
I am a bit confused because of the "single"-entries. They are not shown in the UseCases-example on the btrfs-website and I wonder if I did something wrong.
They're harmless -- it's a side-effect of the way that mkfs works.
They'll go away if you balance them:
btrfs balance start -dprofiles=single -mprofiles=single -sprofiles=single /mountpoint
Quoted 2 lines
I also would like to know if its possible to label a multi-disk filesystem after creation.
btrfs fi label should do this.
Quoted 2 lines
For your information, I am using Btrfs v3.12+20131125 and kernel 3.11.10-7 64bit. My distribution is an openSUSE 13.1.
You might want to look at upgrading to 3.13 or 3.14 kernel, which
has 6 months or so extra bug fixes in it.
Hugo.
Signature · 3 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
--- Keming (n.) The result of poor kerning --- Quoted 5 lines
They're harmless -- it's a side-effect of the way that mkfs works.
They'll go away if you balance them:btrfs balance start -dprofiles=single -mprofiles=single -sprofiles=single /mountpoint
btrfs refused this command, I had to pass --force to execute it. It exited with this:Done, had to relocate 2 out of 2710 chunks.
After that btrfs fi df shows the following:
Data, RAID1: total=2.64TiB, used=2.22TiB
System, RAID1: total=8.00MiB, used=380.00KiB
Quoted 1 line
System, single: total=4.00MiB, used=0.00<
Metadata, RAID1: total=4.00GiB, used=2.94GiB
Quoted 1 line
btrfs fi label should do this.
I was mainly asking because of this:
https://btrfs.wiki.kernel.org/index.php/UseCases: You can also use btrfs command.There are currently few limitations: the filesystem has to be unmounted the filesystem should not have more than one device
Is this information outdated?
Quoted 2 lines
You might want to look at upgrading to 3.13 or 3.14 kernel, which has 6 months or so extra bug fixes in it.
Thanks, going to have a look if openSUSE has anything more recent in their repositories.
Bye
Stefan
Quoted 9 lines · Stefan Malte Schumacher
Quoted 5 lines
They're harmless -- it's a side-effect of the way that mkfs works.
They'll go away if you balance them:btrfs balance start -dprofiles=single -mprofiles=single -sprofiles=single /mountpoint
btrfs refused this command, I had to pass --force to execute it. It exited with this:Done, had to relocate 2 out of 2710 chunks.
Quoted 6 lines
After that btrfs fi df shows the following:
Data, RAID1: total=2.64TiB, used=2.22TiB
System, RAID1: total=8.00MiB, used=380.00KiBQuoted 1 line
System, single: total=4.00MiB, used=0.00<
Metadata, RAID1: total=4.00GiB, used=2.94GiB
Hmm, seems like a bug. What about
btrfs balance start -sconvert=raid1,soft -f -v
Quoted 10 lines
Quoted 3 lines
btrfs fi label should do this.
I was mainly asking because of this:
https://btrfs.wiki.kernel.org/index.php/UseCases: You can also use btrfs command.There are currently few limitations: the filesystem has to be unmounted the filesystem should not have more than one deviceIs this information outdated?
btfs fi label is done when the system is mounted; for the change to visibly take effect in /dev/ it has to be umounted then mounted. I don't even think it takes effect with a remount, but I could be mistaken. This seems to be a btrfs limitation, if I relabel ext4 volumes while mounted, their label is changed immediately, so the behavior may change down the road.
Chris Murphy
Chris Murphy posted on Sat, 26 Apr 2014 15:28:03 -0600 as excerpted:
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
btrfs balance start -dprofiles=single -mprofiles=single
-sprofiles=single /mountpointAfter that btrfs fi df shows the following:
Quoted 8 lines
Quoted 4 lines
Data, RAID1: total=2.64TiB, used=2.22TiB
System, RAID1: total=8.00MiB, used=380.00KiBQuoted 1 line
System, single: total=4.00MiB, used=0.00 <
Metadata, RAID1: total=4.00GiB, used=2.94GiB
Hmm, seems like a bug. What about
btrfs balance start -sconvert=raid1,soft -f -v
... Or simply...
btrfs balance start -susage=0 -f -v
In theory, metadata includes system, so system shouldn't need to be done on its own. If system IS explicitly listed, however, force must be used as well, as you found out.
The convert=raid1 should convert all named types to raid1, while the soft keeps it from redoing all chunks that are already in target mode.
usage=N says only do the chunks with usage at or below N%, and profile=single says only do those in single profile.
So since the system chunk in question is single mode, balance start - sprofile=single -f /should/ have converted it, but didn't. My guess is that for some reason it didn't realize that you actually wanted system converted and what to, since you only gave it the existing profile, not the target profile. For metadata it did the right thing anyway, but apparently not for system.
But given the above, there's multiple ways to skin that cat. The -sconvert=raid1,soft -f /should/ do it as well, and I expect it will, since that actually tells it the target format.
But if for some reason that doesn't work either, I /know/ the -susage=0 -f should do it, since usage=0 is the one I've always used to do it here.
If you did -musage=0, that should actually include both metadata and system, and doesn't need -f. I've found that to be the case here too. But the -m might find a few additional non-system metadata blocks to free in the process, which wouldn't be a bad thing but could take a bit more time. (Tho at 0 usage it shouldn't take much! =:^)
Actually, given your metadata total of 4 GiB, nearly 3 GiB used, it's quite possible that would end up returning a couple chunks, giving you 3.5 GiB total, still nearly 3 GiB used. Tho it depends on whether there's actually free metadata chunks or not, since the usage=0 says don't bother if they aren't totally empty. (It normally wouldn't free all the way down to 3 GiB metadata total, however, since the filesystem reserves a couple hundred MiB for its own use, metadata chunks are 256 MiB each, and they're raid1, so they're allocated in pairs. Thus, even a full balance would probably leave you at 3.5 GiB total metadata, still just under 3 GiB used.)
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
Hi Stefan,
Quoted 9 lines · Chris Murphy
Quoted 9 lines
Quoted 5 lines
They're harmless -- it's a side-effect of the way that mkfs works.
They'll go away if you balance them:btrfs balance start -dprofiles=single -mprofiles=single -sprofiles=single /mountpoint
btrfs refused this command, I had to pass --force to execute it. It exited with this:Done, had to relocate 2 out of 2710 chunks.
Quoted 8 lines
Quoted 6 lines
After that btrfs fi df shows the following:
Data, RAID1: total=2.64TiB, used=2.22TiB
System, RAID1: total=8.00MiB, used=380.00KiBQuoted 1 line
System, single: total=4.00MiB, used=0.00<
Metadata, RAID1: total=4.00GiB, used=2.94GiB
Hmm, seems like a bug. What about
See this patch: "Btrfs: stop refusing the relocation of chunk 0"
I managed to balance away the empty single System chunk only once I was running 3.13 from Ubuntu trusty.
http://www.spinics.net/lists/linux-btrfs/msg27119.html
https://bugzilla.kernel.org/show_bug.cgi?id=60594
Cheers, Dan