Is the root filesystem stored in RAM uncompressed or are the files only expanded when they are accessed for the first time?
Root filesystem in RAM
(4 posts) (3 voices)-
Posted 10 years ago #
-
As no one else has answered, I'm not here too often, I believe they are copied to ram uncompressed.
If you check ram usage against the linuxfs (& kernel?) sizes, that should confirm, (or not).
(In a terminal run 'free -m')
Hope that helps.Posted 10 years ago # -
The root filesystem is stored in RAM uncompressed in the buffer cache as tmpfs.
Posted 10 years ago # -
Thanks for the confirmation but while I was awaiting an answer I found a way to move an existing install's root uncompressed to RAM on the fly:
Decompress the initramfs to a temporary directory:
mkdir /tmp/initramfs/ cd /tmp/initramfs/ gzip -d < /mnt/boot/initramfs-linux.img | cpio –i
Add the code below to init immediately after the real root is mounted:
echo echo " || Press a key to load root filesystem to RAM..." echo if read -t 3 -n 1 k then mkdir /tmp/real_root/ mount --move /new_root/ /tmp/real_root/ mount --verbose -t tmpfs -o size=50% none /new_root/ echo echo " || Copying root filesystem to RAM..." echo cp -a /tmp/real_root/* /new_root/ umount /tmp/real_root read -p " || Done! Press [Enter] to continue..." RESP else clear echo echo " || To late! Normal boot in progress..." echo fi
Re-compress the initramfs:
find . | cpio -o -H newc | gzip -9 > /mnt/boot/initramfs-linux.img cd ~
This could easily be adapted to any distro atop any storage regime. Just remember that only updates while booted to the real root are persistent but the good thing is they will follow through to the RAM root the next time you boot into it.
The above is redundant with respect to SliTaz but it may provide some clarity on how to go about having the root filesystem loaded to RAM for increased system performance.
Posted 10 years ago #
Reply
You must log in to post.