I have two partitions with the same device number:
$ stat -c "%D" /cygdrive/c
ec6d967e
$ stat -c "%D" /cygdrive/g
ec6d967e
I believe this is because G: was restored from an image of C:. C:\cygwin64 is mounted on /. When I try to run diff -r / /cygdrive/g/cygwin64
then it skips over directories with the same device + inode number. This is not a bug in diff, per this bug report:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33467
So how can I change the device number for the G: partition? I tried using gdisk 1.0.4 but no luck; the unique disk and unique partition GUID's were already different in each case.
I'm using Windows 7 Bootcamp and the partitions have the same device number as each other in OS X 10.6.8 as well, although they are different from the Cygwin device number.
Best Answer
Under Cygwin with an NTFS filesystem, the device number comes from the NTFS Volume Serial Number. There is a tool called VolumeID from Microsoft that lets you change it.
https://docs.microsoft.com/en-us/sysinternals/downloads/volumeid
Unfortunately it doesn't change under OS X. I'm happy enough being limited to Cygwin for now. On the other hand, this tool only changes the last 4 bytes of the serial when it is an 8-byte field.
https://www.ntfs.com/ntfs-partition-boot-sector.htm
I was unable to find a command line tool to set the full 8 bytes. However, AOMEI Partition Assistant can handle it, and apparently DiskGenius can too.