-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create partition with MDRAID (mdadm) array metadata #191
Comments
Hmm, this is not exactly trivial and I have no idea about raid |
Not trivial, but not hard either. Basicaly we just need to populate previously mentioned metadata structs with correct values and then write that at 4K offset from the beginning of the partition: https://raid.wiki.kernel.org/index.php/RAID_superblock_formats Only problem is that the struct is bit complex, but still reasonable. |
OK, so i've made bit of progress. https://github.com/Harvie/Programs/blob/master/c/mdraid-gen/mdraid.c It seems that now we just need to clean up few small things, set the data offsets correctly and append data to generated superblock with these offsets. This is the current output:
|
I have buildscript which creates harddisk image with partitions and some of them have MDRAID metadata on them.
I would like to migrate it to genimage, but there is no such feature.
Side note: All i need is very simple setup. RAID1 with single(!) drive in it. It seems stupid to have RAID1 with only single drive. But it is much easier to grow such array later to desired state, when compared to converting plain non-RAID filesystem partition to RAID. I am usualy using this on routers which get deployed from the image in bulk. user can later easily add second SSD to the most important machines and grow the RAID across it once the deployment becomes mission-critical.
I've already tried to figure out how mdadm creates the metadata, but it seems it leaves metadata creation to kernel, which is bit annoying, because there is probably no userspace utility which can be called to do that offline without starting the array.
But there is
struct mdp_superblock_s
in header file#include <md_p.h>
, so that can be included and populated from userspace. There seems to be mild complexity to it, but it should be possible under 200 lines of C code.https://docs.huihoo.com/doxygen/linux/kernel/3.7/md__p_8h_source.html
https://docs.huihoo.com/doxygen/linux/kernel/3.7/structmdp__superblock__s.html
The text was updated successfully, but these errors were encountered: