Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Important BTRFS Question Very Important......
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
finalturismo
n00b
n00b


Joined: 06 Jan 2020
Posts: 41

PostPosted: Sat Jan 11, 2020 9:23 am    Post subject: Important BTRFS Question Very Important...... Reply with quote

Can someone tell me how setting raid1 on btrfs 5.4.1 is giving me double the space with 2x 480GB SSDs?

This has got to be a bug or is there something i am missing?

Code:
Performing full device TRIM /dev/sda (447.13GiB) ...
Performing full device TRIM /dev/sdb (447.13GiB) ...
ERROR: skipping duplicate device /dev/sda in the filesystem
ERROR: skipping duplicate device /dev/sdb in the filesystem
Label:              (null)
UUID:               5a56056e-f552-4185-a4f3-b4323afb9982
Node size:          16384
Sector size:        4096
Filesystem size:    894.26GiB
Block group profiles:
  Data:             RAID1             1.00GiB
  Metadata:         RAID1             1.00GiB
  System:           RAID1             8.00MiB
SSD detected:       yes
Incompat features:  extref, skinny-metadata
Checksum:           crc32c
Number of devices:  2
Devices:
   ID        SIZE  PATH
    1   447.13GiB  /dev/sda
    2   447.13GiB  /dev/sdb


[Moderator edit: added [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
Gatak
Apprentice
Apprentice


Joined: 04 Jan 2004
Posts: 154

PostPosted: Sat Jan 11, 2020 12:46 pm    Post subject: Reply with quote

2x447=894. Not a bug. it is the space available for Btrfs to be used. Remember you can use different RAID modes for metadata and data, so the actual space available to you as a user depends on that. Look at the "Free (estimated):" line below.

btrfs filesystem usage /path/to/mountpoint
Code:
Overall:
    Device size:                   6.36TiB
    Device allocated:              4.83TiB
    Device unallocated:            1.52TiB
    Device missing:                  0.00B
    Used:                          4.76TiB
    Free (estimated):              1.59TiB      (min: 846.79GiB)
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:              512.00MiB      (used: 0.00B)

Data,single: Size:4.82TiB, Used:4.75TiB (98.63%)
   /dev/sdd2       2.23TiB
   /dev/sdb2       1.38TiB
   /dev/sdc2       1.21TiB

Metadata,RAID1: Size:7.00GiB, Used:5.69GiB (81.25%)
   /dev/sdd2       3.00GiB
   /dev/sdb2       4.00GiB
   /dev/sdc2       7.00GiB

System,RAID1: Size:32.00MiB, Used:624.00KiB (1.90%)
   /dev/sdd2      32.00MiB
   /dev/sdc2      32.00MiB

Unallocated:
   /dev/sdd2     499.67GiB
   /dev/sdb2     441.02GiB
   /dev/sdc2     617.99GiB
Back to top
View user's profile Send private message
finalturismo
n00b
n00b


Joined: 06 Jan 2020
Posts: 41

PostPosted: Sat Jan 11, 2020 6:15 pm    Post subject: Reply with quote

Gatak wrote:
2x447=894. Not a bug. it is the space available for Btrfs to be used. Remember you can use different RAID modes for metadata and data, so the actual space available to you as a user depends on that. Look at the "Free (estimated):" line below.

btrfs filesystem usage /path/to/mountpoint
Code:
Overall:
    Device size:                   6.36TiB
    Device allocated:              4.83TiB
    Device unallocated:            1.52TiB
    Device missing:                  0.00B
    Used:                          4.76TiB
    Free (estimated):              1.59TiB      (min: 846.79GiB)
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:              512.00MiB      (used: 0.00B)

Data,single: Size:4.82TiB, Used:4.75TiB (98.63%)
   /dev/sdd2       2.23TiB
   /dev/sdb2       1.38TiB
   /dev/sdc2       1.21TiB

Metadata,RAID1: Size:7.00GiB, Used:5.69GiB (81.25%)
   /dev/sdd2       3.00GiB
   /dev/sdb2       4.00GiB
   /dev/sdc2       7.00GiB

System,RAID1: Size:32.00MiB, Used:624.00KiB (1.90%)
   /dev/sdd2      32.00MiB
   /dev/sdc2      32.00MiB

Unallocated:
   /dev/sdd2     499.67GiB
   /dev/sdb2     441.02GiB
   /dev/sdc2     617.99GiB



but this is raid1 with 2 drives, that means it should only have a total capacity of 1 drive for space and the other as a mirror?
unless there is some special algorithm and compression model being used to double space with redundancy?


Filesystem size: 894.26GiB

It says file system size
Back to top
View user's profile Send private message
Gatak
Apprentice
Apprentice


Joined: 04 Jan 2004
Posts: 154

PostPosted: Sun Jan 12, 2020 10:23 am    Post subject: Reply with quote

The filesystem will the sum of all devices attached to it. Btrfs then allocates chunks called "block groups" of 1GB at a time. These chunks may be "single" "dup" or "raid1 or "raid56". If you have the raid1 profile for data blocks, then each block group will be created as a duplicate on two separate devices (disks).

So the free space calculation can only happen after some data is allocated in the various types of groups. This is why it says estimate.

You can see this behaviour since I use "RAID1" profile for metadata. The needed metadata space is ~6GB and 7GB is allocated. If you look, 7GB is allocated on sdc2, and 3GB+4GB allocated on sdd2 and sdb2.

Code:

Data ratio:                       1.00
Metadata ratio:                   2.00
Back to top
View user's profile Send private message
finalturismo
n00b
n00b


Joined: 06 Jan 2020
Posts: 41

PostPosted: Sun Jan 12, 2020 9:35 pm    Post subject: Reply with quote

Gatak wrote:
The filesystem will the sum of all devices attached to it. Btrfs then allocates chunks called "block groups" of 1GB at a time. These chunks may be "single" "dup" or "raid1 or "raid56". If you have the raid1 profile for data blocks, then each block group will be created as a duplicate on two separate devices (disks).

So the free space calculation can only happen after some data is allocated in the various types of groups. This is why it says estimate.

You can see this behaviour since I use "RAID1" profile for metadata. The needed metadata space is ~6GB and 7GB is allocated. If you look, 7GB is allocated on sdc2, and 3GB+4GB allocated on sdd2 and sdb2.

Code:

Data ratio:                       1.00
Metadata ratio:                   2.00



So basically when it says file system size, its not the actually available space the OS can use.
Back to top
View user's profile Send private message
Gatak
Apprentice
Apprentice


Joined: 04 Jan 2004
Posts: 154

PostPosted: Mon Jan 13, 2020 11:58 am    Post subject: Reply with quote

Precisely

https://btrfs.wiki.kernel.org/index.php/FAQ#Understanding_free_space.2C_using_the_new_tools

https://carfax.org.uk/btrfs-usage/ <--- very useful calculator
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum