Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
...in normal Fedora 20, whenever I write a file, I then have to open a terminal and type "sync" to see that it's actually written - this is extremely annoying, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Mar 2013
    Posts
    381

    How do I turn off delayed disk writes to a USB stick?


    ...in normal Fedora 20, whenever I write a file, I then have to open a terminal and type "sync" to see that it's actually written - this is extremely annoying, and i want to stop doing it.

    What must I do?


    Thanks.

  2. #2
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    947
    Quote Originally Posted by resetreset View Post
    ...in normal Fedora 20, whenever I write a file, I then have to open a terminal and type "sync" to see that it's actually written - this is extremely annoying, and i want to stop doing it.

    What must I do?


    Thanks.
    All operating systems write to buffers first and flush the buffers based on various parameters. This is why all systems say to shutdown properly so all buggers get flushed. The timing is typically very short, but in Unix you have sync to force a flush and in general you do sync twice.

    Are you trying to pull the USB without ejecting it is that why your doing sync. If you eject the USB it is flushing the buffers as well as unmounting the USB.
    A lion does not lose sleep, over the opinion of sheep.

  3. #3
    Linux User
    Join Date
    Mar 2013
    Posts
    381
    Yes, that is exactly what I'm doing - pulling it out. How do I get it to write directly to the stick, under compulsion, ie. no buffering?

  4. $spacer_open
    $spacer_close
  5. #4
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,635
    The mount command has a sync option.
    Quote Originally Posted by man mount
    sync All I/O to the filesystem should be done synchronously. In case
    of media with limited number of write cycles (e.g. some flash
    drives) "sync" may cause life-cycle shortening.
    I guess (as I have no desire to actually try it) that you could add sync to the appropriate line in /etc/fstab for a similar effect. You will definitely be better off unmounting / ejecting properly.
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  6. #5
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,410
    +1 elija
    sync will cause all writes to go directly to the usb stick.
    However, this results in low performance and it will lower the lifetime of that usb stick.
    You must always face the curtain with a bow.

  7. #6
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    947
    Quote Originally Posted by Irithori View Post
    +1 elija
    sync will cause all writes to go directly to the usb stick.
    However, this results in low performance and it will lower the lifetime of that usb stick.
    Pulling it out without unmounting is already a problem waiting to happen.
    A lion does not lose sleep, over the opinion of sheep.

  8. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,635
    Quote Originally Posted by docbop View Post
    Pulling it out without unmounting is already a problem waiting to happen.
    Yeah it's not a thing to do if you love your data
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  9. #8
    Linux User
    Join Date
    Mar 2013
    Posts
    381
    When I'm in MATE on Fedora 20, how do I get it to turn ON this "sync" function that mount has, automatically, elija? So that, if I plug in a USB stick, itll auto turn on that option?

  10. #9
    Linux User nihili's Avatar
    Join Date
    Dec 2013
    Posts
    258
    resetreset, your last post asks for the opposite of what you ask in your first post?
    it seems to me you did not understand the answers so far.

    1) direct writing without buffering is slow and wears out the device.
    2) unmounting (=pressing the eject button besides your usb drives icon, or right clicking -> eject/unmount) will do the proper syncing anyway.

    in other words, better to leave it the way it is, or your next thread will be about either data loss or fried usb sticks.

    there's some rare cases where you need to sync (e.g., after dd'ing something to an unmounted partition).

    also, i can from hundredfold experience say that if your 100% sure the system did not write to the usb stick, you can just yank it out.

    [ hmmm. there's dozens of movies where someone gains access to someone elses laptop and clones the contents to their usb stick, while some armed guys are storming closer. you invariably see a progress bar, and at the very same moment it hits 100%, he yanks the stick out of the machine, succesfully. another of these cases where computer hollywood is nowhere near nerd reality. ]

  11. #10
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    947
    Quote Originally Posted by nihili View Post

    [ hmmm. there's dozens of movies where someone gains access to someone elses laptop and clones the contents to their usb stick, while some armed guys are storming closer. you invariably see a progress bar, and at the very same moment it hits 100%, he yanks the stick out of the machine, succesfully. another of these cases where computer hollywood is nowhere near nerd reality. ]
    My favorite from a movie was when I worked for Borland support C++ a new movie came out with a hacker scene in it. As usually they're breaking in and hex code all over the screen, then we notice that's Borland's Turbo Debugger! So their cracking in to a site by displaying memory in a debugger.
    A lion does not lose sleep, over the opinion of sheep.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •