15

I am a new Ubuntu user with a fresh installation, and am eager to get started with it. However, all of my important data is on Windows software RAID 0 array, and I need it to stay there as I'm also dual booting Windows. I need access to this data on Ubuntu, and can't really get anything real done until I have access.

I have already researched this subject as best as I could, and I managed to find a very helpful post:

The post describes how to get Ubuntu to see a Windows RAID 0 array that is made up of two drives. The main command used is sudo mdadm --build /dev/md0 --chunk=64 --level=0 --raid-devices=2 /dev/sdd2 /dev/sdc2. According to that user, and the other posters in the thread, it actually does work. That's great.

I have not tried following these instructions yet. Why? The post includes a warning about how you must not write to it if you enter the wrong chunk size; it's understandable how that could cause problems. My concern is that my setup is different to their example, and I am not sure that the commands should be entered exactly the same for my setup. I am afraid to break it by doing it wrong, and therefore wish to get the advice of somebody more experienced.

This is how my setup differs from their example:

  1. I have three 1 TB drives, not two drives (of whatever size they used).
  2. I have two RAID 0 partitions spread across those three drives: one 500 GB and 2.3 TB. This means that I need to NOT use the full disks when creating the RAID array, but instead use just part of them.
  3. I used a non-default block size for at least one of my RAID 0 partitions when I set them up years ago. I have no idea if this block size is the same as the chunk size that they mention. My 500 GB partition has a block size of 4 kb (4096 bytes per cluster), and my 2.3 TB partition has a block size of 64 kb (65536 bytes per cluster).

The relevant output from sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL (for just those three RAID0 drives) is:

NAME   FSTYPE   SIZE MOUNTPOINT            LABEL
sdb           931.5G            
├─sdb1            1M            
├─sdb2          127M            
└─sdb3        931.4G            
sdc           931.5G            
├─sdc1            1M            
├─sdc2          127M            
└─sdc3        931.4G            
sdd           931.5G            
├─sdd1        166.7G            
└─sdd2        764.7G 

The relevant output from cat /proc/partitions (for just those three RAID0 drives) is:

8       16  976762584 sdb
8       17       1024 sdb1
8       18     130048 sdb2
8       19  976631478 sdb3
8       32  976762584 sdc
8       33       1024 sdc1
8       34     130048 sdc2
8       35  976631478 sdc3
8       48  976762584 sdd
8       49  174763008 sdd1
8       50  801865728 sdd2

The "Disks" program in Ubuntu displays the following partitions for my drives:

/dev/sdb:   GUID Partition Table .
/dev/sdb1:  1.0 MB, Microsoft LDM metadata.
/dev/sdb2:  133 MB, Microsoft Reserved.
/dev/sdb3:  1.0 TB, Microsoft LDM data.
/dev/sdc:   GUID Partition Table partitioning.
/dev/sdc1:  1.0 MB, Microsoft LDM metadata.
/dev/sdc2:  133 MB, Microsoft Reserved.
/dev/sdc3:  1.0 TB, Microsoft LDM data.
/dev/sdd:   Master Boot Record partitioning.
/dev/sdd1:  179 GB, Unknown.
/dev/sdd2:  821 GB, Unknown.
/dev/sdd:   136 MB, Unallocated space.

I hope I've provided enough information here. So now, my question is this: what is the proper command for me to enter with my setup, so that I can access both of my Windows RAID 0 partitions from Ubuntu?

Thank you very much in advance.

3 Answers 3

21

I finally got this working thanks to this Stack Overflow post: Windows Spanned Disks (LDM) restoration with Linux?

It was extremely difficult to uncover this elusive information. It took days of searching, and I guess I wasn't finding it because the post makes no mention of RAID, so it wasn't coming up in my search results. It definitely works for my Windows software RAID 0, though.

The solution:

The solution is actually quite simple. There's a wonderful tool built specifically for this purpose, called ldmtool. It is capable of reading and working with Windows dynamic disks which use LDM (Logical Disk Manager). It is not installed by default, but is included in the Ubuntu repositories. All I had to do was execute two commands:

sudo apt-get install ldmtool
sudo ldmtool create all

The first command installs ldmtool, and the second has it automagically create device mappings for all of the connected Windows dynamic disks. These mappings are located in /dev/mapper/ and can be mounted manually with mount -t ntfs /dev/mapper/mapfilename, but I didn't need to do that - Ubuntu mounted them for me automatically after I ran the above two commands. That's all I had to do, and I could immediately access them from the file browser!

The linked post includes a suggestion for doing this automatically every boot. Just open the file /etc/init/mountall.conf and add the line [ -x /usr/bin/ldmtool ] && ldmtool create all >/dev/null || true immediately before the exec mountall ... line near the end of the file.

Full credit for this solution goes to Christian Hudon, the guy who posted it as an answer over on Stack Overflow. Thanks!

To add some further information to this, I used some other ldmtool commands to query my volumes for information:

sudo ldmtool scan /dev/sdd
[
  "e856a65f-e558-11e1-ae19-bc5ff435f790"
]

sudo ldmtool show diskgroup e856a65f-e558-11e1-ae19-bc5ff435f790
{
  "name" : "Dan-PC-Dg0",
  "guid" : "e856a65f-e558-11e1-ae19-bc5ff435f790",
  "volumes" : [
    "Volume1",
    "Volume2"
  ],
  "disks" : [
    "Disk1",
    "Disk2",
    "Disk3"
  ]
}

sudo ldmtool show volume e856a65f-e558-11e1-ae19-bc5ff435f790 Volume1
{
  "name" : "Volume1",
  "type" : "striped",
  "size" : 1048578048,
  "chunk-size" : 128,
  "hint" : "D:",
  "partitions" : [
    "Disk1-01",
    "Disk2-01",
    "Disk3-01"
  ]
}

sudo ldmtool show volume e856a65f-e558-11e1-ae19-bc5ff435f790 Volume2
{
  "name" : "Volume2",
  "type" : "striped",
  "size" : 4811194368,
  "chunk-size" : 128,
  "hint" : "E:",
  "partitions" : [
    "Disk1-02",
    "Disk2-02",
    "Disk3-02"
  ]
}

It isn't necessary to run the above commands, as ldmtool create all does all the necessary work to create the mappings. I just included them because I already included information about my setup in the question, so this information might be helpful for anyone coming across this post later. In particular, we can see that according to ldmtool, both of my dynamic volumes use a chunk size of 128, despite being created with different block sizes in Windows. I guess this means that block size and chunk size are not synonymous terms. The commands ldmtool show disk and ldmtool show partition can be used to display further information.

2
  • 2
    5 years old solution still working in Ubuntu 18. Thanks.
    – Cris
    Jan 16, 2020 at 22:42
  • this is awesome! thank you Jul 28, 2021 at 4:28
4

The others answers worked only partially in Mint 18.3.

Auto-mounting the Raid0 drives was a bit more challenging since editing /etc/init/mountall.conf never worked in my system and I wanted to be able to mount the spanned volume using a definition in /etc/fstab, and not use a script in /etc/rc.local.

So here's what I did:

sudo apt-get install ldmtool

Checked that the volume was recognized and could be mounted correctly with:

sudo ldmtool create all

Knowing that that my system could see and write into the drives. I created a service (following the directions from this site:(https://wiki.archlinux.org/title/Dynamic_disks)

Created a file in etc/systemd/system/ called ldmtool.service with the description of the service:

[Unit]
Description=Windows Dynamic Disk Mount
Before=local-fs-pre.target
DefaultDependencies=no
[Service]
Type=simple
User=root
ExecStart=/usr/bin/ldmtool create all
[Install]
WantedBy=local-fs-pre.target

To enable the service on startup:

sudo systemctl is-enabled ldmtool

To find the UUID of the volume used:

sudo blkid

Which gave me the following info: /dev/mapper/ldm_vol_XXX-Dg0_Volume1: LABEL="6TB_Raid" UUID="0A281FC6281FAFA5" TYPE="ntfs"

So I created a line in /etc/fstab that reads:

UUID=0A281FC6281FAFA5 /media/6TB_Raid ntfs-3g  auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8  0  0

The volume is there everytime I boot.

3
  • 2
    is-enabled is for checking the state of the service. use sudo systemctl enable ldmtool instead. Thanks for this, needed it as well. Apr 14, 2021 at 18:04
  • note of warning about making a service like the above. on PopOs 21, the os refused booting after I did it, and booted again after I disabled the service Sep 3, 2021 at 3:11
  • so far, I had better luck adding the mount script to /etc/rc.local Sep 3, 2021 at 3:38
2

Ubuntu 14.04 LTS mount raid 1 created by windows 7 using ldmtool by a newby.** **

I had the same problem. Using the above answer I lucked out and got it mounted with

gksu gedit /etc/init/mountall.conf 

by changing the line

 [ -x /usr/bin/ldmtool ] && ldmtool create all >/dev/null || true

to

/bin/ldmtool create all >/dev/null || true

then added

/bin/mount /dev/mapper/ldm_vol_NAME-Dg0_volume1 /media/WHEREVER

My mountall.conf looks like this now

     **fi
/usr/bin/ldmtool create all >/dev/null || true
/bin/mount -o rw /dev/mapper/ldm_vol_OCTO-CORE-Dg0_Volume1 /media/m
    exec mountall --daemon $force_fsck $fsck_fix $debug_arg
end script**

previously I had a script to do the same with the 2 lines

/usr/bin/ldmtool create all >/dev/null || true

/bin/mount -o rw /dev/mapper/ldm_vol_OCTO-CORE-Dg0_Volume1 /media/m

and added

sh /home/ron/mirror to the end of /etc/rc.local 

now it is mounted when ubuntu starts

I don't know that this will work for you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .