Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.development.apps > #495

Re: Question about umount and sync

From Joe Beanfish <joebeanfish@nospam.duh>
Newsgroups comp.os.linux.development.apps
Subject Re: Question about umount and sync
Date 2012-07-02 10:07 -0400
Organization A noiseless patient Spider
Message-ID <jss9uc$ul7$1@dont-email.me> (permalink)
References <jskm1r$54e$1@news.albasani.net> <jsl0od$tlb$1@dont-email.me> <87ipe92dwr.fsf@araminta.anjou.terraraq.org.uk>

Show all headers | View raw


On 06/30/2012 08:16 AM, Richard Kettlewell wrote:
> Joe Beanfish <joebeanfish@nospam.duh> writes:
>> Jan Panteltje wrote:
>
>>> Question about umount and sync
>>>
>>> In the long ago past you could type 'sync' 3 times to make sure a
>>> disk was umounted..  Then later I used umount, and it returned when
>>> all data was written.
>>>
>>> But I notice on my new 16GB USB sticks that the busy light just keeps
>>> flashing for up to a minute after umount and sync have long returned.
>>> So what is a reliable way to umount these things from for exmaple a
>>> script, and be sure before allowing the user to unplug such an USB
>>> stick?
>>
>> umount has always been and still is the way to unmount. It will call
>> sync then detach the filesystem from the OS in a safe way so there's
>> no lost data. Sync just flushes the buffers. No amount of syncing does
>> or ever did properly detach a filesystem from the OS. Pure luck kept
>> you out of trouble using that technique.
>
> umount (the syscall) does block until the kernel has no more writes to
> do.  However umount (the program) can invoke a helper program instead of
> calling the syscall directly and if that helper goes wrong then the
> umount program can terminate while there are still writes pending.
>
> You should at least see some kind of error message in this case though.
>
>> The ongoing activity is probably the USB bus probing etc. Don't worry
>> about that. Umount is definitive.
>
> I've noticed similar behavior with spinning rust (and no helpers):
> umount completes but then disk activity starts up, and audibly so.  I
> don't know what's going on here.

Perhaps the disk flushing it's buffer to the platter?

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Question about umount and sync Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2012-06-29 16:44 +0000
  Re: Question about umount and sync Joe Beanfish <joebeanfish@nospam.duh> - 2012-06-29 15:47 -0400
    Re: Question about umount and sync Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2012-06-30 06:20 +0000
    Re: Question about umount and sync Richard Kettlewell <rjk@greenend.org.uk> - 2012-06-30 13:16 +0100
      Re: Question about umount and sync Joe Beanfish <joebeanfish@nospam.duh> - 2012-07-02 10:07 -0400
    Re: Question about umount and sync ameliusje@gmail.com - 2014-08-18 12:58 -0700
      Re: Question about umount and sync Joe Beanfish <joebeanfish@nospam.duh> - 2014-08-19 13:29 +0000
        Re: Question about umount and sync Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2014-08-19 14:09 +0000
          Re: Question about umount and sync Joe Beanfish <joebeanfish@nospam.duh> - 2014-08-21 13:22 +0000
            Re: Question about umount and sync Jan Panteltje <pNaonStpealmtje@yahoo.com> - 2014-08-21 14:15 +0000

csiph-web