By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,376 Members | 1,566 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,376 IT Pros & Developers. It's quick & easy.

Dynamic vs Basic Partitions

P: n/a
I don't care what .net language this come in but I really need to determine
if a disk is dynamic or basic. I have posted something in the WMI group but
no one knows how to do it. Does anyone have any idea how I can determine
this? At this point I don't care if it is a third plugin freeware app I use
that writes it to a text file that I could read out.

Thanks!
Sep 19 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi,

Dyanamic disks are partitioned using Logical Disk Manager (LDM)
partitioning. The LDM subsystem in Windows, which consists of user-mode and
device driver components, oversees dynamic disks. LDM maintains one unified
database that stores partitioning information for all the dynamic disks on
a system--including multipartition-volume configuration.

As far as I know, there're no API for calling LDM service.

The LDM database resides in a 1-MB reserved space at the end of each
dynamic disk. Unfortunately this database's format is not officially
documented.

Sysinternals.com has a freeware called ldmdump.exe
(http://www.sysinternals.com/Utilities/LdmDump.html) which can display the
database content.

For a basic disk, the output will be:
Logical Disk Manager Configuration Dump v1.03
Copyright (C) 2000-2002 Mark Russinovich

Disk does not have LDM database.

For a dynamic disk, the output will be:

Logical Disk Manager Configuration Dump v1.03
Copyright (C) 2000-2002 Mark Russinovich

PRIVATE HEAD:
Signature : PRIVHEAD
Version : 2.11
Disk Id : 49448001-f838-447d-836d-85002666e401
Host Id : 1b77da20-c717-11d0-a5be-00a0c91db73c
Disk Group Id : 158f43d4-430b-4c1e-b6ad-43254e9c27d8
Disk Group Name : Sha-wawang-v5Dg0
Logical disk start : 3F
Logical disk size : 9C25FE (4996 MB)
Configuration start: 9C3520
Configuration size : 800 (1 MB)
Number of TOCs : 1
TOC size : 7FE (1023 KB)
Number of Configs : 1
Config size : 5AC (726 KB)
Number of Logs : 1
Log size : DC (110 KB)

...

So as a workaround, you may use this tool to output the information and
check for string "Disk does not have LDM database" to determine whether or
not this is a basic disk.

Please reply to let me know whether or not you need further information.
Thanks.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 20 '06 #2

P: n/a
That will work perfect. I will just run that in a command prompt and read it
out one by one and remove the dynamic disks from my array.

Thanks!

"Walter Wang [MSFT]" wrote:
Hi,

Dyanamic disks are partitioned using Logical Disk Manager (LDM)
partitioning. The LDM subsystem in Windows, which consists of user-mode and
device driver components, oversees dynamic disks. LDM maintains one unified
database that stores partitioning information for all the dynamic disks on
a system--including multipartition-volume configuration.

As far as I know, there're no API for calling LDM service.

The LDM database resides in a 1-MB reserved space at the end of each
dynamic disk. Unfortunately this database's format is not officially
documented.

Sysinternals.com has a freeware called ldmdump.exe
(http://www.sysinternals.com/Utilities/LdmDump.html) which can display the
database content.

For a basic disk, the output will be:
Logical Disk Manager Configuration Dump v1.03
Copyright (C) 2000-2002 Mark Russinovich

Disk does not have LDM database.

For a dynamic disk, the output will be:

Logical Disk Manager Configuration Dump v1.03
Copyright (C) 2000-2002 Mark Russinovich

PRIVATE HEAD:
Signature : PRIVHEAD
Version : 2.11
Disk Id : 49448001-f838-447d-836d-85002666e401
Host Id : 1b77da20-c717-11d0-a5be-00a0c91db73c
Disk Group Id : 158f43d4-430b-4c1e-b6ad-43254e9c27d8
Disk Group Name : Sha-wawang-v5Dg0
Logical disk start : 3F
Logical disk size : 9C25FE (4996 MB)
Configuration start: 9C3520
Configuration size : 800 (1 MB)
Number of TOCs : 1
TOC size : 7FE (1023 KB)
Number of Configs : 1
Config size : 5AC (726 KB)
Number of Logs : 1
Log size : DC (110 KB)

...

So as a workaround, you may use this tool to output the information and
check for string "Disk does not have LDM database" to determine whether or
not this is a basic disk.

Please reply to let me know whether or not you need further information.
Thanks.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 20 '06 #3

P: n/a
Walter,

I thought I was golden with that program but I actually came across a
computer that show LDM information for a basic disk. When I run it on other
comps it gives me the no LDM database for all the basic disks but this one
server does have LDM info on the basic disk. Not sure how that is possible
but I am going to need a different solution. I know it is possible because I
have other programs that run and only show basic disks on the comp.

Thanks again!

"Walter Wang [MSFT]" wrote:
Hi,

Dyanamic disks are partitioned using Logical Disk Manager (LDM)
partitioning. The LDM subsystem in Windows, which consists of user-mode and
device driver components, oversees dynamic disks. LDM maintains one unified
database that stores partitioning information for all the dynamic disks on
a system--including multipartition-volume configuration.

As far as I know, there're no API for calling LDM service.

The LDM database resides in a 1-MB reserved space at the end of each
dynamic disk. Unfortunately this database's format is not officially
documented.

Sysinternals.com has a freeware called ldmdump.exe
(http://www.sysinternals.com/Utilities/LdmDump.html) which can display the
database content.

For a basic disk, the output will be:
Logical Disk Manager Configuration Dump v1.03
Copyright (C) 2000-2002 Mark Russinovich

Disk does not have LDM database.

For a dynamic disk, the output will be:

Logical Disk Manager Configuration Dump v1.03
Copyright (C) 2000-2002 Mark Russinovich

PRIVATE HEAD:
Signature : PRIVHEAD
Version : 2.11
Disk Id : 49448001-f838-447d-836d-85002666e401
Host Id : 1b77da20-c717-11d0-a5be-00a0c91db73c
Disk Group Id : 158f43d4-430b-4c1e-b6ad-43254e9c27d8
Disk Group Name : Sha-wawang-v5Dg0
Logical disk start : 3F
Logical disk size : 9C25FE (4996 MB)
Configuration start: 9C3520
Configuration size : 800 (1 MB)
Number of TOCs : 1
TOC size : 7FE (1023 KB)
Number of Configs : 1
Config size : 5AC (726 KB)
Number of Logs : 1
Log size : DC (110 KB)

...

So as a workaround, you may use this tool to output the information and
check for string "Disk does not have LDM database" to determine whether or
not this is a basic disk.

Please reply to let me know whether or not you need further information.
Thanks.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 21 '06 #4

P: n/a
I'm interested in the case that ldmdump.exe reports information on a basic
disk. Would you please post the output here or send it to me?

Another approach is to use diskpart.exe, its command "list disk"
(http://www.microsoft.com/resources/d...ll/proddocs/en
-us/diskpart.mspx?mfr=true) can show current disk list:
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 149 GB 0 B *

If the disk is a dynamic disk, the field "Dyn" will be marked as "*".

You can create a text file with content "list disk" and pass the file to
diskpart.exe /s:

diskpart.exe /s 1.txt

Fore more information about dynamic disk, refer to
http://technet2.microsoft.com/Window...c-949c-4105-90
14-e3252e4edb271033.mspx?mfr=true

Sep 22 '06 #5

P: n/a
That might work. Thanks again. I would be glad to send you the info. How
can I get it to you?

"Walter Wang [MSFT]" wrote:
I'm interested in the case that ldmdump.exe reports information on a basic
disk. Would you please post the output here or send it to me?

Another approach is to use diskpart.exe, its command "list disk"
(http://www.microsoft.com/resources/d...ll/proddocs/en
-us/diskpart.mspx?mfr=true) can show current disk list:
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 149 GB 0 B *

If the disk is a dynamic disk, the field "Dyn" will be marked as "*".

You can create a text file with content "list disk" and pass the file to
diskpart.exe /s:

diskpart.exe /s 1.txt

Fore more information about dynamic disk, refer to
http://technet2.microsoft.com/Window...c-949c-4105-90
14-e3252e4edb271033.mspx?mfr=true

Sep 22 '06 #6

P: n/a
You can send the information to me via my email (see my signature). Please
let me know whether diskpart.exe works or not. Thank you.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 25 '06 #7

P: n/a
Hi Joey,

I've done more researching and consulting recently. If you're interested,
we can use DeviceIoControl with IOCTL_DISK_GET_DRIVE_LAYOUT_EX to get the
partition types on the drive. As long as we can find one partition with LDM
related information, we know the disk is a Dynamic disk.

Here's the sample code of a C++ Win32 Console application which prints out
is the first disk Dynamic/Basic disk:

#include "stdafx.h"
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <winioctl.h>
// #include <diskguid.h>
const GUID PARTITION_LDM_DATA_GUID = {0xAF9B60A0L, 0x1431, 0x4F62, 0xBC,
0x68, 0x33, 0x11, 0x71, 0x4A, 0x69, 0xAD}; // Logical Disk Manager data
partition
#define PHYSICALDRIVE TEXT("PhysicalDrive")

void ErrorExit(LPTSTR lpszFunction)
{
LPVOID lpMsgBuf;
DWORD dw = GetLastError();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

wprintf(TEXT("%s failed with error %d: %s\n"),
lpszFunction, dw, lpMsgBuf);

LocalFree(lpMsgBuf);
ExitProcess(dw);
}

bool IsPartitionDynamic(PARTITION_INFORMATION_EX *pPie)
{
bool ret = false;
if (pPie->PartitionStyle == PARTITION_STYLE_MBR)
{
ret = pPie->Mbr.PartitionType == PARTITION_LDM;
} else if (pPie->PartitionStyle == PARTITION_STYLE_GPT)
{
ret = IsEqualGUID(pPie->Gpt.PartitionType, PARTITION_LDM_DATA_GUID);
}
return ret;
}

bool IsDiskDynamic(int nDiskNo)
{
bool ret = false;
TCHAR szDiskPath[MAX_PATH];
wsprintf(szDiskPath, TEXT("\\\\.\\%s%u"), PHYSICALDRIVE, nDiskNo);
HANDLE hDisk = CreateFile(szDiskPath, GENERIC_READ, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDisk != INVALID_HANDLE_VALUE) {
DRIVE_LAYOUT_INFORMATION_EX *pInfo;
DWORD dwBytesReturn = 0;
int estimatedPartitionCount = 4;
loop:
DWORD dwSize = sizeof(DRIVE_LAYOUT_INFORMATION_EX) +
estimatedPartitionCount * sizeof(PARTITION_INFORMATION_EX);
pInfo = (DRIVE_LAYOUT_INFORMATION_EX *) new BYTE[dwSize];
if (DeviceIoControl(hDisk, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, NULL, 0,
(LPVOID) pInfo,
dwSize,
&dwBytesReturn,
NULL))
{
for (DWORD i = 0; i < pInfo->PartitionCount; i++)
{
if (IsPartitionDynamic(pInfo->PartitionEntry + i))
{
ret = true;
break;
}
}
} else {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
estimatedPartitionCount *= 2;
delete pInfo;
goto loop;
} else {
ErrorExit(TEXT("DeviceIoControl"));
}
}
CloseHandle(hDisk);
delete pInfo;
} else {
ErrorExit(TEXT("CreateFile"));
}
return ret;
}

int _tmain(int argc, _TCHAR* argv[])
{
wprintf(TEXT("Disk 0 is %s disk.\n"), IsDiskDynamic(0) ? TEXT("Dynamic") :
TEXT("Basic"));
return 0;
}

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 28 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.