Disk size

The disk size reported for a (SCSI) disk on Windows is slightly
different that the size reported on a Macintosh.

The difference in size is significant enough that if the disk is
partitioned on a Mac (using an Apple Partition map, obviously) the last
partition actually extends past the point where Windows thinks the disk
ends.

Reading and writing to the disk past the end returns an error - but the
data appears to be written correctly.

Can anyone confirm and/or explain this behavior?

  • Cliff

I haven’t used a Mac in about 10 years, but for years the Mac use 1000 for
1K while Windows uses 1024 for 1K. If this is still the case that would
explain your differences.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Cliff Russell”
To: “Windows System Software Devs Interest List”
Sent: Saturday, December 20, 2003 5:19 PM
Subject: [ntdev] Disk size

> The disk size reported for a (SCSI) disk on Windows is slightly
> different that the size reported on a Macintosh.
>
> The difference in size is significant enough that if the disk is
> partitioned on a Mac (using an Apple Partition map, obviously) the last
> partition actually extends past the point where Windows thinks the disk
> ends.
>
> Reading and writing to the disk past the end returns an error - but the
> data appears to be written correctly.
>
> Can anyone confirm and/or explain this behavior?
>
> - Cliff
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Or, one is reading CHS values and the other is reading LBA values; this too
would account for a difference.

Jamey Kirby, Windows DDK MVP
StorageCraft Inc.
xxxxx@storagecraft.com
http://www.storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Saturday, December 20, 2003 2:37 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Disk size

I haven’t used a Mac in about 10 years, but for years the Mac use 1000 for
1K while Windows uses 1024 for 1K. If this is still the case that would
explain your differences.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Cliff Russell”
To: “Windows System Software Devs Interest List”
Sent: Saturday, December 20, 2003 5:19 PM
Subject: [ntdev] Disk size

> The disk size reported for a (SCSI) disk on Windows is slightly
> different that the size reported on a Macintosh.
>
> The difference in size is significant enough that if the disk is
> partitioned on a Mac (using an Apple Partition map, obviously) the last
> partition actually extends past the point where Windows thinks the disk
> ends.
>
> Reading and writing to the disk past the end returns an error - but the
> data appears to be written correctly.
>
> Can anyone confirm and/or explain this behavior?
>
> - Cliff
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

This sounds a little more likely.

I am using IOCTL_DISK_GET_DRIVE_GEOMETRY on Windows, I’m guessing that
reads CHS values? Can I read the LBA value on windows?

On 20-Dec-03, at 2:49 PM, Jamey Kirby wrote:

Or, one is reading CHS values and the other is reading LBA values;
this too
would account for a difference.

Jamey Kirby, Windows DDK MVP
StorageCraft Inc.
xxxxx@storagecraft.com
http://www.storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Saturday, December 20, 2003 2:37 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Disk size

I haven’t used a Mac in about 10 years, but for years the Mac use 1000
for
1K while Windows uses 1024 for 1K. If this is still the case that
would
explain your differences.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Cliff Russell”
> To: “Windows System Software Devs Interest List”
> Sent: Saturday, December 20, 2003 5:19 PM
> Subject: [ntdev] Disk size
>
>
>> The disk size reported for a (SCSI) disk on Windows is slightly
>> different that the size reported on a Macintosh.
>>
>> The difference in size is significant enough that if the disk is
>> partitioned on a Mac (using an Apple Partition map, obviously) the
>> last
>> partition actually extends past the point where Windows thinks the
>> disk
>> ends.
>>
>> Reading and writing to the disk past the end returns an error - but
>> the
>> data appears to be written correctly.
>>
>> Can anyone confirm and/or explain this behavior?
>>
>> - Cliff
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@acm.org
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@telus.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
Cliff Russell
Software Engineer

xxxxx@atimi.com
250 818 5711

Atimi Software: Software Development - On Time.
http://www.atimi.com

Actually, I think Windows is reading LBA. Try sending a SCSI passthrough to
the device asking for the CHS page. Sorry that I do not have any sample code
to send you :frowning:

Jamey Kirby, Windows DDK MVP
StorageCraft Inc.
xxxxx@storagecraft.com
http://www.storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Cliff Russell
Sent: Saturday, December 20, 2003 3:10 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Disk size

This sounds a little more likely.

I am using IOCTL_DISK_GET_DRIVE_GEOMETRY on Windows, I’m guessing that
reads CHS values? Can I read the LBA value on windows?

On 20-Dec-03, at 2:49 PM, Jamey Kirby wrote:

Or, one is reading CHS values and the other is reading LBA values;
this too
would account for a difference.

Jamey Kirby, Windows DDK MVP
StorageCraft Inc.
xxxxx@storagecraft.com
http://www.storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Saturday, December 20, 2003 2:37 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Disk size

I haven’t used a Mac in about 10 years, but for years the Mac use 1000
for
1K while Windows uses 1024 for 1K. If this is still the case that
would
explain your differences.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Cliff Russell”
> To: “Windows System Software Devs Interest List”
> Sent: Saturday, December 20, 2003 5:19 PM
> Subject: [ntdev] Disk size
>
>
>> The disk size reported for a (SCSI) disk on Windows is slightly
>> different that the size reported on a Macintosh.
>>
>> The difference in size is significant enough that if the disk is
>> partitioned on a Mac (using an Apple Partition map, obviously) the
>> last
>> partition actually extends past the point where Windows thinks the
>> disk
>> ends.
>>
>> Reading and writing to the disk past the end returns an error - but
>> the
>> data appears to be written correctly.
>>
>> Can anyone confirm and/or explain this behavior?
>>
>> - Cliff
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@acm.org
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@telus.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
Cliff Russell
Software Engineer

xxxxx@atimi.com
250 818 5711

Atimi Software: Software Development - On Time.
http://www.atimi.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

If the device is not a real SCSI one it’s likely not to support this mode
page at all. Sending only READ CAPACITY (25h AFAIR) will be enough for him
and will work always.

And it looks like Windows uses a cylinder granularity when calculating the
disk and partition sizes. So with the default geometry the values that are
smaller then 8 megabytes (cylinder size) will be truncated. Could this be
the guys case?

Regards,
Anton Kolomyeytsev

Actually, I think Windows is reading LBA. Try sending a SCSI passthrough to
the device asking for the CHS page. Sorry that I do not have any sample code
to send you :frowning:

Jamey Kirby, Windows DDK MVP
StorageCraft Inc.
xxxxx@storagecraft.com
http://www.storagecraft.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Cliff Russell
Sent: Saturday, December 20, 2003 3:10 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Re: Disk size

This sounds a little more likely.

I am using IOCTL_DISK_GET_DRIVE_GEOMETRY on Windows, I’m guessing that
reads CHS values? Can I read the LBA value on windows?

On 20-Dec-03, at 2:49 PM, Jamey Kirby wrote:

> Or, one is reading CHS values and the other is reading LBA values;
> this too
> would account for a difference.
>
> Jamey Kirby, Windows DDK MVP
> StorageCraft Inc.
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
> Sent: Saturday, December 20, 2003 2:37 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Disk size
>
> I haven’t used a Mac in about 10 years, but for years the Mac use 1000
> for
> 1K while Windows uses 1024 for 1K. If this is still the case that
> would
> explain your differences.
>
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>
> ----- Original Message -----
> From: “Cliff Russell”
> > To: “Windows System Software Devs Interest List”
> > Sent: Saturday, December 20, 2003 5:19 PM
> > Subject: [ntdev] Disk size
> >
> >
> >> The disk size reported for a (SCSI) disk on Windows is slightly
> >> different that the size reported on a Macintosh.
> >>
> >> The difference in size is significant enough that if the disk is
> >> partitioned on a Mac (using an Apple Partition map, obviously) the
> >> last
> >> partition actually extends past the point where Windows thinks the
> >> disk
> >> ends.
> >>
> >> Reading and writing to the disk past the end returns an error - but
> >> the
> >> data appears to be written correctly.
> >>
> >> Can anyone confirm and/or explain this behavior?
> >>
> >> - Cliff
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: xxxxx@acm.org
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@telus.net
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - -
> Cliff Russell
> Software Engineer
>
> xxxxx@atimi.com
> 250 818 5711
>
> Atimi Software: Software Development - On Time.
> http://www.atimi.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

I have read most of the messages sent in response, so here are my
observations. Microsoft seems to have adopted the 63 sectors per track
and 255 heads geometry as standard. This means that any space up to
8,224,768, for 512 byte sector media, will not be included in the disk
geometry calls. There is one trick I am using that seems to work very
well and works on 2000 and XP. I use IOCTL_DISK_GET_PARTITION_INFO on
the PhysicalDriven device. That gives the size in bytes which can then
be reduced to sectors with the bytes per sector information from
IOCTL_DISK_GET_DRIVE_GEOMETRY on the same device handle.

Some early Microsoft operating systems might reduce the drive size by
one track for the old IBM Advanced Diagnostics utility which could use
that track for write testing without destroying user data. It has been
a hold over that still exists in a lot of utilities. Since you have a
real SCSI drive, you can use SPTI to send a read capacity SRB to the
drive.

“Cliff Russell” wrote in message
news:xxxxx@ntdev…
>
> The disk size reported for a (SCSI) disk on Windows is slightly
> different that the size reported on a Macintosh.
>
> The difference in size is significant enough that if the disk is
> partitioned on a Mac (using an Apple Partition map, obviously) the
last
> partition actually extends past the point where Windows thinks the
disk
> ends.
>
> Reading and writing to the disk past the end returns an error - but
the
> data appears to be written correctly.
>
> Can anyone confirm and/or explain this behavior?
>
> - Cliff
>
>
>

> well and works on 2000 and XP. I use IOCTL_DISK_GET_PARTITION_INFO on

FORMAT utility (who needs the partition size, surely) uses
IOCTL_DISK_GET_PARTITION_INFO on < XP, and the new IOCTL_DISK_GET_LENGTH_INFO
on >= XP.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Windows uses SCSIOP_READ_CAPACITY.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jamey Kirby”
To: “Windows System Software Devs Interest List”
Sent: Sunday, December 21, 2003 2:19 AM
Subject: [ntdev] Re: Disk size

> Actually, I think Windows is reading LBA. Try sending a SCSI passthrough to
> the device asking for the CHS page. Sorry that I do not have any sample code
> to send you :frowning:
>
>
>
> Jamey Kirby, Windows DDK MVP
> StorageCraft Inc.
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Cliff Russell
> Sent: Saturday, December 20, 2003 3:10 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Re: Disk size
>
> This sounds a little more likely.
>
> I am using IOCTL_DISK_GET_DRIVE_GEOMETRY on Windows, I’m guessing that
> reads CHS values? Can I read the LBA value on windows?
>
> On 20-Dec-03, at 2:49 PM, Jamey Kirby wrote:
>
> > Or, one is reading CHS values and the other is reading LBA values;
> > this too
> > would account for a difference.
> >
> > Jamey Kirby, Windows DDK MVP
> > StorageCraft Inc.
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
> > Sent: Saturday, December 20, 2003 2:37 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Re: Disk size
> >
> > I haven’t used a Mac in about 10 years, but for years the Mac use 1000
> > for
> > 1K while Windows uses 1024 for 1K. If this is still the case that
> > would
> > explain your differences.
> >
> > Don Burn (MVP, Windows DDK)
> > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >
> > ----- Original Message -----
> > From: “Cliff Russell”
> > To: “Windows System Software Devs Interest List”
> > Sent: Saturday, December 20, 2003 5:19 PM
> > Subject: [ntdev] Disk size
> >
> >
> >> The disk size reported for a (SCSI) disk on Windows is slightly
> >> different that the size reported on a Macintosh.
> >>
> >> The difference in size is significant enough that if the disk is
> >> partitioned on a Mac (using an Apple Partition map, obviously) the
> >> last
> >> partition actually extends past the point where Windows thinks the
> >> disk
> >> ends.
> >>
> >> Reading and writing to the disk past the end returns an error - but
> >> the
> >> data appears to be written correctly.
> >>
> >> Can anyone confirm and/or explain this behavior?
> >>
> >> - Cliff
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: xxxxx@acm.org
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@telus.net
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - -
> Cliff Russell
> Software Engineer
>
> xxxxx@atimi.com
> 250 818 5711
>
> Atimi Software: Software Development - On Time.
> http://www.atimi.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com