473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Dynamic vs Basic Partitions

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
7 10690
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jasper | last post by:
hi, i am trying to make a very simple program that will just detect and output your currently connected IDE devices. It will look something like this: IDE PRIMARY MASTER: IDE PRIMARY SLAVE:...
7
by: Steve | last post by:
This post has two parts. First is my feedback on sets. (Hello? Last summer called, they want their discussion thread back...) Second is some questions about my implementation of a partition...
5
by: Nick J Chackowsky | last post by:
Wrote a python script to find the partitions of an integer (a list of all the ways you can express n as a sum of integers). For example, the partitions of 5 are 5 4+1 3+2 2+2+1 3+1+1 2+1+1+1...
3
by: jcgeorge | last post by:
I have a Windows DPF (v8.2.2) environment. 2 Nodes 5 Partitions Server1 - Cat (0) Data (1) Data (2) Server2 - Data (3) Data (4) I want to use block-based IO, but I do not want the same size...
8
by: arunrocks | last post by:
Hi I am having a requirement to create a db in 2 out of 8 partitiones. I have the following doubts. 1. should I create a new instance in 2 partitions alone (the present instance spans 8 nodes)...
3
by: m.smith_1999 | last post by:
Hello, I'm a student software developer. As a part of an excerise I'm doing I'm trying to build a program to create "mount files" and mount them. Something like Sarah Dean's OTFE but really...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
1
Nepomuk
by: Nepomuk | last post by:
In most modern distributions of Linux and Unix (at least ones with graphical environments like KDE, Gnome or XFCE), you get to mount your partitions easily from the desktop. In some cases however, it...
3
by: Justin | last post by:
Is there a way to attach a partition to an existing table that already has partitions (without loading data)? For example, the syntax of the attach partition is documented below: alter table...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.