SliTaz SliTaz Forum

You are not logged in.

#1 2014-03-12 21:29:00

KairiTech
Member
Registered: 2014-03-07
Posts: 3

Root filesystem in RAM

Is the root filesystem stored in RAM uncompressed or are the files only expanded when they are accessed for the first time?

Offline

#2 2014-03-28 11:22:06

Guest
Guest

Re: Root filesystem in RAM

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.

#3 2014-03-28 11:33:42

bellard
Administrator
Registered: 2011-03-28
Posts: 657

Re: Root filesystem in RAM

The root filesystem is stored in RAM uncompressed in the buffer cache as tmpfs.

Offline

#4 2014-03-28 18:50:49

KairiTech
Member
Registered: 2014-03-07
Posts: 3

Re: Root filesystem in RAM

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:

[c]mkdir /tmp/initramfs/
cd /tmp/initramfs/
gzip -d < /mnt/boot/initramfs-linux.img | cpio –i[/c]
Add the code below to init immediately after the real root is mounted:

[c]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[/c]
Re-compress the initramfs:

[c]find . | cpio -o -H newc | gzip -9 > /mnt/boot/initramfs-linux.img

cd ~[/c]
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.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 1.53 MiB (Peak: 1.77 MiB) ]