Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

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 2014-08-21 13:22 +0000
Organization A noiseless patient Spider
Message-ID <lt4rqk$k6v$1@dont-email.me> (permalink)
References <jskm1r$54e$1@news.albasani.net> <jsl0od$tlb$1@dont-email.me> <11bbe6f7-4eb8-4ae2-999f-9a7244b99d3e@googlegroups.com> <lsvjf0$dlm$1@dont-email.me> <lsvlr7$rfg$1@news.albasani.net>

Show all headers | View raw


On Tue, 19 Aug 2014 14:09:36 +0000, Jan Panteltje wrote:

> On a sunny day (Tue, 19 Aug 2014 13:29:05 +0000 (UTC)) it happened Joe
> Beanfish <joebeanfish@nospam.duh> wrote in <lsvjf0$dlm$1@dont-email.me>:
> 
>>On Mon, 18 Aug 2014 12:58:35 -0700, ameliusje wrote:
>>> On Friday, June 29, 2012 9:47:23 PM UTC+2, Joe Beanfish wrote:
>>>> On 06/29/2012 12:44 PM, 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.
>>>> 
>>>> The ongoing activity is probably the USB bus probing etc. Don't worry
>>>> about that. Umount is definitive.
>>> 
>>> But this raises the question: what good is sync if it does not
>>> properly flush filesystem-related data too?
>>> What's the use for sync then?
>>
>>It does sync the data. But until unmounted the filesystem is still in
>>use and may have more data and meta data written at any time. So
>>depending on the filesystem type and timing you may get away with
>>sync-and-yank but it's highly inappropriate. "Sync 3 times" was never
>>appropriate even if some people did it before because they were too lazy
>>to umount correctly.
> 
> 'I've stopped using filesystems altogether,
> and now just dd my data directly to the media,
> be it stick, card, DVD-R or BR-R-25.
> Do I still need sync before removing those media?

Linux has caching on block devices. Make sure you use a raw device.
See http://www.tldp.org/HOWTO/SCSI-2.4-HOWTO/rawdev.html

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