Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2012 01:47:53 +0400
From:      Anatoly <anatoly@kazanfieldhockey.ru>
To:        freebsd-usb@freebsd.org
Subject:   Re: how to force my 32G usb pendrive to flush write cache in RAM it has?
Message-ID:  <20120906014753.2aaa126f@asd.localdomain>
In-Reply-To: <20120904235557.7ca40fc8@epc.localdomain>
References:  <20120904235557.7ca40fc8@epc.localdomain>

next in thread | previous in thread | raw e-mail | index | archive | help
В Tue, 4 Sep 2012 23:55:57 +0400
Anatoly <anatoly@kazanfieldhockey.ru> пишет:

> Hello,
> I have a problem with my new 32G pendrive:
> 
> da1: <JetFlash Transcend 32GB 8.07> Removable Direct Access SCSI-2
> device da1: 40.000MB/s transfers
> da1: 30640MB (62750720 512 byte sectors: 255H 63S/T 3906C)
> 
> I'm using fat32 partition on it.
> To make problem occur I can do following things:
> 1) write a file about 5MB in size on that partition
> 2) unmount
> 3) unplug pendrive (so it loses power)
> 4) plug it again
> 5) mount
> Now I can see that the end of file is corrupted.
> 
> Poblem never occurs when I do:
> 1) write a file about 5MB in size on that partition
> 2) unmount
> 3) mount
> Also, problem doesn't occur if I'll wait for more than ~10 minutes
> before unplugging pendrive.
> 
> So it seems to me that this pendrive has internal write cache in RAM
> that needs to be flushed before pendrive loses power.
> Problem never occurs with Windows. As I click "remove", windows
> somehow "correctly shutdowns" pendrive so it's LED goes off (Unlike
> if i just unmount, when the LED stays on) 
> 
> What can I do to get cache flushed before unpugging, turn that write
> cache off, or any other suggestions?
> I've tried camcontrol stop and camcontrol eject with no
> success
> I using FreeBSD 7.3 with generic kernel here

I've found solution:
http://lists.freebsd.org/pipermail/freebsd-usb/2008-March/004677.html
that 'upower' utility allows to suspend pendrive, and I get cache
flushed (And LED goes off):
upower /dev/usb0 2 suspend



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