delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/08/25/17:33:03

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4C758C01.3050109@bopp.net>
Date: Wed, 25 Aug 2010 16:32:49 -0500
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: associating device names with cygdrive directories
References: <4C758020 DOT 4070501 AT bellsouth DOT net>
In-Reply-To: <4C758020.4070501@bellsouth.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 8/25/2010 3:42 PM, Charles D. Russell wrote:
>  Maybe it won't always work, but with debian "mount" I get the following
> line of output, which tells me what I want to know (and more):
> 
> /dev/sda1 on /live/image type vfat
> (rw,noatime,fmask=0022,dmask=0022,allow_utime=177777,codepage=cp437,iocharset=utf8)
> 
> 
> I infer from the replies that in Cygwin there is no easier way to find
> my way around in /dev than the way I was doing it, though I realize
> "strings" is a better choice than "od".  With dd
> if=/dev/sda|strings|less I discovered that /dev/sda is actually my hard
> drive.

How would you handle the case where you have more than a single mount
which looks like that?  e.g.)

/dev/sda1 on /live/image1 type vfat
(rw,noatime,fmask=0022,dmask=0022,allow_utime=177777,codepage=cp437,iocharset=utf8)
/dev/sdb1 on /live/image2 type vfat
(rw,noatime,fmask=0022,dmask=0022,allow_utime=177777,codepage=cp437,iocharset=utf8)

I think part of what Chris is saying is that you typically don't know
for sure how Linux will associate a particular hardware device with a
particular node in the device filesystem.  Looking at the mount table is
only useful in extremely limited circumstances, such as when you only
have a single device that always mounts to a well-known mount point.

Since Windows handles the "automounting" for Cygwin, you have to depend
on Windows to always assign the same drive letter to the device, thus
creating your well-known mount point (/cygdrive/d, for example).
However, I don't believe there is any way to force that under Windows,
so if some other device loads first and takes the drive letter you
usually get, your second device will automatically get a different drive
letter.  This is outside of Cygwin's control in any case.

If you want to avoid the hacks you describe above, you'll need to talk
to Windows in order to locate some sort of unique identifier for your
device and use that to ultimately identify the POSIX device path,
perhaps via the drive letter and Barry's trick.  Under Linux you would
essentially use sysfs to do a similar task.  Anything less, especially
since you're talking about using dd to write to the device, will likely
lead to unhappiness.

-Jeremy

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019