Results 1 to 7 of 7

Thread: Data isn't being saved in usb upon removal

  1. #1
    Join Date
    Aug 2014
    Beans
    Hidden!

    Data isn't being saved in usb upon removal

    When I remove usb after finishing data transfer (file operation completed), I find an empty folder with nothing inside. But if I first eject and then remove the usb, it takes some time to eject and now I have the folder with everything there. So why I have to eject everytime and then remove, is there some config problem for which data isn't being saved instantly..?

    xubuntu 14.04 LTS
    Jahid @ HP ProBook 440 G1 Laptop

  2. #2
    Join Date
    Jun 2007
    Location
    Paraparaumu, New Zealand
    Beans
    Hidden!

    Re: Data isn't being saved in usb upon removal

    The need to "safely remove" a device before unplugging it is normal for both *nix and Windows systems. The reason for this is that file operations are commonly buffered. You need to ensure that the buffers are properly flushed, otherwise you risk losing part (or all) of your data.

    I'm not aware of any system settings that will help eliminate or reduce the need for this, and will happily stand corrected if other forum users have any extra information.
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

  3. #3
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Data isn't being saved in usb upon removal

    Quote Originally Posted by Jahidul_Hamid View Post
    When I remove usb after finishing data transfer (file operation completed), I find an empty folder with nothing inside. But if I first eject and then remove the usb, it takes some time to eject and now I have the folder with everything there. So why I have to eject everytime and then remove, is there some config problem for which data isn't being saved instantly..?

    xubuntu 14.04 LTS
    Quote Originally Posted by lisati View Post
    The need to "safely remove" a device before unplugging it is normal for both *nix and Windows systems. The reason for this is that file operations are commonly buffered. You need to ensure that the buffers are properly flushed, otherwise you risk losing part (or all) of your data.

    I'm not aware of any system settings that will help eliminate or reduce the need for this, and will happily stand corrected if other forum users have any extra information.
    Long ago (before USB was invented) there were computers that did not buffer the data (for example with old DOS operating systems). I remember when buffering was introduced into DOS, and people were told (at shutdown) to wait until the shutdown had finished to switch off the main power. Since then it has been important to consider flushing the buffers in PCs. It is possible to make systems that write to the drives before continuing, but computers with such systems will be slow and inconvenient to use.

  4. #4
    Join Date
    Aug 2014
    Beans
    Hidden!

    Re: Data isn't being saved in usb upon removal

    In linux Mint 17 LTS this doesn't occur everytime (but frequently), in windows (7,8,8.1) I have never seen this problem.

    In xubuntu no matter how much I wait for the buffering to complete it seems that it (buffering) starts only when i try to eject...
    Jahid @ HP ProBook 440 G1 Laptop

  5. #5
    Join Date
    Jun 2007
    Location
    Paraparaumu, New Zealand
    Beans
    Hidden!

    Re: Data isn't being saved in usb upon removal

    Quote Originally Posted by Jahidul_Hamid View Post
    In linux Mint 17 LTS this doesn't occur everytime (but frequently), in windows (7,8,8.1) I have never seen this problem.

    In xubuntu no matter how much I wait for the buffering to complete it seems that it (buffering) starts only when i try to eject...
    I think you have misunderstood what I was referring to. By "buffering" I meant that data doesn't always get written to a disk or USB device immediately, but is held in an area of memory sometimes known as a buffer, and sometimes known as a write cache. It might seem like a copy operation has completed, but if the device is removed before the contents of the buffer is completely copied to the device, then there is a risk of data being lost.

    An article written from the Windows perspective can be found here: http://www.howtogeek.com/118546/htg-...ve-usb-sticks/
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

  6. #6
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,821
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Data isn't being saved in usb upon removal

    Reading the man page for mount (yes, it's very long):
    Code:
    FILESYSTEM INDEPENDENT MOUNT OPTIONS
           Some of  these  options  are  only  useful  when  they  appear  in  the
           /etc/fstab file.
    
           Some  of  these  options could be enabled or disabled by default in the
           system kernel.  To  check  the  current  setting  see  the  options  in
           /proc/mounts.
    
           The  following  options  apply  to any filesystem that is being mounted
           (but not every filesystem actually honors them - e.g., the sync  option
           today has effect only for ext2, ext3, fat, vfat and ufs):
    
           async  All  I/O  to  the filesystem should be done asynchronously. (See
                  also the sync option.)
    
    ...
    
           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.
    
    ...
    
    FILESYSTEM SPECIFIC MOUNT OPTIONS
    ...
    Mount options for fat
    ...
           flush  If set, the filesystem will try to flush to disk more early than
                  normal.  Not set by default.
    When I plug in a FAT32 usb drive, it is automounted with the flush option. This should flush all buffered data to the drive in a short time, like seconds, but not at once. I assume Windows by default uses something similar.

  7. #7
    Join Date
    Aug 2014
    Beans
    Hidden!

    Re: Data isn't being saved in usb upon removal

    Quote Originally Posted by Impavidus View Post
    When I plug in a FAT32 usb drive, it is automounted with the flush option. This should flush all buffered data to the drive in a short time, like seconds, but not at once. I assume Windows by default uses something similar.
    I think you got the point here....

    I just noticed that the partition table was in GPT, I changed it to msdos and it works now as expected...

    Though i am getting a boot error when making it bootable with unetbootin, but don't think it's that big of a problem to solve...

    thnks for the answers..
    Jahid @ HP ProBook 440 G1 Laptop

Tags for this Thread

Bookmarks

Posting Permissions

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