Somehow I had thought even in buffered mode the kernel would only accept block-aligned and sized I/O. TIL.
Re:Cloning a Laptop over NVMe TCP
by neuromanser on Tuesday March 12, 2024 @12:22PM
(#39681342)
> # yes | head -c 512 > foo
How about `truncate -s 512 foo`?
Larger writes will be more efficient, however, if only due to reduced system call overhead.
While not necessary when writing an image with the correct block size for the target device, even partial block overwrites work fine:
Partial block overwrites may (= will, unless the block to be overwritten is in the kernel's buffer cache) require a read/modify/write operation, but this is transparent to the application.Finally, note that this applies to most block devices, but tape devices work differently: partial overwrites are not supported, and, in variable block mode, the size of individual write calls determines the resulting tape block sizes.