[clue] btrfs

Dennis J Perkins dennisjperkins at comcast.net
Sun Feb 24 21:59:13 MST 2019


Sean, here is what btrfs offers, assuming I haven't misunderstood
something.  You can compare this against ZFS, since you are using it.

Btrfs tries to ensure data integrity.  I know that some bugs suggest
the opposite.  Checksums for files or datablocks (I'm not sure which)
are stored with the metadata.  If an error is detected and RAID 1, the
other copy of the data is checked and if it is good, it can be copied
to the first drive to replace the bad file or block.  I don't know if
it overwrites the original or writes to a different location.  I don't
know how it handles an error with RAID 10.

File compression is enabled by default.  It can be turned off, or you
can select compression algorithms.  I think it can be configured to not
compress a file if it is already compressed.

It uses copy on write (CoW) instead of journalling.  This allows
snapshots if you have set up subvolumes.  It is supposed to also
impreve the life of an SSD because there is no journal to write to.

If you sete up subvolumes, you can create snapshots very quickly
because you are not copying files.  The link structure is copied
instead.  If you then modify a file, CoW is used on the file in the
subvolume.  The block can't be deleted because the snapshot is pointing
to it.  You can use the snapshot to back up the subvolume or to restore
it.

CoW causes fragmentation, but autodefragmentation is available.  I
don't know if trim would be a better choice when using SSD's.

Btrfs has its own volume manager and RAID.  They don't work quite the
same as LVM or mdadm.  Volume management lets you create a pool.  Add a
drive and the pool gets larger. You can't specify the size of a volume
but I don't know why you would need to.

Subvolumes are kind of like partitions, but they can grow or shrink.

RAID 0, 1, and 10 are supported.  RAID 5 and 6 should not be used 
because they are still working on a solution to the write hole problem.

I don't know about regular RAID, but RAID 1 in btrfs has two copies of
each file.  If the drives in the pool are different sizes, btrfs
handles making sure that all data is on two drives, but not necessarily
the same drives.  For example, if you have three 2 TB drives, you have
3 TB of useful space with data spread on all three drives.


+-------+              +----------+                +---------+
|       |              |          |                |         | 
| 1TB   |------------->|    1TB   |     +--------->|   1TB   |
|       |              |          |     |          |         |    
+-------+              +----------+     |          +---------+ 
| 1TB   |----+         |    1TB   |-----+          |         |    
|       |    |         |          |         +----->|  1TB    |    
+-------+    |         +----------+         |	   |         | 
             +------------------------------+      +---------+ 


If the drives are different sizes, sometimes not all of a drive in the
pool  will be used.



More information about the clue mailing list