Data Loss with samba shared USB drive

David Taylor davidt at yadt.co.uk
Sat Dec 3 13:32:32 PST 2005


I have a USB drive (SanDisk 1GB flash drive), which I have mounted
on a windows PC using samba 3.0.

I recently discovered the copy of my files on my USB device were
corrupted (thankfully I had a backup), being filled entirely with
0's (that's ASCII '0', not NUL).

I have managed to reproduce the problem with these steps.  

1. Mount USB drive on (say) /usb
2. Share /usb over samba
3. (Optional) On windows PC mount \\server\usb as (say) U:
4. Change something on /usb drive (from windows or freebsd)
5. On FreeBSD machine type "umount /usb" -- get "Device busy" error
6. View changed file.

When I've tried this, it results in the contents of the modified file
being entirly replaced by a string of 0.  This only happens on a
USB device, when samba is running.  The share does not need to
be mounted on the windows PC for this to occur.

If anyone has any ideas, or wants any more information, please let me know.

uname:
FreeBSD outcold.yadt.co.uk 6.0-STABLE FreeBSD 6.0-STABLE #2: Wed Nov  9 14:14:34
 GMT 2005     root at outcold.yadt.co.uk:/usr/obj/repo/FreeBSD/FreeBSD-6.x/src/sys/
OUTCOLD  amd64

usb drive attach dmesg:
umass0: SanDisk Flash Disk, rev 1.10/1.00, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SanDisk USB 2.0 Flash %z!Y> Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: 1048576MB (2147484160 512 byte sectors: 255H 63S/T 133674C)

samba version:
samba-3.0.20b,1     A free SMB and CIFS client and server for UNIX

-- 
David Taylor


More information about the freebsd-stable mailing list