This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: associating device names with cygdrive directories


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]