Re:Mkfile(8) is severely syscall limited on OS X
by mschuster91 on Sunday February 12, 2017 @08:55AM
(#13628302)
> You know, you can dd to a file to avoid destroying a drive.
Then you're at the whim of more or less obscure caching layers in the Linux kernel. At least there's a filesystem cache plus something in the block-device layer that reads ahead in order to speed up fread calls with low buffer sizes.
Also, due to filesystem fragmentation the file will be distributed across locations on the disk - that doesn't matter much for SSDs, but on "spinning rust" the head seeks distort the performance. A dd on a raw disk, however, will not cause any seeks except those for background processes' file operations.
Re:Mkfile(8) is severely syscall limited on OS X
by the8472 on Sunday February 12, 2017 @09:05AM
(#13628337)
You can add `direct` to dd if you're concerned about the caches. And if you want to avoid seeks, just use `fallocate`. It'll do the Right Thing(tm) on CoW and non-CoW filesystems - either just creating a hole or reserving extent space, without having to write all the blocks in either case.
so
would write 1GB in 1k blocks, and would write 1GB in 1m blocks.