On 10/05/17 15:49, Matias Fonzo wrote:
> Hi there,
> 
> I am writing a shutdown script for the boot process.
> 
> I have a little question, which is exactly the order to apply correctly
> sync(1)?:
> 
>   1. Before to unmount swap devices, local/remote filesystems?.
> 
>   2. Between the unmount of swap device(s) and local/remote
>   file systems?.
> 
>   3. After to unmount everything?.
> 
>   4. ... ?.
> 
> Thanks,
> Matias
> 

Note sync(1) doesn't return any errors from sync(2)
as the later always "succeeds".
Also syncing is implicit in umount.
Hence on modern systems calling sync(1) is IMHO redundant
if doing a umount anyway.
Consider also data written after the sync and before the umount.
Therefore the kernel umount is the only place that can
do that appropriate syncing without races.

cheers,
Pádraig

Reply via email to