helpGNU Core Utilities - Support: sr #106582, call fsync() after cross-device...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

sr #106582: call fsync() after cross-device move with mv

Submitted by:  None
Submitted on:  Sun 14 Dec 2008 01:07:23 AM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 1 - WishStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: GNU/Linux

Sun 14 Dec 2008 01:07:23 AM UTC, original submission:

In the event that power is lost immediately following a cross-device move, data can be irrevocably lost, if it has not yet been physically written to disk. This is not typically a problem with an intra-device move, since any data loss will be mitigated by the filesystem's journal.

A simple solution is to have the mv tool call fsync() on the newly created destination file in the case of a cross-device move before deleting the source file. This ensures that the data is physically on at least one of the target or source media at all times. One step further could be even to instruct the drive to flush its write buffer, but this is OS-dependent.

The reason I believe this should be part of mv and not a wrapper is that mv already performs checks whether the move is cross-device, and there is no trivial way to do so in e.g. a shell script.

Attached is a diff implementing this in mv.

Anonymous

 

Attached Files
file #17054:  mv.diff added by None (1kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 14 Dec 2008 01:07:23 AM UTCNoneAttached File-=>Added mv.diff, #17054

    Back to the top


    Powered by Savane 3.1-cleanup