Skip to contentSkip to conversation

2.4.7 Add support for Dynamic Disks

PATCH In review Anton Altaparmakov 3 participants 3 messages Jul 26, 2001 – Jul 27, 2001 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.4.7 Add support for Dynamic Disks

Linus,

Please consider the below patch for inclusion into 2.4.7 adding support for Dynamic Disks.

Alan,

If you would like to include it in the -ac series, I have verified it applies fine to 2.4.7-ac1 (Configure.help part applies only with an offset but it is fine).

Detailed description of patch:

- Patch adds support for Dynamic Disks which are introduced by Windows 2000 and are also used by Windows XP, thus allowing people with dual-boot configurations access to their Windows dynamic disk partitions from Linux.

- The patch does not modify existing kernel code, except for plugging into the partition recognition code path just before msdos partitions are recognized (this needs to happen as dynamic disks also have a normal msdos partition table in order to prevent other OS of thinking the disk is blank and hence msdos.c would handle them if we don't get in before it does).

- Dynamic disk, aka LDM, support is of course a compile time option, the patch adds the necessary configuration/documentation entries into fs/partitions/Configure.in and Documentation/Configure.help.

- The patch works such that if it determines a device is a dynamic disk, for example say it was hdb, it would create hdb1 representing the LDM database, which can be used in the future by yet to be written ldm user space utilities (the ldm equivalents of fdisk and volume managers). Then it creates for each data partition found in the LDM database, a corresponding device starting at hdb5, then hdb6, etc. So the layout created is much like the extended msdos partitions:

	hdb: hdb1 < hdb5 hdb6 etc...>

Note that we just do it for all partitions in order. We perform no special treatment when partitions are part of raid arrays, etc, we just create each member partition as one device (hdb5, etc), handling raid arrays is up to future extensions / user space tools / the users to deal with.

- The code is as bullet proof as possible with respect to checking that we don't dereference memory outside valid boundaries by doing heavy consistency checking of the LDM database contents and the memory offsets that are deduced by reading it. Basically, unless we have missed something, the ldm code cannot cause the kernel to crash under any circumstances. It will always cleanup and exit with -1 should an error occur.

- There is also a compile time option that can be enabled when configuring the kernel which will result in debug messages being output via printk with KERN_DEBUG log level. When debugging messages are not compiled in, they are optimized away completely an don't exist in the created binary object.

- Needless to say the ldm code has been tested and we haven't had any bug reports / complaints about it so we decided it was time to submit it for inclusion into the kernel.

- FlatCap (Richard Russon <[email protected]>) has done the reverse engineering and ldm coding work, so all kudos to him. He also wrote some documentation on how dynamic disks work and in particular on the layout of the LDM database which can be found on Sourceforge:

	http://linux-ntfs.sf.net/ldm/

I only helped cleaning up the code to comply with kernel coding standards and worked on making sure we do every check we could think of to make the code behave under all circumstances.

Best regards,

Anton Altaparmakov
FlatCap (Richard Russon)

------ linux-2.4.7-ldm.diff patch follows ------

Documentation/Configure.help +27 -0
diff -urN linux-2.4.7-vanilla/Documentation/Configure.help linux/Documentation/Configure.help
@@ -12471,6 +12471,33 @@
   Say Y here if you would like to use hard disks under Linux which
   were partitioned on a Macintosh.
 
+Windows' Logical Disk Manager (Dynamic Disk) support (EXPERIMENTAL)
+CONFIG_LDM_PARTITION
+  Say Y here if you would like to use hard disks under Linux which
+  were partitioned using Windows 2000's or XP's Logical Disk Manager.
+  They are also known as "Dynamic Disks".
+
+  Windows 2000 introduced the concept of Dynamic Disks to get around
+  the limitations of the PC's partitioning scheme.  The Logical Disk
+  Manager allows the user to repartion a disk and create spanned,
+  mirrored, striped or RAID volumes, all without the need for
+  rebooting.
+
+  Normal partitions are now called Basic Disks under Windows 2000 and XP.
+
+  Technical documentation to accompany this driver is available from:
+  <http://linux-ntfs.sf.net/ldm>
+
+  If unsure, say N.
+
+Windows' LDM extra logging
+CONFIG_LDM_DEBUG
+  Say Y here if you would like LDM to log verbosely.  This could be
+  helpful if the driver doesn't work as expected and you'd like to
+  report a bug.
+
+  If unsure, say N.
+
 PC BIOS (MSDOS partition tables) support
 CONFIG_MSDOS_PARTITION
   Say Y here if you would like to use hard disks under Linux which
fs/partitions/Config.in +4 -0
diff -urN linux-2.4.7-vanilla/fs/partitions/Config.in linux/fs/partitions/Config.in
@@ -25,6 +25,10 @@
       bool '    Solaris (x86) partition table support' CONFIG_SOLARIS_X86_PARTITION
       bool '    Unixware slices support' CONFIG_UNIXWARE_DISKLABEL
    fi
+   dep_bool '  Windows Logical Disk Manager (Dynamic Disk) support' CONFIG_LDM_PARTITION $CONFIG_EXPERIMENTAL
+   if [ "$CONFIG_LDM_PARTITION" = "y" ]; then
+      bool '    Windows LDM extra logging' CONFIG_LDM_DEBUG
+   fi
    bool '  SGI partition support' CONFIG_SGI_PARTITION
    bool '  Ultrix partition table support' CONFIG_ULTRIX_PARTITION
    bool '  Sun partition tables support' CONFIG_SUN_PARTITION
fs/partitions/Makefile +1 -0
diff -urN linux-2.4.7-vanilla/fs/partitions/Makefile linux/fs/partitions/Makefile
@@ -17,6 +17,7 @@
 obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
 obj-$(CONFIG_ATARI_PARTITION) += atari.o
 obj-$(CONFIG_MAC_PARTITION) += mac.o
+obj-$(CONFIG_LDM_PARTITION) += ldm.o
 obj-$(CONFIG_MSDOS_PARTITION) += msdos.o
 obj-$(CONFIG_OSF_PARTITION) += osf.o
 obj-$(CONFIG_SGI_PARTITION) += sgi.o
fs/partitions/check.c +4 -0
diff -urN linux-2.4.7-vanilla/fs/partitions/check.c linux/fs/partitions/check.c
@@ -25,6 +25,7 @@
 #include "acorn.h"
 #include "amiga.h"
 #include "atari.h"
+#include "ldm.h"
 #include "mac.h"
 #include "msdos.h"
 #include "osf.h"
@@ -41,6 +42,9 @@
 static int (*check_part[])(struct gendisk *hd, kdev_t dev, unsigned long first_sect, int first_minor) = {
 #ifdef CONFIG_ACORN_PARTITION
 	acorn_partition,
+#endif
+#ifdef CONFIG_LDM_PARTITION
+	ldm_partition,		/* this must come before msdos */
 #endif
 #ifdef CONFIG_MSDOS_PARTITION
 	msdos_partition,
fs/partitions/ldm.c +980 -0

980 lines not on this page · raw message

fs/partitions/ldm.h +162 -0

162 lines not on this page · raw message

Signature · 3 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
#1 lore raw
Quoted 3 lines

- Patch adds support for Dynamic Disks which are introduced by Windows 2000 and are also used by Windows XP, thus allowing people with dual-boot configurations access to their Windows dynamic disk partitions from Linux.

...

Quoted 4 lines

Note that we just do it for all partitions in order. We perform no special treatment when partitions are part of raid arrays, etc, we just create each member partition as one device (hdb5, etc), handling raid arrays is up to future extensions / user space tools / the users to deal with.

Linux has long held an interoperability advantage over UNIX and BSD due to the use of normal PC disk partitions.

Now a new standard is here. We must swallow our pride and accept it, tossing out our old LVM format. It's time to embrace and extend.

#2 lore raw
Quoted 9 lines · Albert D. Cahalan
Quoted 3 lines

- Patch adds support for Dynamic Disks which are introduced by Windows 2000 and are also used by Windows XP, thus allowing people with dual-boot configurations access to their Windows dynamic disk partitions from Linux.

...

Quoted 4 lines

Note that we just do it for all partitions in order. We perform no special treatment when partitions are part of raid arrays, etc, we just create each member partition as one device (hdb5, etc), handling raid arrays is up to future extensions / user space tools / the users to deal with.

Quoted 5 lines

Linux has long held an interoperability advantage over UNIX and BSD due to the use of normal PC disk partitions.

Now a new standard is here. We must swallow our pride and accept it, tossing out our old LVM format. It's time to embrace and extend.

I don't see why we can't have both. It's just another partition format.

				Regards,

					Richard....
Permanent: [email protected]
Current:   [email protected]