Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Nov 2018 10:33:55 +0100
From:      Markus Hoenicka <markus.hoenicka@mhoenicka.de>
To:        JD <jd1008@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: ROX-Filer: overwriting a file on an USB drive truncates it
Message-ID:  <9f27b27e4adff167df27eaa0151ad407@mhoenicka.de>
In-Reply-To: <5BFF35DD.8050808@gmail.com>
References:  <4ee20fc51b13465edcec6d8456be7cf0@mhoenicka.de> <5BFF35DD.8050808@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 2018-11-29 01:42, schrieb JD:
> On 11/28/2018 05:23 PM, Markus Hoenicka wrote:
>> Hi,
>> 
>> I've recently upgraded my laptop to:
>> 
>> FreeBSD wombat 11.2-RELEASE-p4 FreeBSD 11.2-RELEASE-p4 #0: Thu Sep 27 
>> 08:16:24 UTC 2018 
>> root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
>> 
>> I've also updated all installed packages.
>> 
>> I keep running into a nasty file copying bug that does not seem to 
>> have occurred previously. Result is that overwriting an existing file 
>> on an USB drive causes this file to be truncated instead of being 
>> overwritten, which means data loss.
>> 
>> How to reproduce:
>> 
>> After logging in, I start an Xfce session manually:
>> 
>> startxfce4 --with-ck-launch
>> 
>> mount stick in an xterm, as per handbook. Note that I've set up user 
>> mounting of USB drives:
>> 
>> mount -t msdosfs -o -m=644,-M=755 /dev/da0s1 /stick/markus
>> 
>> open source directory (on hard drive) in a ROX-Filer window
>> open target directory (on usb drive) in another ROX-Filer window
>> 
>> drag&drop a file from source over an existing copy on target
>> 
>> dialog box asks if it is ok to overwrite which I acknowledge
>> 
>> ROX-Filer window shows the correct file size immediately after 
>> copying, and after rescanning the directory. ls -al 
>> /stick/markus/targetdir also shows the correct file size at this 
>> point.
>> 
>> umount /stick/markus fails because the device is busy. fstat shows 
>> that the ROX-Filer process keeps it busy
>> 
>> now I can either use umount -f /stick/markus to forcibly unmount the 
>> stick, or I log out of the X session and then use umount /stick/markus 
>> without problems
>> 
>> then mount the stick again as above, or try on a different computer
>> 
>> ls -al /stick/markus/targetdir shows a target file size of zero.
>> 
>> It appears that the new data are never flushed to the disk. I've even 
>> tried to run umount /stick/markus before umount -f /stick/markus, as 
>> this should perform a flush according to the umount man page. This bug 
>> appears to be specific to ROX-Filer. I could not reproduce this using 
>> Thunar, or plain ol' cp. This bug also appears to be specific to USB 
>> target drives, as I cannot reproduce this when overwriting files on 
>> the hard drive. I do not think the problem is related to a faulty file 
>> system on the target drive as I can reproduce this with just about any 
>> thumbdrive and external disk lying around.
>> 
>> I've been using ROX-Filer for ages, but I've noticed that neither 
>> mailing lists nor bug tracker seem to be active. Is it about time to 
>> move on?
>> 
>> thanks
>> Markus
>> 
> Hi Markus,
> the short of the long ....
> I have seen this problem man many times.
> I had found out that the usb stick was a 1X speed stick,
> and it took the FS and io drivers below it a long time to
> allocate the free blocks needed to write out the new data.
> 
> The new blocks are allocated from the list of
> "oldest blocks on the free list".
> That is how a flash fs blocks are handled.
> The old blocks are released to the free list.
> Thus a 1X flash stick would take forever to do this and
> receive all the data that is in the dirty memory blocks.
> 
> I am not saying that YOUR flash device is 1X device.
> Merely stating that perhaps you are being impatient????
> 

Hi JD,

thanks for the heads-up, but I don't think this is related to my present 
troubles. Remember that I can overwrite files on an USB stick with 
Thunar or cp, and I can copy files to USB sticks using ROX-Filer. Timing 
is always comparable.

regards,
Markus

-- 
Markus Hoenicka
http://www.mhoenicka.de
AQ score 38




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9f27b27e4adff167df27eaa0151ad407>