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

Chan Kim ckim at etri.re.kr
Sun Jan 1 21:37:49 EST 2023


Hello all,

Thanks for the replies and discussion.
So following Bernd's suggestion, I tried making a big file to see how big
the file system can grow.
Using qemu (arm64, I think it will be the same in real machine, it was
always almost the same), 
I tried 'dd if=/dev/zero of=test bs=1M count=768' and I see a file with size
768MB is generated.
So it seems it uses the available ram (I had 1GB ram, and the initial file
system size was only 19MB)
(BTW, I had to do 'mknod /dev/zero c 1 5 in the init script for this)
My real board doesn't have disk connected now and we'll be doing things on
ram for now.
Thank you.

Chan Kim

>-----Original Message-----
>From: Nicholas Mc Guire <der.herr at hofr.at>
>Sent: Monday, January 2, 2023 4:23 AM
>To: Bernd Petrovitsch <bernd at petrovitsch.priv.at>
>Cc: kernelnewbies at kernelnewbies.org
>Subject: Re: How is the size of init ram disk determined when initramfs is
>used?
>
>On Sun, Jan 01, 2023 at 06:32:55PM +0100, Bernd Petrovitsch wrote:
>> 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;-)
>
>ramdisks are static - so if you mount ram0 and ramdisk_size=8192 then your
>ramdisk is occupying 8MB and that will be the hard limit at least on some
>architectures (x86, I think also arm).
>
>>
>> >I remember somewhere reading that the initramdisk is made and the
>> >initramfs archive is extracted in the ramdisk.
>
>On some architectures you can pass the size as kernel parameter
>ramdisk_size=#kb and that will then set the size of the ramdisk when you
>mount it (at boot or during normaal operations).
>
>As I did not find what archtiecture you are refering to this might help -
>grep for ramdisk_size in Documentations and you should have it. E.g. for
arm
>it is marked as obsolete (arm/boot.rst) but still seems to be supported
with
>CONFIG_DEPRECATED_PARAM_STRUCT set.
>Wonder what it is being replaced by.
>
>thx!
>hofrat
>
>_______________________________________________
>Kernelnewbies mailing list
>Kernelnewbies at kernelnewbies.org
>https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies







More information about the Kernelnewbies mailing list