Merging multiple erofs file systems on the same block device

Gao Xiang hsiangkao at linux.alibaba.com
Tue May 2 13:17:03 AEST 2023


Hi,

On 2023/5/1 22:09, Daan De Meyer wrote:
> Hi,
> 
> I've been looking into erofs as an initramfs replacement by using
> root=/dev/ram0 to tell the kernel to load the initramfs as a ramdisk.

Sorry, I'm on vacation now.

May I ask what's your detailed use cases?  Sure, you could use
/dev/ram0 as a replacement, but currently it still takes double
memory compared with initramfs since ramdisk doesn't support FSDAX
for now (by enabling FSDAX, it won't take double memory at all.)

Actually I think ramdisk FSDAX is useful and I might sync up this on
the following LSF/MM/BPF 2023.

> However, by using a ramdisk instead of the usual compressed cpio, I
> would lose the feature where the kernel merges multiple individual
> cpios together into a single tmpfs filesystem. Looking at the
> documentation for erofs, I noticed that erofs already seems to support
> merging multiple erofs filesystems on separate block devices using the
> device= cmdline option. Would it be possible to extend this so that
Here `device=` is actually used to refer to seperate blobs with the
merged metadata.  For example, you could have

   device=/dev/ram1 original tar1
   device=/dev/ram2 original tar2
   /dev/ram0        merged metadata for tar1 + tar2.

which means, if you'd like to merge multiple EROFS filesystems, you
might need another step to build a merged metadata in advance in order
to merges multiple individual tarballs together, which could be built
when applying images or booting (by using a special bootloader with
such functionality.)

EROFS doesn't support stacking multiple fses runtimely since it seems
a duplicated feature of overlayfs (you could consider using overlayfs
honestly.)

> multiple erofs filesystems that follow each other on the same block
> device can also be merged? This would allow me to pass multiple erofs
> filesystems to the kernel via initrd=, which would get concatenated
> together into a single buffer, which the kernel would write to a
> ramdisk (using root=/dev/ram0) which the kernel would then have erofs
> mount to /dev/root. erofs would notice that there's multiple erofs
> filesystems on the ramdisk and overlay them together (perhaps only if
> a cmdline option is enabled).

Recently, A merged EROFS filesystem with a single block device can
be passed but you might still need a step to build a merged fs tree
before mounting.  Such feature is used to build a metadata and
reuse original tar blobs.

> 
> Does this make sense at all?

Hopefully it helps.

Thanks,
Gao Xiang

> 
> Cheers,
> 
> Daan De Meyer


More information about the Linux-erofs mailing list