How to create a software RAID-1 array on Windows 7 not spanning whole disks

1

I have a brand new PC dual booting out of a single SSD drive (win7+debian). I added a couple of 2T hd I want to use from both Win & Linux. My target is to have two separate RAID-1 arrays on four 1T partitions.

I started partitioning under Linux (/dev/sd[de][12]) and buliding the array there works as expected (using mdmadmin --create /dev/md0 --level=mirror --raid-devices=2 /dev/sd[de]2).

Unfortunately Win7 seems unable to use the "remaining" free partitions (/dev/sd[de]1): it accepts my inpud, but then chokes with "insufficient disk space on device". I tried also reducing the size of the partitons (some posts imply Win needs a 1MB "overhead" partition), but I was not able to make it work.

I then deleted all partitions and created "Volumes" on Win7 and also this works as advertised.

Unfortunately it creates 1T Volumes, but also creates two partitions: the "small 1MB" and another one spanning the rest of the disk; no space left for Linux array.

Can someone suggest a strategy to create two 1TB RAID-1 disk arrays on two 2TB physical disks, one to be used under Win7 and another under linux?

NOTE: Linux Array will be an LVM volume mainly devoted to XEN VMs storage, so mounting the Win Array (ntfs) under Linux is not an option, unfortunately.

ZioByte

Posted 2013-12-26T11:30:37.410

Reputation: 359

Following Evan Anderson advice I was able to implement what needed. I used the standard tools (Disk Manager) to create a couple of RAW partitions (simply removing tick on "Format" box), no need to use command-line tools. These can be used directly with mdmadmin --create. Everything after that is standard Linux management. – None – 2013-12-27T09:21:30.790

Glad to hear it worked out well. – Evan Anderson – 2013-12-27T22:36:05.667

Answers

3

You're going to need Logical Disk Manager (LDM) support in your Linux distro to access Windows dynamic disks. It's necessary that these disks be configured as dynamic, in Windows, to create mirrored volumes.

Its unclear to me if Debian is compiling in LDM support into their kernels (not a Debian user, so I can't say). There is LDM support in the kernel. The kernel can query the LDM database on the disk and present the volumes in the "/dev" filesystem. There's nothing to stop you from creating an LDM volume and using Linux software RAID and a Linux-only filesystem on it.

Adjunct to the kernel driver, there is the libldm ldmtool tool that can query the LDM and present voumes through the device mapper. That might be an option for you, too.

Edit:

Let me try to clarify. I'm not suggesting you abandon Linux software RAID. Your problem isn't w/ RAID-- it's w/ reading the partition table. What you do for RAID is orthogonal to this issue.

Your kernel is showing you an MBR-style partition table on those disks. You're seeing this in Linux because Windows has made them "dynamic" and has stored this partition table as a compatibility feature to OS's that can read MBR-style partition tables. There is free space on those disks but your Linux OS needs to interpret the LDM database in order to access that free space.

You can't have a mirrored volume in Windows w/o using dynamic disks (LDM partitions) to host the mirrored volume. You're stuck. If you want Windows RAID-1 these disks will have to have LDM-style partitions.

Therefore, to address volumes on a dynamic disk from Linux you will have to use an LDM compatibility layer. If you don't use a dynamic disk you don't get software RAID in Windows.

It's unclear to me what has happened w/ kernel LDM support in Linux. The code looks to have been added in years ago and should be stable. I'd guess you're going to need to build a custom kernel. Check the kernel configuration (grep "CONFIG_LDM_PARTITION" /boot/config-$(uname -r)) to see if "CONFIG_LDM_PARTITION" is set-- I'd guess its probably not.

Once you've got Linux reading the LDM partition table you absolutely can use Linux software RAID for volumes you've created in the LDM partition table. They're just block devices. To create the volumes to host the Linux software RAID, though, you may need to use the Windows diskpart tool (or possibly the ldmtool utility I linked to).

Evan Anderson

Posted 2013-12-26T11:30:37.410

Reputation: 1 678

This is not exactly what I asked. If I understand correctly you mean I should use Win LDM in place of Linux Software RAID. I would like to avoid that since I'm using RAID for added security and LDM seems very new and probably not extensively tested (ldmtool is at version 0.2!). I will dig into it anyways. Thanks. – None – 2013-12-27T00:00:36.273

I dropped-on an edit to clarify. – Evan Anderson – 2013-12-27T00:50:04.393

It seems Linux sees LDM partitions ok (with debian Wheezy stock Kernel), but even ldmtool seems unable to create new dynamic partitions. I will try to create a couple of matching partitions under win and then reformat them under Linux to be used with mdmadm --create. I'm unsure how to change "partition type". I will report here success/failure for future reference. – None – 2013-12-27T01:00:32.937

Have a look here: http://technet.microsoft.com/en-us/library/cc766465(v=ws.10).aspx The diskpart command you're looking for is create volume simple. The Windows disk management tool should show a simple volume w/o any filesystem.

– Evan Anderson – 2013-12-27T01:23:04.313