This is a howto on my new and improved RAM booting method. The original, by IsaacKuo, is located here:
http://forums.debian.net/viewtopic.php? ... 74&start=0
It has been a base for building this solution to a huge extent. However, as this is meant to be a standalone how to, let's see what you can accomplish by this method:
What this is about
1. The solution allows you to load your whole Debian system into RAM memory so that you can minimize your disk usage after it has been fully loaded and receive a performance gain, eliminating the I/O bottleneck
2. An addinational feature is an union filesystem which allows you to still read your system from the storage (disk) but write the changed files to RAM. This way, you achieve a COW (Copy-On-Write) setup.
Use cases
1. Building a snappy desktop machine to deliver blazing performance for amazing your friends
2. Running a Debian system from only a single medium (e.g. a pendrive) on multiple workstations - you boot on one, then pull the storage and plug it into another and so on
3. Building a kiosk system where all changes should be lost between reboots
4. Enhancing security by only booting into 'read-write' mode when upgrades are needed - to minimize disk activity, one would need some kind of network storage (this is out of the scope of this document)
Goals
- To provide a convenient way of allowing the system to boot into RAM / to boot in a volatile mode
- To be non-intrusive and to impose no unnecessary difficulties with management tasks on the system administrator
- To actually work
Currently, this solution has several drawbacks. I am going to target them in the future or find someone who will do it for me. These are:
- Mounting only 1 filesystem/partition is supported by the provided scripts - you are supposed to keep everything on one partition, otherwise your files from other partitions will not be there when you boot. You can still mount your own filesystems during runtime, though.
- There is no cleanup when booting to RAM - the whole system gets copied over, so with a standard desktop install, the memory can be filled very easily. Therefore, it is important to carefully choose your packages when planning a ram-booting system. It could probably be improved by using some of IsaacKuo's advice, like only copying what is necessary - this is a TODO.
All the scripts are packaged and available as a deb file for installation with dpkg.
The package uses dpkg-divert during installation and removal and replaces initramfs scripts with its custom ones to accomplish its goals.
There is no source deb because all files in the actual package are human-readable script files anyway. You are free to examine their content and modify them as you wish etc.
1. Get the package (along with dependencies) and install it
Code: Select all
# The dependency:
apt-get install aufs-tools
# The package file
wget http://rkaw.pl/make-me-live_0.2.deb
# at this point, if you want to review what's being installed - a good reading for educational purposes:
# mkdir make-me-live && cd make-me-live && dpkg-deb --extract make-me-live_0.2.deb . && dpkg-deb --control make-me-live_0.2.deb
dpkg --install make-me-live_0.2.deb
Code: Select all
apt-get install aufs-modules-$(uname -r)
Now, you need to regenerate your initramfs:
Code: Select all
update-initramfs -k all -u
The newly installed initramfs scripts support two new boot options. That means, you can just pass options to the kernel and your system will boot accordingly.
The boot options are:
toram - loads your whole system into RAM (option 1 as described at the top of this document)
live - mounts your root filesystem as aufs with read-write branch being tmpfs, so all changes done to the filesystem will be lost after reboot
For testing purposes, you may just append one of those options to your kernel command line in your boot loader.
When you are satisfied with how it works, you can, for example, set one of those options as a default boot option (should be the case when you are building a kiosk machine).
3. Notes on removal / upgrade
Removal should be straightforward if ever needed. However, it helps to check if all the files are back on their places (for list of files, see the package file).
Please report bugs and, possibly, patches. Thanks for your attention.