How to access Windows Spanned Dynamic Disks with Ubuntu

The last few days I tried to access my spanned dynamic disk with ubuntu. After a lot of research on various boards I finally managed to make it work.
So here is a quick guide how to do that.

Before I start let me give you some information about my setup:
I’m using two different drives ( 1x2TB and 1x1TB) to form my spanned volume. They have the partition IDs /dev/sdb1 and /dev/sdc1 in my setup.
I know that this is kind of risky for my data and that in case that one of those disks fails I’m going to lose all the data. But it was the only way to use both disks together to have one volume with the size of 3 GB (with Raid0 I would have wasted 1 TB of disk space).
And even if I’m going to lose the data, its definitively not going to be the end of the world, since I’m not storing any important data on this volume.
So I have the two disks setup as spanned volume in Windows and already have a lot of data on it.
Here is what you have to do to make it work in Linux:

IMPORTANT: I have no idea if the “dm” tools work correctly. Therefore I can’t guarantee that you wont’ loose any data using this procedure.
If you don’t need write access to the volume mount it as read only.
Use this guide at your own risk. Back up any critical data to be safe. I can’t be held responsible for any direct or indirect damage or loss of data caused by your actions or the use of the tools described in this guide.
This guide is based on the work of others

1. Make sure you have the packet “dmraid” installed on your Linux machine:

$ sudo aptitude install dmraid

2. Start the kernel module by typing

$ sudo modprobe dm_mod

3. Now you need to find out the size of each partition that is being used by the spanned drive. For this you have to run the command:

$ sudo blockdev --getsize /dev/sdb1
3907024896
$ sudo blockdev --getsize /dev/sdc1
1953517568

So for my setup I get the size of 3907024896 sectors for /dev/sdb1 and 1953517568 sectors for /dev/sdc1

4. No you have to put those values in a file (e.g /etc/ntfsvolume)

sudo gedit /etc/ntfsvolume

This  is what the file should look like:

# Offset into   Size of this    Raid type       Device          Start sector
# volume        device                                          of device
0               3907024896	linear          /dev/sdb1       0
3907024896	1953517568      linear          /dev/sdc1       0

Just change the values for the device size and the offset of the second device according to your settings and safe the file.

5. Now it’s time to create the new device that maps the two volumes correctly:

$ sudo dmsetup create myvolume /etc/ntfsvolume

You might get a message like:

/dev/mapper/myvolume not set up by udev: Falling back to direct node creation.

This is nothing to worry about.
If everything went fine. You should be able to mount the device with nautilus or the terminal:

$ sudo mkdir /media/volume/
$ sudo mount -t ntfs-3g /dev/mapper/myvolume /media/volume
$ sudo mount -t ntfs-3g -o ro /dev/mapper/myvolume /media/volume (mount read-only)

6. If you successfully mounted the volume you have to make sure that the volume is created automatically at boot:

$ sudo gedit /etc/rc.local

Add the following line to this file before the line “exit 0”:

dmsetup create myvolume /etc/ntfsvolume

You should finally add the module dm_mode to the file /etc/modules. So it will be started at boot time

That’s it. From now on you should be able to access the spanned volume in Ubuntu.

Feel free to leave comments, questions or suggestions.

10 thoughts on “How to access Windows Spanned Dynamic Disks with Ubuntu

  1. I am having trouble with mounting on my system. I have an EVGA motherboard with an nVidia chipset and fake raid. I have 3 hard drives: 2 750GB in a stripe and 1 1TB alone.

    I have partitioned the 1.5TB stripe into 500GB for Windows 7 and 1TB for a Windows spanned disk with the other 1TB drive to give me a 2TB drive.

    I used your method above on the /dev/dm-1 (partition in side dm-0 which is the 1TB drive as presented by the fakeraid) and /dev/dm-6 (partition from the 1.5TB stripe). I called blockdev –getsize /dev/dm-1 and dm-6 and put the info in my ntfsvolume file.

    I run dmsetup create myvolume ntfsvolume, which returns no error. I get a new /dev/dm-7 of the appropriate looking size.

    When I try to mount the NTFS volume I get the following error:

    NTFS signature is missing.
    Failed to mount ‘/dev/dm-7’: Invalid argument
    The device ‘/dev/dm-7’ doesn’t seem to have a valid NTFS.
    Maybe the wrong device is used? Or the whole disk instead of a
    partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

    I tried swapping the order in the ntfsvolume file and re-creating, but I get the same result. Any ideas?

    • I think that this method won’t work when you use /dev/dm-X devices.
      Have you tried using the /dev/sdaX or /dev/sdbX devices?
      I’m not really sure what the problem is, but I think, that the /dev/dm-X devices don’t really map to the physical partitions 1:1, as they are provided by the fakeraid tool.
      In my setup I actually didn’t use the fakeraid tool/driver.
      So you should try to use the “real” devices (like /dev/sdb1).
      Let me know if this approach works, as I’m always happy for some feedback.

      Regards

      Nicolas

      • The problem is I have two 750GB drives that I used the BIOS nVidia FakeRaid to put into a stripe for a single 1.5TB. In Windows I partitioned 1TB into a SPAN with another separate physical 1TB drive.

        So I have to use dmraid to load the two 750GB drives into their stripe first. I have a software span on top of a fakeraid stripe.

        When I look at the raw disk (/dev/sda) of the physical 1TB drive with fdisk I see a SFS partition type. If I look at the combined 750GB stripe I see multiple SFS partitions.

      • Didn’t seem to do the trick. I got the same error even with all the proper offsets and multiple combinations.

        However my computer has started to freeze up so it could be related to a hardware issue.

        • Why is your standalone drive also part of the fakeraid?
          What about trying the devices /dev/dm-6 (the part of the fakeraid that belongs to the spanned disk) and /dev/sda1 (the standalone disk).
          The partition type is ok. Mine show sfs as well. But thats probably garbage as fdisk can’t recognise spanned volumes.
          Can you also post (or send me per mail: bigli at bigli dot ch) the first block of each volume?
          You can do this with dd: dd if=/dev/dm-1 of=/path/to/file count=1 and the same for /dev/sda1.
          Maybe it will help me to figure out what the problem is.
          Nicolas

  2. Hi,
    Is it possible to access a single dynamic volume? My disk containing windows 7 is dynamic and I’ve installed inside windows Ubuntu; but i can’t access my other volumes. any solution?

  3. Hi, I tried this with my 3 1TB drives and i didn’t get any information for the Get Size command. The file that opened was blank. Any Ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *