Skip to contentSkip to conversation

Btrfs question

DISCUSSION Vladislav McFly 1 participant 1 message May 8, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Good afternoon, Btrfs team!

I am a student who is currently working on my thesis that is strongly connected with Btrfs.

I would be really thankful if you answer me.

My current configuration:

Btrfs version 5.4.1
Ubuntu 20.04.5 LTS
AMD Ryzen 4000 arch

I've got several questions about Btrfs internals. I am so sorry - but I hadn't found any information about it in the docs and on different forums. I would be really thankful if you answer me - it will help me much!

May you answer the following list of questions, please:

1) COW technology - how does it work if I modify the file (assuming before I created a read-only snapshot) at the beginning, middle or end
- it will anyway copy all the blocks of the source (the first version of the file) file? So, to optimize it - do I always need to use a deduplication mechanism?

2) I've tried to take a look at btrfs internal implementation of COW. Am I correct that COW works based on metadata - Inodes? If I delete the file(assuming I created a snapshot before), and then create a new one with absolutely the same content, in this case, COW will not understand that the content of the file can be optimized(with the created snapshot, I mean "exclusive" size of the subvolume) as the Inode changes?

3) During my experiments with Btrfs and deduplication (I am using "duperemove" from the Btrfs documentation) - I got a strange result. If I modify the file in the middle or in the end - deduplication successfully works. However, if I modify the file at the beginning of the file (keeping the same Inode) - the deduplication mechanism doesn't work for some reason, showing me in the console the following
message: "Nothing to dedupe". Is there a problem with the deduplication mechanism if we modify a file at the beginning?

Thank you so much in advance! Have a nice day.

Sincerely yours,

Vladislav.