Solved

Read Native Max LBA using C#

Posted on 2009-05-14
2
688 Views
Last Modified: 2012-05-07
I'm trying to figure out how to read in the native max LBA using C#.  For example, if someone changes the max LBA of a drive, I want to be able to read the original max LBA set by the manufacturer of the drive.  Can anybody help me with this, or point me in the right direction?

Thanks in advance!
0
Comment
Question by:dev117
  • 2
2 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24449421
there are basically two kinds of LBA: 28 bit and 48 bit. Whether a drive supports either of those, depends on the drive's driver and sometimes BIOS settings. In older windows versions, the ATAPI driver had a setting for either of those, and it needs to be enabled to allow large LBA. Info on how to check and how to change that is here: http://support.microsoft.com/kb/303013

In the event you mean what the largest LBA number is that a drive allows, you can do a little calculation based on the absolute size of the drive. The sector size is usually 512 bytes on modern windows systems (you can check to be sure). The maximum LBA sector number is then essentially equal to the absolute size divided by 512.

In the event you mean to find what the maximum size can be of a drive when 28-bit or 48-bit LBA is on, it is simple. 28-bit can do 2^28 * 512 = 137,438,953,472, or 128 GB. 48-bit LBA can do 2^48 * 512 = 144,115,188,075,855,872 or 134,217,728 GB or 128 PB (petabytes).

-- Abel --
0
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24449467
In addition, this may be of help to get the real size of a physical drive (the middle section in my post) which was also used to get the LBA size. It is in VB6 code, if you need help translating it to C# let me know: http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_22825938.html
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now