[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about "mv" operation.



On 20150804_1611+0800, Magicloud Magiclouds wrote:
> Hi,
> 
> Say I am moving a file between two harddisks. Both filesystems are Ext4.
> During the operation, I cut off the power. Then boot the host, and fix the
> filesystems.
> 
> Now, I see in both locations, there are the file. My question is, is it
> safe to remove file in dest, and move to it again from src?

No, it is NOT safe. The power interruption might have happened after
the data transfer was completed, while the deletion of the source file
was in progress.

I think there is some way to protect against this possibility
already built into the gnu coreutils version of mv, but I don't know for
sure. Ask this question at:

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
(near the bottom of man mv)

I have found the people at that site helpful and polite.

And, perhaps, OP can make this query and post the response here.

HTH

> 
> Thanks.
> 
> -- 
> 竹密岂妨流水过
> 山高哪阻野云飞
> 
> And for G+, please use magiclouds#gmail.com.

-- 
Paul E Condon           
pecondon@mesanetworks.net


Reply to: