Load root filesystem entirely into RAM during boot.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 618a408 Jun 9, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib now works with encryption, plus a bunch of syntax improvements Jan 31, 2018
LICENSE GNU General Public License v3 Oct 28, 2017
README.html typos Jun 10, 2018
README.rst typos Jun 10, 2018
ramroot typos Jun 10, 2018



Run Linux entirely from RAM! This project creates and enables a custom mkinitcpio hook that completely loads the root (and /boot) filesystem into RAM during the initramfs boot stage.


Arch Linux
This package is designed specifically to work with the Arch Linux boot process. I suspect these scripts may work with slight modifications on other distributions as well, however this is currently untested.
The ramroot script can be run as root or as a normal user. If executed as a normal user, sudo will be called when necessary to modify or create initcpio files, and the user will be prompted for his or her sudo password.


This package is available in the AUR for easy installation, however the ramroot script can also be run directly from a local git clone of this repository.


ramroot <action> [options]


Ramroot can enable and disable the pre-userspace loading of the root (and /boot, if it exists) filesystem to RAM during system boot.

When ramroot is enabled, during the initial phase of boot the amount of detected RAM on the computer along with the size the root filesystem to be copied is shown on the screen. If there is at least 500MB more RAM than the size of the filesystem, the user will be prompted to load the root filesystem to RAM. (Confirmation prompt defaults to yes with a 15 second timeout.)

The size of the zram partition created is determined by taking the size of the root filesystem plus half of the extra available RAM (to a maximum of 6GB).

Other partitions will not be copied to RAM or mounted by default. Usage of the -F option can be used to mount additional partitions defined in /etc/fstab.


Action performed by ramroot; one must be specified.

Remove ramroot from /etc/mkinitcpio.conf HOOKS. Remove ext4, vfat, and zram from /etc/mkinitcpio.conf MODULES. Rebuild linux cpio boot image.
Rebuild build and runtime hooks in /usr/lib/initcpio. Add ramroot to /etc/mkinitcpio.conf HOOKS. Add ext4, vfat, and zram to /etc/mkinitcpio.conf MODULES. Rebuild linux cpio boot image.
Disable ramroot. Remove build and runtime hooks from /usr/lib/initcpio.
Print ramroot and root filesystem status to screen. Return exit status 0 if enabled and currently loaded to RAM. Return exit status 1 if enabled and not loaded RAM. Return exit status 2 if disabled.


All are optional (although --root may be required as noted below).

-b, --boot <UUID>
Specify /boot partition UUID to use when building hooks.
-D, --dryrun
Execute action without making any changes. Useful for debugging or viewing changes in ~/.cache/ramroot before enabling.
-F, --fstab
Mount all partitions (other than root and /boot) in /etc/fstab normally.
-H, --help
Display help text and exit.
-K, --keep
Keep copies of new build and runtime hooks in ~/.cache/ramroot.
-M, --message
Print 'Arch on RAM' message at tty login by using custom /etc/issue.
-N, --no
Change startup prompt default to not load filesystem to RAM.
-r, --root <UUID>
Specify root partition UUID to use when building hooks; required if unable to detect UUID via lsblk or /etc/fstab.
-t, --timeout <SECONDS>
Set RAM boot prompt timeout (default=15).


The filesystem transfer to RAM can take several minutes. As soon as the boot process is complete, the boot media can be safely removed.

Remember that all changes to files in RAM are completely lost once the computer is reboot. To update the system and edit files, boot the device without transferring the filesystem to RAM.

Keep a clean and trimmed down system to maintain faster RAM sync times. Arch Linux stores downloaded packages in /var/cache/pacman/pkg/. After every update, if no problems occur, consider removing old packages. Consider installer fewer packages if you intend on loading to RAM often.

Also, keep in mind that higher quality (more expensive) USB flash drives often exhibit a dramatic improvement in RAM sync times.

Issues / Future Implementations

  • get UUIDs during boot
    • more portable; UUIDs not hardcoded into initcpio hook
    • no need to rebuild linux image with UUID changes
  • use getopts to easily allow grouping command line options together
  • --rsync option with status=progress (maybe use rsync automatically if installed)
  • option to create a unique hostname for each RAM boot instance
  • improve security features
    • option to require removal of boot media before starting userspace
    • option to fail boot unless loaded to RAM (requires chroot to make changes; advanced users)
  • flush action to sync the RAM filesystem back to the initial boot device
  • test on other distros


This project was motivated greatly in part by the liveroot package and by several inquisitive forum posts.

Author:Chris Magyar
License:GPL 3.0
Donate(xmr):41dUPANhvCvLUuRVJpUc9cRFnsLHzWiTPUhyuamrVwa61xoP uxZaD6R28cLqxEhTaC6LuwcHtkbUi2uELDD88MoQHJKePvP