-
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, F2FS documentation #277
base: master
Are you sure you want to change the base?
Conversation
e3f0cc8
to
3d315c9
Compare
The test run |
Seems to be fixed now. |
6f8e73a
to
237d917
Compare
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. |
6991d55
to
23b009a
Compare
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
|
6b07e1e
to
5d4a6d1
Compare
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 |
5d71282
to
f0488ac
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 👼 |
e2662a1
to
d3202a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly cosmetic stuff left.
And please squash all the mdraid commits.
Hmm, I thought the F2FS stuff was already a separate commit but it's not. That should really be separate. If you create a separate PR for that and remove it here, then I can do that (hopefully I won't forget that... :-)) |
Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com>
Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com>
OK, squashed this PR into two commits. MDRAID and F2FS. |
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