Re: Tool to calc. 4k / 16k utilization / overhead
From: Kai Krakow <hidden>
Date: 2012-06-23 10:48:19
Hi! Why don't you just use "du -B 4096 -sh /path/to/fs" vs. "du -B 16384 -sh ..."? Subtracting both results is the overhead of the one vs. the other. But to answer your request for the formula, its: blocks = (long)((file_size + block_size - 1) / block_size) occupied_size = blocks * block_size But this does not tell you the real on-disk occupation because it takes the logical file size of the files into account. But files may be sparse or compressed which sheds a complete different light on the problem. I'd go with "du" command because it takes this into account. Regards, Kai Sandra Schlichting [off-list ref] schrieb:
Hi all, When having a non-btrfs fs and want to migrate to btrfs, it is hard to know which sector size to choose in terms of disk utilization and speed. So I would like to make a script that scans the non-btrfs fs's directory structure to find all file sizes and calculate how much space these would take on btrfs 4k and 16k sector size. Can anyone help me with a formulae to calculate this for a file? It doesn't have to be exact, just enough to make a decision between 4k and 16k. Best regards, Sandra -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html