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.