From owner-freebsd-usb@FreeBSD.ORG Wed Sep 5 21:48:13 2012 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC8361065670 for ; Wed, 5 Sep 2012 21:48:13 +0000 (UTC) (envelope-from anatoly@kazanfieldhockey.ru) Received: from kazanfieldhockey.ru (kazanfieldhockey.ru [78.138.152.250]) by mx1.freebsd.org (Postfix) with ESMTP id 320E98FC18 for ; Wed, 5 Sep 2012 21:48:12 +0000 (UTC) Received: from asd.localdomain (host-175-22.xdsl.telecet.ru [87.117.175.22]) (authenticated bits=0) by kazanfieldhockey.ru (8.14.3/8.14.3) with ESMTP id q85LlvRm047423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Thu, 6 Sep 2012 01:48:02 +0400 (MSK) (envelope-from anatoly@kazanfieldhockey.ru) Date: Thu, 6 Sep 2012 01:47:53 +0400 From: Anatoly To: freebsd-usb@freebsd.org Message-ID: <20120906014753.2aaa126f@asd.localdomain> In-Reply-To: <20120904235557.7ca40fc8@epc.localdomain> References: <20120904235557.7ca40fc8@epc.localdomain> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.7; i386-portbld-freebsd7.3) Mime-Version: 1.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (kazanfieldhockey.ru [192.168.13.2]); Thu, 06 Sep 2012 01:48:03 +0400 (MSK) Subject: Re: how to force my 32G usb pendrive to flush write cache in RAM it has? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2012 21:48:13 -0000 В Tue, 4 Sep 2012 23:55:57 +0400 Anatoly пишет: > Hello, > I have a problem with my new 32G pendrive: > > da1: 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