LDMTOOL(1)

✨ LDMTOOL(1) ✨

okay so bestie, welcome to the ldmtool page β€” yes that's LDMTOOL(1) if you're being formal, it's from the User Commands corner of the manual, and honestly? it's giving "I speak fluent Microsoft Windows dynamic disk" and I'm obsessed. sit down, grab a strawberry πŸ“, let's get into it.


πŸ’– NAME πŸ’–

ldmtool β€” a tool to manage Microsoft Windows dynamic disks. periodt.


πŸŽ€ SYNOPSIS πŸŽ€

like, here's every single way you can call her:

ldmtool [options]

ldmtool [options] scan [device...]

ldmtool [options] show diskgroup {disk group GUID}

ldmtool [options] show {volume | partition | disk} {disk group GUID}
        {object name}

ldmtool [options] {create | remove} all

ldmtool [options] {create | remove} volume {disk group GUID}
        {volume name}

πŸ’… OPTIONS πŸ’…

  • -d|--device device β€” automatically scan device. like, just go ahead and check it for you, no extra steps ✨
  • --uuid_override uuid β€” you hand it your own UUID to use with device mapper. ⚠️ but lowkey listen: this can only be used in single action mode, and only for a single volume. no cap, that's the whole rule.

πŸ¦‹ DESCRIPTION πŸ¦‹

so ldmtool is the tool for managing Microsoft Windows dynamic disks β€” the ones that use Microsoft's LDM metadata. she can inspect them πŸ‘€, and she can also create and remove the device-mapper block devices that you can actually mount. iconic behavior.

okay but here's the reality check: even though you can mount a filesystem read-write and modify its contents, ldmtool cannot modify the LDM metadata itself. like, at all. so it can't create, remove or edit dynamic disks. that's just not her job and she's not sorry πŸ’…

she also can't mount RAID5 volumes that have a partition missing β€” though she can mount mirrored volumes with a partition missing. but fr fr, mounting a volume with a missing partition is not recommended, because ldmtool does not update the LDM metadata in any way. which means Windows will have no way to determine that the partitions are not synchronised when it subsequently mounts β€” and that may result in corruption. 😭 so like, don't do that. please.


🌸 INVOCATION 🌸

ldmtool can be invoked either as a shell to run multiple actions, or to run a single action and return. if an action is given on the command line, it runs in single action mode. if no action is given, she launches a shell. cute, right?

🧚 Shell mode

when invoked as a shell, ldmtool will not scan any block devices by default. if any block devices are given on the command line with the -d option, those get scanned. otherwise, block devices must be scanned explicitly with the scan action.

exit shell mode by sending an EOF, or with the quit or exit actions. bye bestie πŸ‘‹

⭐ Single action mode

when invoked to run a single action, all block devices will be scanned by default. in this case, if any block devices are specified with the -d option, only those block devices will be scanned.


🌈 RESULTS 🌈

ldmtool returns results as JSON-formatted data. the precise data returned is described in detail below. if a command fails it will not return any JSON data β€” instead it displays an error message. 😭

in shell mode, failure can be detected by the lack of a JSON-formatted result. in single action mode the caller can additionally check the exit code of the command. iykyk.


πŸ‘‘ ACTIONS πŸ‘‘

πŸŽ€ scan [device...]

scan all [device]s for LDM metadata.

returns a list of all known disk group GUIDs. note that it doesn't just return newly discovered disk groups β€” it's the whole roster, main character energy.

πŸŽ€ show diskgroup {GUID}

return detailed information about a single disk group.

returns:

  • name β€” the human-readable name of the disk group
  • guid β€” the Windows-assigned GUID of the disk group
  • volumes β€” a list of the names of all volumes in the disk group
  • disks β€” a list of the name of all disks in the disk group

πŸŽ€ show volume {disk group GUID} {volume name}

return detailed information about a volume.

returns:

  • name β€” the name of the volume
  • guid β€” the Windows-assigned GUID of the volume
  • type β€” the volume type. one of: simple, spanned, striped, mirrored, raid5
  • size β€” the size of the volume in sectors
  • chunk-size β€” the chunk size, in sectors, used by striped and raid5 volumes. for other volume types it will be 0.
  • hint β€” the volume mounting hint. this value specifies how Windows expects the volume to be mounted. for a volume with an assigned drive letter, it might be 'E:'.
  • device β€” the host device-mapper device which was created for this volume if any (e.g. /dev/mapper/ldm_vol_Machine-Dg0_Volume1)
  • partitions β€” a list of the names of the partitions which constitute this volume.

πŸŽ€ show partition {disk group GUID} {partition name}

return detailed information about a partition.

returns:

  • name β€” the name of the partition
  • start β€” the offset, in sectors, of the start of the partition from the beginning of the disk
  • size β€” the size of the partition in sectors
  • disk β€” the name of the disk the partition is on

πŸŽ€ show disk {disk group GUID} {disk name}

return detailed information about a disk.

returns:

  • name β€” the human-readable name of the disk
  • guid β€” the GUID of the disk
  • present β€” whether the disk has been discovered during scanning: true or false

if the disk is present, additionally returns:

  • device β€” the name of the host device (e.g. /dev/sda)
  • data-start β€” the start sector of the data portion of the disk
  • data-size β€” the size, in sectors, of the data portion of the disk
  • metadata-start β€” the start sector of the metadata portion of the disk
  • metadata-size β€” the size, in sectors, of the metadata portion of the disk

πŸŽ€ create {volume { disk group GUID } { volume name } | all}

create a device-mapper device for either the specified volume or all volumes in all detected disk groups.

returns a list of the device-mapper device names which were created by this action. note that if a device already existed for a volume, it will not be returned in this list. πŸ™ˆ

πŸŽ€ remove {volume { disk group GUID } { volume name } | all}

remove device-mapper devices for either the specified volume or all volumes in all detected disk groups.

returns a list of the device-mapper device names which were removed by this action. note that if no device existed for a volume, it will not be returned in this list.


πŸ”₯ EXAMPLES πŸ”₯

these examples form a sequence from a single session of ldmtool running in shell mode. slay.

scan all loop devices for LDM metadata:

ldm> scan /dev/loop[0-9]*
[
  "03c0c4fc-8b6f-402b-9431-4be2e5823b1c",
  "06495a84-fbfd-11e1-8cf9-52540061f5db"
]

two disk groups were detected. the list contains their GUIDs. πŸ’–

show detailed information about one of the disk groups:

ldm> show diskgroup 06495a84-fbfd-11e1-8cf9-52540061f5db
{
  "name" : "WIN-ERRDJSBDAVF-Dg0",
  "guid" : "06495a84-fbfd-11e1-8cf9-52540061f5db",
  "volumes" : [
    "Volume4",
    "Volume1",
    "Volume2",
    "Volume3",
    "Volume5"
  ],
  "disks" : [
    "Disk1",
    "Disk2",
    "Disk3",
    "Disk4",
    "Disk5",
    "Disk6",
    "Disk7",
    "Disk8",
    "Disk9"
  ]
}

show detailed information about one of the volumes in the disk group:

ldm> show volume 06495a84-fbfd-11e1-8cf9-52540061f5db Volume1
{
  "name" : "Volume1",
  "guid" : "c08309e9-1d30-43e5-8dc3-fcec8be76fcc",
  "type" : "spanned",
  "size" : 129024,
  "chunk-size" : 0,
  "hint" : "E:",
  "device" : "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume1",
  "partitions" : [
    "Disk1-01",
    "Disk2-01"
  ]
}

show detailed information about one of the partitions in the volume:

ldm> show partition 06495a84-fbfd-11e1-8cf9-52540061f5db Disk1-01
{
  "name" : "Disk1-01",
  "start" : 65,
  "size" : 96256,
  "disk" : "Disk1"
}

show detailed information about the disk containing the partition:

ldm> show disk 06495a84-fbfd-11e1-8cf9-52540061f5db Disk1
{
  "name" : "Disk1",
  "guid" : "06495a85-fbfd-11e1-8cf9-52540061f5db",
  "present" : true,
  "device" : "/dev/loop15",
  "data-start" : 63,
  "data-size" : 100289,
  "metadata-start" : 100352,
  "metadata-size" : 2048
}

create a device-mapper device for a volume:

ldm> create volume 06495a84-fbfd-11e1-8cf9-52540061f5db Volume1
[
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume1"
]

a new device-mapper device has been created, called ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume1. depending on how udev is configured, it will probably now be available as /dev/mapper/ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume1. 🫢

⚠️ note that the returned name of the created device-mapper device is unmangled and thus can contain not-whitelisted characters. user-space device-mapper tools (like dmsetup) and the libdevmapper library accept unmangled names (if properly configured) but take extra care composing the path to a created device yourself. consider using the "device" field of the show volume command output. bestie, seriously, use the field, don't hand-roll the path 😭

create device-mapper devices for all volumes in both disk groups:

ldm> create all
[
  "ldm_vol_Red-nzv8x6obywgDg0_Volume2",
  "ldm_vol_Red-nzv8x6obywgDg0_Volume1",
  "ldm_vol_Red-nzv8x6obywgDg0_Volume4",
  "ldm_vol_Red-nzv8x6obywgDg0_Stripe1",
  "ldm_vol_Red-nzv8x6obywgDg0_Raid1",
  "ldm_vol_Red-nzv8x6obywgDg0_Volume3",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume4",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume2",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume3",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume5"
]

note that ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume1 is not in the list of devices which were created, as it already existed. she's been here, she's booked and busy πŸ’…

remove the device-mapper device for a single volume:

ldm> remove volume 06495a84-fbfd-11e1-8cf9-52540061f5db Volume2
[
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume2"
]

ldm> remove all
[
  "ldm_vol_Red-nzv8x6obywgDg0_Volume2",
  "ldm_vol_Red-nzv8x6obywgDg0_Volume1",
  "ldm_vol_Red-nzv8x6obywgDg0_Volume4",
  "ldm_vol_Red-nzv8x6obywgDg0_Stripe1",
  "ldm_vol_Red-nzv8x6obywgDg0_Raid1",
  "ldm_vol_Red-nzv8x6obywgDg0_Volume3",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume4",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume1",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume3",
  "ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume5"
]

note that ldm_vol_WIN-ERRDJSBDAVF-Dg0_Volume2 is not in the list of devices which were removed, as it was removed previously. gone already, diva 🌸


πŸ’œ AUTHOR πŸ’œ

Matthew Booth <mbooth@redhat.com> β€” thank you king, we stan πŸ‘‘


✨ and that's the whole page, bestie ✨ this was ldmtool from the LDMTOOL(1) manual, dated 06/25/2025, and it ate, no crumbs left πŸŽ€πŸ’–πŸ¦‹

πŸ“¦ where this page comes from