Ramroot – Run Arch Linux Entirely From RAM!

Ramroot - Run Arch Linux Entirely From RAM

As you already know, everyday there are hundreds of new additions to the GitHub repository. But, many good projects go unnoticed, and never receive the attention they deserve. Our primary purpose is to find and promote the useful open source projects via OSTechNix. Today, I have stumbled upon a cool project called Ramroot. Using Ramroot, we can run Arch Linux entirely from RAM! Yes, you read right. It loads the entire root filesystem into RAM at boot. It is specially designed for Arch Linux. I tried it in Ubuntu, but It didn’t work. I hope the developer will make it to work on other Linux distributions as well.

Ramroot – Run Arch Linux Entirely From RAM!

Installing Ramroot

Git clone the Ramroot repository using command:

$ git clone https://github.com/arcmags/ramroot.git
Cloning into 'ramroot'...
remote: Counting objects: 94, done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 94 (delta 41), reused 82 (delta 32), pack-reused 0
Unpacking objects: 100% (94/94), done.

The above command will create a folder named “ramroot” in the current working directory and save all contents of Ramroot project in it.

Then, go to the Ramroot bin directory:

$ cd ramroot/bin/

Make the following files a executable:

$ chmod +x ramroot-build
$ chmod +x ramroot-enable

Finally, run the following command to enable the Ramroot.

$ ./ramroot-enable

Enter your sudo or root password when prompted.

 :: Detected root UUID: d474cdf2-e6a2-4cc3-9899-aa9468af1753
 :: Detected /boot UUID:
 :: ramroot_hooks built in /home/sk/ramroot/build
 #: sudo cp /home/sk/ramroot/build/ramroot_hook /usr/lib/initcpio/hooks/ramroot
 #: sudo cp /home/sk/ramroot/build/ramroot_install /usr/lib/initcpio/install/ramroot
 [sudo] password for sk:
 :: ramroot hooks installed
 :: Added MODULE: zram
 :: Added MODULE: ext4
 :: Added HOOK: ramroot
 :: new mkinitcpio.conf created in /home/sk/ramroot/build
 #: sudo cp /home/sk/ramroot/build/mkinitcpio_ramroot.conf /etc/mkinitcpio.conf
 #: sudo mkinitcpio -p linux
 [sudo] password for sk:
 ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
 -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
 ==> Starting build: 4.9.6-1-ARCH
 -> Running build hook: [base]
 -> Running build hook: [udev]
 -> Running build hook: [ramroot]
 -> Running build hook: [autodetect]
 -> Running build hook: [modconf]
 -> Running build hook: [block]
 -> Running build hook: [filesystems]
 -> Running build hook: [keyboard]
 -> Running build hook: [fsck]
 ==> Generating module dependencies
 ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
 ==> Image generation successful
 ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
 -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
 ==> Starting build: 4.9.6-1-ARCH
 -> Running build hook: [base]
 -> Running build hook: [udev]
 -> Running build hook: [ramroot]
 -> Running build hook: [modconf]
 -> Running build hook: [block]
 ==> WARNING: Possibly missing firmware for module: aic94xx
 ==> WARNING: Possibly missing firmware for module: wd719x
 -> Running build hook: [filesystems]
 -> Running build hook: [keyboard]
 -> Running build hook: [fsck]
 ==> Generating module dependencies
 ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
 ==> Image generation successful
 :: ramroot enabled

Now, reboot the system. At boot process, you will be asked to load the filesystem into RAM or not. Type “Y” to proceed.

Ramroot1

Please note that this prompt (y/N) defaults to yes with a 10 second timeout if 4G or more of RAM is detected. Since, I have 2GiB RAM, I had to type “Y” to continue. Wait for a while to finish the loading process. It will take several minutes to load the entire root filesystem into RAM. Make sure you have sufficient RAM installed on your system. If you want to maintain faster RAM sync times, try to keep a clean and trimmed down system. Remove old and unnecessary packages, and keep your package cache folder clean.

Once root filesystem is loaded into the RAM, you will be landed into rootfs prompt. Please note that nothing will be saved after reboot. Because, now Linux is entirely loading from RAM, not from the local disk.

Remove Ramroot

Reboot your system, and type “n” when it asks to load the filesystem to RAM to login normally to your Arch Linux system. Go to the ramroot/bin folder and make the following files as executable.

$ cd ramroot/bin/
$ chmod +x ramroot-disable
$ chmod +x ramroot-remove

Finally, remove Ramroot from your Arch Linux system using commands:

$ ./ramroot-disable
$ ./ramroot-remove

Ramroot might be helpful for those who wants to do testing on their Arch Linux box. Also, if you want a private session to learn Linux commands, Ramroot is definitely helpful. Give it a try, and don’t forget to share your thoughts about this project in the comment section below.

Cheers!

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...