linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Tool to calc. 4k / 16k utilization / overhead
@ 2012-06-23  9:15 Sandra Schlichting
  2012-06-23 10:43 ` Kai Krakow
  0 siblings, 1 reply; 2+ messages in thread
From: Sandra Schlichting @ 2012-06-23  9:15 UTC (permalink / raw)
  To: linux-btrfs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tool to calc. 4k / 16k utilization / overhead
  2012-06-23  9:15 Tool to calc. 4k / 16k utilization / overhead Sandra Schlichting
@ 2012-06-23 10:43 ` Kai Krakow
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Krakow @ 2012-06-23 10:43 UTC (permalink / raw)
  To: linux-btrfs

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 <littlesandra88@gmail.com> 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-23 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-23  9:15 Tool to calc. 4k / 16k utilization / overhead Sandra Schlichting
2012-06-23 10:43 ` Kai Krakow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).