X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 11 Jan 2011 15:51:07 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: 1.7.7 on Windows 7: can't write to removable disk Message-ID: <20110111145107.GG3413@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <9f058f408968d2531d16a0148bcf71ec DOT squirrel AT secure DOT datasupporten DOT se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9f058f408968d2531d16a0148bcf71ec.squirrel@secure.datasupporten.se> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Jan 10 10:40, tomas AT datasupporten DOT se wrote: > Hello. > I'm trying to write a disk image to a compact flash card with dd, but I > get the error: > "dd: writing to /dev/sdj: Permission denied" > > Apart from the CF-card, I also tried a USB-stick with the same results. > I'm logged in as administrator. Please have a look into http://support.microsoft.com/kb/942448 first. [...listening "De-Loused In The Comatorium" while waiting...] Finished reading? Ok. That's quite a serious restriction starting with Vista. If I destroy the filesystem on one of my sd cards under Linux, I can then overwrite it with dd under Cygwin. However, if that dd call created a valid filesystem on the sd card, the next write fails again. For some reason it does not help to unmount the filesystem on the drive via the "Disk Management" MMC snap-in, despite the claim in the aforementioned article. The solution I just checked in to Cygwin is rather complicated, but I really tested this a couple of hours now, and I didn't find any other solution. If you just want to write to a partition with a filesystem on it, say, /dev/sdj1, then Cygwin just has to call DeviceIoControl(FSCTL_LOCK_VOLUME) after opening the partition. However, if you want to write to the entire device (/dev/sdj), then Cygwin has to call DeviceIoControl(FSCTL_LOCK_VOLUME) for every single volume on the disk! This in turn only works if you don't have an open handle on any file on anyu of the partitions. Usually that should be ok, and I didn't find any other solution for the problem. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple