On Fri, 3 Jan 2025 09:14:30 +0800 Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote: > Hi, > > 在 2025/01/02 19:48, Tomas Mudrunka 写道: > >> Just curious, what you guys do for filesystems like ext4/xfs, and > >> they just define the same structure in user-space tools. > >> > >> looks like your tool do support to create ext4 images, and it's > >> using ext4's use-space tools directly. If it's true, do you > >> consider to use mdadm directly? > >> > >> Thanks, > >> Kuai > > > > Yes, we do use external tools when possible. It is not possible > > with mdadm. Mdadm cannot create disk image of MD RAID array. Kernel > > does this. > > I'm a bit confused here, if you mean metadata, I think it's mdadm that > write init metadata to disk, the only exception is dm-raid. I think it means that currently you have to create kernel (MD) raid device (assemble using metadata) to have a chance creating image. > > > We want/need purely userspace generator, so we don't have to care > > about permissions, losetup, kernel-side mdraid runtime, etc... We > > just want to generate valid image without involving kernel in any > > way. > > I believe mdadm can do this, Mtkaczyk what do you think? I agree. The right way is to incorporate it with mdadm. We should create a volume image (data) without MD internals. With that, we will have control on this functionality. Also, we will be able to provide support for every metadata format. > > The problem is that system service will recognize raid disks and > assemble the array automatically, you might what to disable them. I don't think we need to care. They goal is to not have and use MD module so mdadm will fail to load personalities. > > Thanks, > Kuai > > > I was using mdadm before switching to genimage and it adds > > complexity of handling all the edge cases of kernel states. > > Mkfs.ext4 can create image without involving kernel, mdadm cannot, > > it always instructs kernel to create the metadata for it when > > creating array. > > > > In my opinion we should decide whether it makes sense for kernel to > > export the structures in header file and either provide all of > > them, or provide none. That might be valid reasoning to say every > > userspace program should include its own definitions of structures. > > But providing half does not make any sense. Sorry, This is old application and some solutions are here for years- they are working so nobody tried to change them. If you are looking for challenges this software is full of them! Thanks, Mariusz