Mike Small <
sma...@panix.com> writes:
> Richard Kettlewell <inv...@invalid.invalid> writes:
>> Rich <ri...@example.invalid> writes:
>>> Mike Small <
sma...@panix.com> wrote:
>>>> I'm noticing places in both Slackware's installer and
>>>> debian-installer where a mkfs run is immediately followed by a
>>>> sync...
>>>>
>>>> [snip]
>>>>
>>>> Is this just a known thing among those who've been around? mkfs
>>>> isn't truly done and with all bits on disk when it exits?
>>>
>>> It is not just mkfs. Linux caches writes in RAM, with the data
>>> actually being committed to disk some time later.
>>>
>>> If you want to be sure a write has hit the disk (note, due to on disk
>>> caches, you can never really be /sure/) you need to tell the kernel to
>>> write the cached RAM data out to disk -- that is what 'sync' does.
>>>
>>> Those sync's are not strictly necessary, but are likely present for
>>> safety's sake. Run the mkfs, then try to make certian all the writes
>>> have been at least sent to the disk controller.
>>
>> They are redundant, at least for ext4, since mkfs.ext4 calls fsync on
>> the target device. I’m not going to check other filesystems but the
>> situation is likely to be the same.
>
> Suppose the ext4 fs was on an encrypted volume on top of a dm raid,
> i.e. two levels of device mapper. Is it possible that the fsync on the
> crypt device wouldn't carry through to the raid?
would (almost certainly) affect sync in the same way, i.e. the sync
‘Fails’ isn’t really enough information to even speculate. Looking at