Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  20] [ 0]  / answers: 1 / hits: 23104  / 1 Year ago, sat, december 31, 2022, 5:10:22

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.


More From » dual-boot

 Answers
4

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.


[#21851] Sunday, January 1, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
egantfis

Total Points: 406
Total Questions: 108
Total Answers: 108

Location: Austria
Member since Thu, Jan 7, 2021
3 Years ago
;