coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: doubt about sync(1) for shutdown the system


From: Pádraig Brady
Subject: Re: doubt about sync(1) for shutdown the system
Date: Wed, 10 May 2017 17:17:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

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

[Prev in Thread] Current Thread [Next in Thread]