Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum number of drives in windows?

I'm trying to figure out the available disk space programmatically in windows. For this, I need to first get a list of the available drives, then check which of those are local drives and then query the available bytes on each local drive.

I'm a bit stuck on the first part, where the API presents two functions:

  1. GetLogicalDrives (http://msdn.microsoft.com/en-us/library/aa364972(VS.85).aspx) which gives you a DWORD with the bits set (bit 0 if drive A is present, bit 1 if drive B etc)
  2. GetLogicalDriveStrings (http://msdn.microsoft.com/en-us/library/aa364975(VS.85).aspx) which gives you the actual strings.

Now, although I'll be using strings later on, I'd prefer using the first option for querying. However, on my system a DWORD is typedef-ed to "unsigned long", which is 4 bytes, whereas drive letters only range A-Z (26 - i think - characters). Obviously, one can define more than 26 drives on their system (however unlikely they are to do so) - so I was wondering if there was any convention for those drives. Can someone point me to a resource on this?

Thanks.

like image 860
laura Avatar asked Dec 22 '09 08:12

laura


People also ask

How many drives can you have in Windows?

Most motherboards come with four to six SATA slots which means you can install up to four to six hard disk drives on your PC, excluding external HDDs.

Does Windows 10 have a drive limit?

Windows 7/8 or Windows 10 Maximum Hard Drive Size Like in other Windows operating systems, users can only use 2TB or 16TB space in Windows 10 no matter how large the hard disk is, if they initialize their disk to MBR. At this time, some of you might ask why there are 2TB and 16TB limit.

Is there a limit to number of hard drives?

As many as you want to. The only requirements are that you have a controller connection for each drive, power to operate it, and a place to physically stick it. Contrary to some of the other answers,m you are not limited to the controller ports on your motherboard.

How many partitions does Windows 10 allow?

To save drive space, consider creating logical partitions to get around the four-partition limit. For more info, see Configure more than four partitions on a BIOS/MBR-based hard disk.


3 Answers

  1. DWORD is always 4 bytes, regardless of the system (it's a Win32 type).

  2. The maximum for drive letters in Windows is 26. Because English alphabet has only 26 letters :). However, Windows allows two ways to mount a volume:

    • to a drive letter
    • to a directory (on an NTFS volume). You can mount one volume to multiple locations (but no more than one drive letter, IIRC). A GUI for this task is presented by Control Panel -> Administrative Tools -> Computer Management -> Disk Management.

If you want to have more than 26 drives with the additional drives being redirects to already active drives and are okay with them not working properly in most programs, then you can assign more with the following method (be warned they won't even show up in the file explorer):

subst ♪: C:\Temp\
cd /D ♪:\

and to delete them (also they aren't preserved through restarts):

subst /D ♪:

You can enumerate all volumes and their mount points as described in this article.

like image 59
atzz Avatar answered Oct 03 '22 16:10

atzz


You could use WMI. The following WMI query should list all drives:

SELECT * FROM Win32_DiskDrive
like image 27
Vinko Vrsalovic Avatar answered Oct 03 '22 17:10

Vinko Vrsalovic


It it not sufficient to enumerate MS-DOS drives (there can be at most 26 of them, by the way, although each can be bound twice, once globally and once locally in your session), a volume can, for example, be mounted to a directory. What you want is probably to enumerate all volumes in the system, using FindFirstVolume et al. Take a look at the associated MSDN example.

like image 27
avakar Avatar answered Oct 03 '22 16:10

avakar