On Fri, 30 Jul 2004 14:45:35 +0200 Emmanuel Jeandel wrote:
> When i do 
>   mv ~/foo /mnt/disk/somedir
> ~/foo is removed but foo is not always synchronously 
> copied : it may stay in the cache from some time. 
> Hence if my disk crashes during (or before) the 
> real writing, I complety lose the file foo
> (As it has been removed  BEFORE the real copy 
> takes place)


Workaround, assuming filesystem blocksize 4k
# ------------------------------------------
stat -f /mnt/disk/somedir
dd oflag=sync bs=4096 if=~/foo of=/mnt/disk/somedir/foo && rm ~/foo


bs equal to blocksize of filesystem at /mnt/disk as reported by
stat = write "ultra securely".
dd performs fsync after EVERY bs byte of data, that is usually very slow.

If you want faster transfer and less data security, increase bs to some
multiple of filesystem blocksize.


-- 
Roland Eggner




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to