How is the size of init ram disk determined when initramfs is used?

Bernd Petrovitsch bernd at petrovitsch.priv.at
Sun Jan 1 12:32:55 EST 2023


Hi all!

On 07/10/2022 04:32, Chan Kim wrote:
[...]
> I'm using initramfs.cpio.gz for initial file system image.
> I embed it in the kernel Image file.
> After linux boots, when I'm in the shell, I can create files.
> But I'm curious how much the file system can grow.

Why not just try it once;-)

> I remember somewhere reading that the initramdisk is made and the initramfs
> archive is extracted in the ramdisk.

Makes the most sense - a RamFS implementation exists (e.g. mounted
on /tmp for speed) and using this and extraction a cpio (or whatever
archive format) into it is the simplest.

> Then how is the ramdisk size determined? During the build usig Kconfig
> variable, or does it dynamically grow?

See also the other mail - the distribution builds it with the
"necessary" stuff (whatever that is) to mount the "real" root
filesystems.

After the real root filesystem is mounted, the initramfs as such
is no longer accessible and - thus - will be freed (I assume - I
didn't check recently) to not use physical RAM unnecessarily.

FWIW one can run the system completely out of a initramfs - we did
that at a former employer of mine for an embedded Linux system (4MB
Flash RAM for the bootimage, 16MB physical RAM - it was Kernel
2.4.0 in 2000:-).

Kind regards,
	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
      There is NO CLOUD, just other people's computers. - FSFE
                      LUGA : http://www.luga.at




More information about the Kernelnewbies mailing list