4

In Linux I can use df to show me which Windows drives (like /cygdrive/c) correspond to the virtual files /dev/disk/sdd1.

/dev/sdf1         932G  932G     0 100% /media/sarnobat/c
/dev/sde1         299G  260G   40G  87% /media/sarnobat/d
/dev/sdd1         299G  166G  133G  56% /media/sarnobat/e

But Cygwin's df output doesn't show this:

C:                             312568640 210201636 102367004  68% /cygdrive/c
D:                             244187968 229638796  14549172  95% /cygdrive/d
E:                             312568640 281085516  31483124  90% /cygdrive/e

Is there a way to get it? I tried looking in /proc/* but I just can't find it anywhere. I was thinking maybe this device addressing scheme simply isn't applicable in Windows but if I look in the /dev/ folder there is a list:

$ ls -l /dev/ | grep sd 
brw-rw-rw-  1 admin   None   8,   0 Jul 17  2017 sda
brw-rw-rw-  1 admin   None   8,   1 Jul 17  2017 sda1
brw-rw-rw-  1 admin   None   8,  16 Jul 17  2017 sdb
brw-rw-rw-  1 admin   None   8,  17 Jul 17  2017 sdb1
brw-rw-rw-  1 admin   None   8,  32 Jul 17  2017 sdc
brw-rw-rw-  1 admin   None   8,  33 Jul 17  2017 sdc1
brw-rw-rw-  1 admin   None   8,  48 Jul 17  2017 sdd
brw-rw-rw-  1 admin   None   8,  49 Jul 17  2017 sdd1

Why I'm asking

I want to make use of the excellent dd tool to make backups of my disks that are physically connected to my windows machine.

Workaround

I don't like this solution :(

for F in /dev/s* ; do echo "$F    $(cygpath -w $F)" ; done

https://stackoverflow.com/a/42618609/714112

5

Use /proc/partitions

$ cat /proc/partitions
major minor  #blocks  name   win-mounts

    8     0 175825944 sda
    8     1 175824896 sda1   C:\
    8    16 1953514582 sdb
    8    17 1953512448 sdb1   E:\

This feature was added on https://cygwin.com/cygwin-ug-net/ov-new.html#ov-new1.7.33

  • Mine doewsn't show the win-mounts column. My Cygwin version is 2014. Do you think that the version might be the issue? CYGWIN_NT-5.1 mymachinename 1.7.27(0.271/5/3) 2013-12-09 11:57 i686 Cygwin – Sridhar Sarnobat Jul 18 '17 at 18:55
  • 1
    Mine does. A few months late, but try updating it and seeing whether that makes a difference. – Hashim Oct 28 '17 at 1:38
  • I upgraded to a 2018 build and indeed it works. – Sridhar Sarnobat May 10 '18 at 11:34
  • Hmmmm, I just tried this again and it doesn't show the win-mounts column. Maybe it doesn't work on XP, but does on newer versions of Windows. – Sridhar Sarnobat Jan 21 at 8:05
  • You can try with cygpath -w /dev/sdaX for X=1.2.. and same for sdb, sdc... – matzeri Jan 21 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.