-
Notifications
You must be signed in to change notification settings - Fork 113
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
Initial MDRAID support #277
base: master
Are you sure you want to change the base?
Conversation
e3f0cc8
to
3d315c9
Compare
https://github.com/pengutronix/genimage/actions/runs/12428468239/job/34700133730?pr=277#step:6:1000 The test run |
Signed-off-by: Tomas Mudrunka <[email protected]>
Seems to be fixed now. |
0f935d6
to
02d0983
Compare
Signed-off-by: Tomas Mudrunka <[email protected]>
Signed-off-by: Tomas Mudrunka <[email protected]>
Signed-off-by: Tomas Mudrunka <[email protected]>
Happy holidays. It would kinda make sense for the image-mdraid.c to actualy generate two (or more) images, all being part of that RAID1 mirror. But on the other hand i don't think this would allow genimage to resolve dependencies correctly. Maybe i should manualy create other image structs and add them to list in mdraid_setup() ? would that be enough for image-hd to find them and trigger the build of all of them when needed? what would you suggest? |
One approach might be specifing all the output images of that array in single mdraid image node. But maybe i should just do something like this instead: image raid1-a.img {
mdraid {
level = 1
devices = 2
}
partition data {
image = "mdraid-ext4.img"
}
}
image raid1-b.img {
mdraid {
master = raid1-a.img #most of the config is gonna be inherited from master
position = 2 #this is 2nd device in the array described by master image
}
} and then B image can lookup all the configuration from A image config node... but still this does not guarantee that B will be only generated after A. (UUIDs and other details of the A image need to be decided before generating B). Is there way to enforce dependency? |
OK, i did binary diff of superblocks of two disks belonging to same RAID1 and highlighted the important parts: Some things i am confused about:
Update: oh, the active role is simply number of the disk in the array (not sure why, because we already have DEV_NUMBER) [harvie@anemophobia mdadm]$ grep DISK_ROLE md_p.h
#define MD_DISK_ROLE_SPARE 0xffff
#define MD_DISK_ROLE_FAULTY 0xfffe
#define MD_DISK_ROLE_JOURNAL 0xfffd
#define MD_DISK_ROLE_MAX 0xff00 /* max value of regular disk role */ UPDATE: i did some research on this and it seems there are no rules on how the system should number the devices and roles down the road and that 0xFFFF roles are just OK to be ignored when there are no such disks. Therefore i no longer worry about this as long as the image we generate makes sense. |
…single array (UUID needs to be specified manualy for now) Signed-off-by: Tomas Mudrunka <[email protected]>
Signed-off-by: Tomas Mudrunka <[email protected]>
I am now able to create two partitions belonging to single raid like this: image mdraid-hd.img {
hdimage {
partition-table-type = "gpt"
}
partition mdraid-a {
image = "mdraid-a.img"
partition-type-uuid = R
}
partition mdraid-b {
image = "mdraid-b.img"
partition-type-uuid = R
}
}
image mdraid-a.img {
mdraid {
devices = 2
role = 0
timestamp = 638022222
raid-uuid = "de9980f1-0449-4e83-84bd-98e4b1ca3fe3"
image = "mdraid-ext4.img"
}
}
image mdraid-b.img {
mdraid {
devices = 2
role = 1
timestamp = 638022222
raid-uuid = "de9980f1-0449-4e83-84bd-98e4b1ca3fe3"
image = "mdraid-ext4.img"
}
}
image mdraid-ext4.img {
ext4 {
label = "TEST_FS"
}
size = 5M
} When i do
|
…d is to decide how to size bitmaps Signed-off-by: Tomas Mudrunka <[email protected]>
8573a5f
to
e4c5464
Compare
Signed-off-by: Tomas Mudrunka <[email protected]>
…e sure all member disks refer to the same array Signed-off-by: Tomas Mudrunka <[email protected]>
Signed-off-by: Tomas Mudrunka <[email protected]>
Signed-off-by: Tomas Mudrunka <[email protected]>
…nent to others Signed-off-by: Tomas Mudrunka <[email protected]>
Great news. With last version the required metadata fields are automaticaly exchanged and synced between components. Therefore there is no longer need to manualy set indentical array UUID, timestamp and data to all images. image mdraid-hd.img {
hdimage {
partition-table-type = "gpt"
}
partition mdraid-a {
image = "mdraid-a.img"
partition-type-uuid = R
}
partition mdraid-b {
image = "mdraid-b.img"
partition-type-uuid = R
}
}
image mdraid-a.img {
mdraid {
level = 1
devices = 2
image = "mdraid-ext4.img"
}
}
image mdraid-b.img {
mdraid {
parent = "mdraid-a.img"
}
}
image mdraid-ext4.img {
ext4 {
label = "TEST_FS"
}
size = 5M
} You only need to specify array format for one of the images and other images can refer to it by setting |
Signed-off-by: Tomas Mudrunka <[email protected]>
Signed-off-by: Tomas Mudrunka <[email protected]>
f0488ac
to
cbf50b0
Compare
I think i am ready here. I've implemented all the features i can wish for. Added tests, documented everything. And also added documentation for f2fs, which is something i kinda owed since my f2fs PR was merged 👼 |
Signed-off-by: Tomas Mudrunka <[email protected]>
2d377c0
to
e2662a1
Compare
…"parent" Signed-off-by: Tomas Mudrunka <[email protected]>
This allows to create level 1 MDRAID with 1 device. Can be empty or prepopulated with data image.
Includes unit test using mdadm to check generated image.
Eg.:
It might sound stupid to create single device raid, but it actualy fits my reallife usecase where i pre-generate such raid when making image and user then can very easily add more devices during runtime when needed later. For example like this:
Although it should be simple to pre-generate images for all raid members in genimage. It shouldn't be much harder than generating multiple images with the same RAID UUID and few metadata changes. But i haven't researched that so far.
Also see #191