Re: associating device names with cygdrive directories

2010-08-26 Thread Corinna Vinschen
On Aug 25 16:32, Buchbinder, Barry (NIH/NIAID) [E] wrote:
 On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:
 On Linux, the mount command reveals the association between filesystem 
 names and /dev/ names, but Cygwin mount doesn't tell.
 
 Is this what you want?  (The multiple spaces are really tabs.)
 
 $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done

I have another one:

  $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
  /dev/sda\\.\PhysicalDrive0
  /dev/sda1
\\.\STORAGE#Volume#{781f8bd6-7d0d-11de-8012-806e6f6e6963}#0010#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
  /dev/sda2\\.\Volume{781f8bda-7d0d-11de-8012-806e6f6e6963}
  /dev/sda3\\.\D:

but there are two problems.

Up to the current Cygwin 1.7.6 the info from /proc/partitions is
incomplete for non-privileged users.  I just checked in a patch to
Cygwin which allows the full partition info also for non-priv'ed users.

Apart from that, the output of cygpath -w for devices isn't overly
helpful yet.  I look into improving that a bit.


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



Re: associating device names with cygdrive directories

2010-08-26 Thread Rolf Campbell

On 2010-08-26 07:26, Corinna Vinschen wrote:

I have another one:

   $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
   /dev/sda\\.\PhysicalDrive0
   /dev/sda1
\\.\STORAGE#Volume#{781f8bd6-7d0d-11de-8012-806e6f6e6963}#0010#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
   /dev/sda2\\.\Volume{781f8bda-7d0d-11de-8012-806e6f6e6963}
   /dev/sda3\\.\D:

but there are two problems.

Up to the current Cygwin 1.7.6 the info from /proc/partitions is
incomplete for non-privileged users.  I just checked in a patch to
Cygwin which allows the full partition info also for non-priv'ed users.

Apart from that, the output of cygpath -w for devices isn't overly
helpful yet.  I look into improving that a bit.


Corinna



When I run echo /dev/s*, I only get /dev/shm /dev/stderr /dev/stdin 
/dev/stdout, how/why is yours showing the drive devices?



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



Re: associating device names with cygdrive directories

2010-08-26 Thread Corinna Vinschen
On Aug 26 13:26, Corinna Vinschen wrote:
 On Aug 25 16:32, Buchbinder, Barry (NIH/NIAID) [E] wrote:
  On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:
  On Linux, the mount command reveals the association between filesystem 
  names and /dev/ names, but Cygwin mount doesn't tell.
  
  Is this what you want?  (The multiple spaces are really tabs.)
  
  $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
 
 I have another one:
 
   $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
   /dev/sda\\.\PhysicalDrive0
   /dev/sda1
 \\.\STORAGE#Volume#{781f8bd6-7d0d-11de-8012-806e6f6e6963}#0010#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
   /dev/sda2\\.\Volume{781f8bda-7d0d-11de-8012-806e6f6e6963}
   /dev/sda3\\.\D:
 
 but there are two problems.
 
 Up to the current Cygwin 1.7.6 the info from /proc/partitions is
 incomplete for non-privileged users.  I just checked in a patch to
 Cygwin which allows the full partition info also for non-priv'ed users.
 
 Apart from that, the output of cygpath -w for devices isn't overly
 helpful yet.  I look into improving that a bit.

I applied a patch to cygpath which now prefers the \\.\X: DOS device
name over any other device name for harddisks.  In my case, the output
is now:

  $ for F in $(gawk '{if (FNR  2) print /dev/ $4;}' /proc/partitions) ; do 
echo $F$(./cygpath -w $F) ; done
  /dev/sda\\.\PhysicalDrive0
  /dev/sda1   \\.\Volume{781f8bd9-7d0d-11de-8012-806e6f6e6963}
  /dev/sda2   \\.\C:
  /dev/sda3   \\.\D:

/dev/sda1 is not available under a drive letter, so that's fine.


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



Re: associating device names with cygdrive directories

2010-08-26 Thread Corinna Vinschen
On Aug 26 08:11, Rolf Campbell wrote:
 On 2010-08-26 07:26, Corinna Vinschen wrote:
 I have another one:
 
$ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
/dev/sda\\.\PhysicalDrive0
/dev/sda1
  \\.\STORAGE#Volume#{781f8bd6-7d0d-11de-8012-806e6f6e6963}#0010#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
/dev/sda2\\.\Volume{781f8bda-7d0d-11de-8012-806e6f6e6963}
/dev/sda3\\.\D:
 
 but there are two problems.
 
 Up to the current Cygwin 1.7.6 the info from /proc/partitions is
 incomplete for non-privileged users.  I just checked in a patch to
 Cygwin which allows the full partition info also for non-priv'ed users.
 
 Apart from that, the output of cygpath -w for devices isn't overly
 helpful yet.  I look into improving that a bit.
 
 
 Corinna
 
 
 When I run echo /dev/s*, I only get /dev/shm /dev/stderr
 /dev/stdin /dev/stdout, how/why is yours showing the drive devices?

I got tangled up in copy/paste.  Actually the statement should have been:

  for F in $(gawk '{if (FNR  2) print /dev/ $4;}' /proc/partitions);
  do
echo $F$(./cygpath -w $F);
  done


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



Re: associating device names with cygdrive directories

2010-08-26 Thread Lee D. Rothstein

 On 8/25/2010 4:32 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:

$ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
/dev/scd0   \\.\D:
/dev/scd1   \Device\CdRom1
/dev/scd2   \Device\CdRom2
/dev/sda\\.\PhysicalDrive0
/dev/sda1   \\.\Volume{39f65722-0106-11df-b1c0-806d6172696f}
/dev/sda2   \Device\Harddisk0\Partition2
/dev/sdb\Device\Harddisk1\Partition0
/dev/sdb1   \Device\Harddisk1\Partition1
/dev/sdb2   \Device\Harddisk1\Partition2
/dev/sdc\Device\Harddisk2\Partition0
/dev/sdc1   \Device\Harddisk2\Partition1
/dev/sdc2   \Device\Harddisk2\Partition2
/dev/shmC:\cygwin\dev\shm
/dev/sr0\\.\D:
/dev/sr1\Device\CdRom1
/dev/sr2\Device\CdRom2
/dev/st0\Device\Tape0
/dev/st1\Device\Tape1
/dev/st2\Device\Tape2
/dev/stderr \dev\tty
/dev/stdin  \dev\tty
/dev/stdout /proc/2476/fd/pipe:[504]
 I'm running Cygwin 1.7.6-1, and when I use your command ('for F in 
...'), above, I
don't get all the devices in your list (for those that I have). Instead 
I get:


/dev/shmC:\_0\dev\shm
/dev/stderr \devty0
/dev/stdin  \devty0
/dev/stdout /proc/4876/fd/pipe:[800]

What's missing? At least:
* ty1
* 2 HD partitions
* 1 1.5 TB USB drive
* 1 TB RAID 0
* 2 CD/DVD drives (one USB, one internal)
* CF drive
* USB 16 GB flash drive

This is not earth shattering since everything (AFAIK) works (with either 
Windoze

or Cygwin), but what's the deal, do you think?

Thx,

Lee


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



Re: associating device names with cygdrive directories

2010-08-26 Thread Corinna Vinschen
On Aug 26 10:44, Lee D. Rothstein wrote:
  On 8/25/2010 4:32 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
 $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
 /dev/scd0   \\.\D:
 /dev/scd1   \Device\CdRom1
 /dev/scd2   \Device\CdRom2
 /dev/sda\\.\PhysicalDrive0
 /dev/sda1   \\.\Volume{39f65722-0106-11df-b1c0-806d6172696f}
 /dev/sda2   \Device\Harddisk0\Partition2
 /dev/sdb\Device\Harddisk1\Partition0
 /dev/sdb1   \Device\Harddisk1\Partition1
 /dev/sdb2   \Device\Harddisk1\Partition2
 /dev/sdc\Device\Harddisk2\Partition0
 /dev/sdc1   \Device\Harddisk2\Partition1
 /dev/sdc2   \Device\Harddisk2\Partition2
 /dev/shmC:\cygwin\dev\shm
 /dev/sr0\\.\D:
 /dev/sr1\Device\CdRom1
 /dev/sr2\Device\CdRom2
 /dev/st0\Device\Tape0
 /dev/st1\Device\Tape1
 /dev/st2\Device\Tape2
 /dev/stderr \dev\tty
 /dev/stdin  \dev\tty
 /dev/stdout /proc/2476/fd/pipe:[504]
  I'm running Cygwin 1.7.6-1, and when I use your command ('for F in
 ...'), above, 

http://cygwin.com/ml/cygwin/2010-08/msg00837.html


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



Re: associating device names with cygdrive directories

2010-08-26 Thread Charles D. Russell
 Is there an easy way to find the association of a given /dev/sd? with 
the corresponding /cygdrive/?.  Is there a good way to verify the 
association before writing to the device with dd?



Larry Hall wrote:
 you can certainly use the information from Disk Management to figure out
the mapping.

essentially, Disk 0 = /dev/sda, etc.


Thanks.  That is the mapping I was looking for.


Jeremy Bopp wrote:
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=17,codepage=cp437,iocharset=utf8)
/dev/sdb1 on /live/image2 type vfat
(rw,noatime,fmask=0022,dmask=0022,allow_utime=17,codepage=cp437,iocharset=utf8)
***

If I know that /dev/sda1 maps to /live/image1, then I can use df and ls  
on /live/image1
to identify the device - easier than using dd |strings on /dev/sda1.  
I'm concerned

with distinguishing among USB storage devices.

Corinna Vinschen wrote:

  $ for F in $(gawk '{if (FNR  2) print /dev/ $4;}' 
/proc/partitions) ; do echo $F$(./cygpath -w $F) ; done

  /dev/sda\\.\PhysicalDrive0
  /dev/sda1   \\.\Volume{781f8bd9-7d0d-11de-8012-806e6f6e6963}
  /dev/sda2   \\.\C:
  /dev/sda3   \\.\D:

/dev/sda1 is not available under a drive letter, so that's fine.
*
Nice, but evidently requires your patches, not working on my installation.
__
Andrey Repin wrote:

please, use reply option when replying to list, instead of writing new
message.
**
I would use gmane to enable this, but I'm on dial-up at the end of a 
miserable rural telephone line in Maine, where even DNS lookup usually 
takes several tries, and servers that are not patient enough for lots of 
retries simply won't work.

_

Thanks everyone.  I was successful in creating a bootable USB flash 
drive using Cygwin to dd from debian-live.img.
It was so slow, though, that I will forget about using Cygwin to clone a 
hard drive.


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



Re: associating device names with cygdrive directories

2010-08-25 Thread Larry Hall (Cygwin)

On 8/25/2010 2:49 PM, Charles D. Russell wrote:

What is the best way to find or predict the association of a given /dev/sd?
with the corresponding /cygdrive/?. Is there a good way to verify the
assignment before writing to the device with dd?


I think this link should help a little:

http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-posixdevices

The POSIX device names are generated from the Windows information/layout
of these devices.  So your best bet is to look to Windows to get the
device number - drive letter association and then fill in the rest
from there.  There is no one-stop shopping utility that I know of
that will do all that for you.

--
Larry Hall  http://www.rfk.com
RFK Partners, Inc.  (508) 893-9779 - RFK Office
216 Dalton Rd.  (508) 893-9889 - FAX
Holliston, MA 01746

_

A: Yes.

Q: Are you sure?

A: Because it reverses the logical flow of conversation.

Q: Why is top posting annoying in email?


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



Re: associating device names with cygdrive directories

2010-08-25 Thread Charles D. Russell

 On 8/25/2010 2:49 PM, Charles D. Russell wrote:

What is the best way to find or predict the association of a given 
/dev/sd?

with the corresponding /cygdrive/?. Is there a good way to verify the
assignment before writing to the device with dd?


I think this link should help a little:

http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-posixdevices

The POSIX device names are generated from the Windows information/layout
of these devices.  So your best bet is to look to Windows to get the
device number - drive letter association and then fill in the rest
from there.


I had read that reference, but don't see how it helps to find whether a 
given USB storage
device is sda, sdb, or whatever. I found that a flash drive was /dev/sdc 
by unplugging all other
USB devices and trial-and-error with dd if=/dev/sdc |od|less, but there 
must be a better way. I want to use multiple USB devices at the same 
time, and they don't all have stuff on them that I can recognize in 
binary. On Linux, the mount command reveals the association between 
filesystem names and /dev/ names, but Cygwin mount doesn't tell.


The cited reference mentions NT internal device names, but I don't 
know what those are or how to
find them. Is there some connection with the device numbers revealed by 
the Control Panel under Windows Computer Management/Storage/Disk 
Management?


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



Re: associating device names with cygdrive directories

2010-08-25 Thread Christopher Faylor
On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:
On Linux, the mount command reveals the association between filesystem
names and /dev/ names, but Cygwin mount doesn't tell.

Sorry that's not how the mount command works on Linux.  It's not always
easy to tell the device associated on linux either.  Sometimes you need
to look at dmesg output.  Unfortunately cygwin has nothing similar.

cgf

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



Re: associating device names with cygdrive directories

2010-08-25 Thread Jeremy Bopp
On 8/25/2010 3:03 PM, Christopher Faylor wrote:
 On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:
 On Linux, the mount command reveals the association between filesystem
 names and /dev/ names, but Cygwin mount doesn't tell.
 
 Sorry that's not how the mount command works on Linux.  It's not always
 easy to tell the device associated on linux either.  Sometimes you need
 to look at dmesg output.  Unfortunately cygwin has nothing similar.

The wodim command from the cdrtools package includes logic (-scanbus
option) which is able to identify SCSI devices under Cygwin.  It doesn't
map them to the /dev namespace, but it shows that something like you
need may be possible.  Wodim is also able to take a drive letter and
directly use that when writing an ISO file to the drive.

Maybe you could start there and craft a tool to do what you need.

-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



RE: associating device names with cygdrive directories

2010-08-25 Thread Buchbinder, Barry (NIH/NIAID) [E]
On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:
On Linux, the mount command reveals the association between filesystem 
names and /dev/ names, but Cygwin mount doesn't tell.

Is this what you want?  (The multiple spaces are really tabs.)

$ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
/dev/scd0   \\.\D:
/dev/scd1   \Device\CdRom1
/dev/scd2   \Device\CdRom2
/dev/sda\\.\PhysicalDrive0
/dev/sda1   \\.\Volume{39f65722-0106-11df-b1c0-806d6172696f}
/dev/sda2   \Device\Harddisk0\Partition2
/dev/sdb\Device\Harddisk1\Partition0
/dev/sdb1   \Device\Harddisk1\Partition1
/dev/sdb2   \Device\Harddisk1\Partition2
/dev/sdc\Device\Harddisk2\Partition0
/dev/sdc1   \Device\Harddisk2\Partition1
/dev/sdc2   \Device\Harddisk2\Partition2
/dev/shmC:\cygwin\dev\shm
/dev/sr0\\.\D:
/dev/sr1\Device\CdRom1
/dev/sr2\Device\CdRom2
/dev/st0\Device\Tape0
/dev/st1\Device\Tape1
/dev/st2\Device\Tape2
/dev/stderr \dev\tty
/dev/stdin  \dev\tty
/dev/stdout /proc/2476/fd/pipe:[504]

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


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



Re: associating device names with cygdrive directories

2010-08-25 Thread Larry Hall (Cygwin)

On 8/25/2010 4:11 PM, Jeremy Bopp wrote:

On 8/25/2010 3:03 PM, Christopher Faylor wrote:

On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:

On Linux, the mount command reveals the association between filesystem
names and /dev/ names, but Cygwin mount doesn't tell.


Sorry that's not how the mount command works on Linux.  It's not always
easy to tell the device associated on linux either.  Sometimes you need
to look at dmesg output.  Unfortunately cygwin has nothing similar.


The wodim command from the cdrtools package includes logic (-scanbus
option) which is able to identify SCSI devices under Cygwin.  It doesn't
map them to the /dev namespace, but it shows that something like you
need may be possible.  Wodim is also able to take a drive letter and
directly use that when writing an ISO file to the drive.

Maybe you could start there and craft a tool to do what you need.


That might be the easiest way to creating a tool, since you'd have
existing logic to leverage.  But to answer your original question, you
can certainly use the information from Disk Management to figure out
the mapping.

http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/devices.cc?rev=1.31content-type=text/x-cvsweb-markupcvsroot=src

should help in that regard.  But essentially, Disk 0 = /dev/sda, etc.

--
Larry Hall  http://www.rfk.com
RFK Partners, Inc.  (508) 893-9779 - RFK Office
216 Dalton Rd.  (508) 893-9889 - FAX
Holliston, MA 01746

_

A: Yes.

Q: Are you sure?

A: Because it reverses the logical flow of conversation.

Q: Why is top posting annoying in email?


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



Re: associating device names with cygdrive directories

2010-08-25 Thread Charles D. Russell
 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=17,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.




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



Re: associating device names with cygdrive directories

2010-08-25 Thread Jeremy Bopp
On 8/25/2010 3:32 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
 On Wed, Aug 25, 2010 at 02:47:21PM -0500, Charles D. Russell wrote:
 On Linux, the mount command reveals the association between filesystem 
 names and /dev/ names, but Cygwin mount doesn't tell.
 
 Is this what you want?  (The multiple spaces are really tabs.)
 
 $ for F in /dev/s* ; do echo $F$(cygpath -w $F) ; done
 /dev/scd0   \\.\D:
 /dev/scd1   \Device\CdRom1
 /dev/scd2   \Device\CdRom2

snip

That's a pretty clever solution.  Too bad there is no way to use cygpath
to go the other direction.  Ideally, we could do something like:

$ cygpath -t device D:
/dev/scd0

Of course it's hard to justify adding such functionality without a good
use case.

-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



Re: associating device names with cygdrive directories

2010-08-25 Thread Jeremy Bopp
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=17,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=17,codepage=cp437,iocharset=utf8)
/dev/sdb1 on /live/image2 type vfat
(rw,noatime,fmask=0022,dmask=0022,allow_utime=17,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



Re: associating device names with cygdrive directories

2010-08-25 Thread Andrey Repin
Greetings, Charles D. Russell!

   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=17,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.

It's a very rough guess, and only work in limited amount of instances.
You still have to check if the target device you got from mount table is
actually a block device.

And, please, use reply option when replying to list, instead of writing new
message.


--
WBR,
 Andrey Repin (anrdae...@freemail.ru) 26.08.2010, 6:31

Sorry for my terrible english...


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



Re: associating device names with cygdrive directories

2010-08-25 Thread Christopher Faylor
On Wed, Aug 25, 2010 at 04:32:49PM -0500, Jeremy Bopp wrote:
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=17,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=17,codepage=cp437,iocharset=utf8)
/dev/sdb1 on /live/image2 type vfat
(rw,noatime,fmask=0022,dmask=0022,allow_utime=17,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.

No, actually what I was saying is that the mount command doesn't know
which device is associated with a CD or disk.  Something had to
*generate* a command like:

mount -t vfat /dev/sda1 /live/image

That information usually comes from /etc/fstab and /etc/fstab would
probably be generated by something which scanned the available devices
to produce the file.

Sure, when you type mount you will see mounted directories but
cygdrive directories aren't really mounted in the strictest sense.  The
mount table is one place where Cygwin and Linux are quite different.

cgf

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