help-gnu-utils
[Top][All Lists]
Advanced

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

Re: question about the "copy, then remove" behaviour of mv


From: Bob Proulx
Subject: Re: question about the "copy, then remove" behaviour of mv
Date: Mon, 26 Oct 2009 14:19:07 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

Henrik Carlqvist wrote:
> Bob Proulx wrote:
> > The oringinal message brought up the problem of disconnecting a usb
> > drive while in the middle of a copy.  In the case of using mv if the
> > copy fails then the source will not be removed.  Reattaching the drive
> > and then restarting the mv command is possible.
> 
> Yes, but disconnecting a mounted USB drive is never a good idea. You might
> still lose some files not flushed to the disc but residing in the cache
> handled by the OS. Even files written might be lost because of file system
> crashes.  Even some journaling file systems might lose file contents at
> these circumstanses, with only metadata journaled you might only be
> guaranteed that the file system itself will not be broken.

Yes, you are right.  It is possible to lose data in that case too.

> Maybe the OP ought to fix the problem with a USB disk being disconnected
> during file transfers instead of fixing the way how files are transfered.

Yes, but, accidents do happen.  Between acts of dog and other hazards
sometimes programming extra defensively is a good thing.

Personally when moving a large collection of files from one device to
another that is going to take a long time I use rsync to copy all of
the data first.  The rsync command can be stopped and restarted many
times very efficiently because it will avoid copying what isn't
needed.  It can clean up for a previous invocation that left things in
a corrupted state.  After everything is verified to be good then
remove the source files.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]