r/bcachefs • • 16h ago

Erasure-code

I've been searching up online for manuals and tutorials but bcachefs is not that user friendly and straightforward on that front.

So how would I setup RAID-5 type (1-parity) pool for bcache?

I've used google search ai (god forbid) to set it up.

Now here is the command to format the drives, (SSD 1x1TB 1x512GB HDD 6x8TB 3x3TB)

sudo bcachefs format \
  --fs_label=pool \
  --compression=lz4 \
  --erasure_code \
  --data_replicas=2 \
  --metadata_replicas=2 \
  --foreground_target=ssd \
  --promote_target=ssd \
  --background_target=hdd \
  --metadata_target=ssd \
  --label=ssd.ssd1 /dev/nvme0n1 \
  --label=ssd.ssd2 /dev/nvme1n1 \
  --label=hdd.hdd1 /dev/sda \
  --label=hdd.hdd2 /dev/sdb \
  --label=hdd.hdd3 /dev/sdc \
  --label=hdd.hdd4 /dev/sdd \
  --label=hdd.hdd5 /dev/sde \
  --label=hdd.hdd6 /dev/sdf \
  --label=hdd.hdd7 /dev/sdg \
  --label=hdd.hdd8 /dev/sdh \
  --label=hdd.hdd9 /dev/sdi

Now it does mount and shows total space (df -h) as 49T, but free space is at 25T and used space as 1%(61G)

Is this pool mirrored with parity or why it shows 25T only free?

Do I need the replicas options?

2 Upvotes

9 comments sorted by

2

u/koverstreet not your free tech support 10h ago

So what are you not finding user friendly? You checked the PoO, right? :)

That's supposed to be the canonical documentation, if that doesn't explain something adequately tell me what.

1

u/Jaska001 10h ago

You are right! after I reeeeally look into it I can see everything what Google ai has stolen from that document :)

1

u/colttt 15h ago

When size has your disks?

since you use meta and data replicas , you can just use replicas (so far as I know) But yes this is a raid5 setup

1

u/Jaska001 15h ago

Ah right sorry, that would be SSD 1tb and 512gb HDD 6x8tb and 3x3tb

1

u/cr1s 14h ago

Check the output of `bcachefs fs usage /mountpoint`, I'm not sure if the output of df is accurate.

1

u/Jaska001 13h ago

That would show correct available space. I just don't want to commit and halfway through using the available space end up with ENOSPC

1

u/banghest 11h ago

Looks correct.

As you write data to the volume, pay attention to the "Erasure coded (data+parity) section of "bcache usage". - You want to see something like below, relatively little data in "Replicated" (~70GB in my case), relatively much in "Erasure Coded" (~23TB in my case).

You will see data coming in as replicated on the ssd's, and showing up under "Leaving", until the fs triggers a reconcile, which then writes those "Leaving" data into EC stripes on the hdd's.

Filesystem: 47fa39e0-d4c3-4aab-a01b-f0ebc192b16d
Size:             41.9T   
Used:             23.0T   
Online reserved:  4.00M   
Free:             18.6T  16.9T  writable now
 at 2 replicas:  18.6T  16.9T   
 at 3 replicas:  18.6T  16.9T   
 at 4 replicas:  9.90T  3.39T   
 at 5 replicas:      0      0   

Replicated:
undegraded   
2x:       69.4G   

Erasure coded (data+parity):
undegraded   
4+1:       22.9T   

cached:  845G   

Pending reconcile:   data  metadata   
erasure_code:       17.9M         0   
target:             17.9M         0   

Device label                      Device   State   Size   Used  Use%  Leaving   
hdd.wd-red-6t-1 (device 3):       sdd      rw     5.45T  4.58T   84%   
hdd.wd-red-6t-2 (device 4):       sde      rw     5.45T  4.58T   84%   
hdd.wd-redplus-12t-1 (device 6):  sda      rw     10.9T  4.58T   42%   
hdd.wd-redplus-12t-2 (device 7):  sdb      rw     10.9T  4.58T   42%   
hdd.wd-redplus-12t-3 (device 8):  sdc      rw     10.9T  4.58T   42%   
ssd.kioxia-xg6-1t-1 (device 9):   nvme0n1  rw      951G   585G   93%    20.0M   
ssd.kioxia-xg6-1t-2 (device 10):  nvme1n1  rw      951G   329G   91%    21.6M  

1

u/Jaska001 10h ago

Should I just ignore whatever "df -h" reports or...?

2

u/koverstreet not your free tech support 10h ago

The problem with df -h is that since you can set ec and replication per file/directory, and df reports for the filesystem - we can't give you a single number there that makes sense except raw "this is how much you can write at 1x replication".