This guide is adapted from http://reboot.pro/topic/14547-linux-load-your-root-partition-to-ram-and-boot-it/
What you need:
- lots of RAM
- Debian based distribution or any that supports booting from initramfs
- mkinitramfs or a tool to build a new initramfs
- some linux knowledge
- no need to create an image
- no need for Grub4Dos
- no need for a "special driver"
Step 1: Choose a distribution thats supports booting from initramfs. (like ubuntu)
Step 2: Install to harddisk. Make sure you split it into multiple partitions (/, /boot, /home, swap, ...).
Step 3: Boot your new system, install updates, drivers if neccessary (this will improve performance), strip it down to the minimum. Every file will be loaded to RAM ! A fresh install uses about 2 GB auf harddisk-space.
Step 4:
modify /etc/fstab
:
cp /etc/fstab /etc/fstab.bak
find the line specifing the root partition and change it in:
none / tmpfs defaults 0 0* save
Step 5: edit the local script in your initramfs: cd /usr/share/initramfs-tools/scripts/* make a backup of /usr/share/initramfs-tools/scripts/local cp local local.bak* modify local, find this line:
# FIXME This has no error checking
# Mount root
mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
change it to:
# FIXME This has no error checking
# Mount root
#mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
mkdir /ramboottmp
mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} /ramboottmp
mount -t tmpfs -o size=100% none ${rootmnt}
cd ${rootmnt}
cp -rfa /ramboottmp/* ${rootmnt}
umount /ramboottmp
- save
- execute, or rebuild initramfs mkinitramfs -o /boot/initrd.img-ramboot* replace modified local with original file cp -f local.bak localStep 6:
- modify this file (needs a better solution) /boot/grub/grub.cfg* copy the first boot entry and replace the /initrd line with this: /initrd /boot/initrd.img-ramboot* label the new entry as RAMBOOT This will boot our generated initramfs instead the original one. Step 7:
- reboot
- choose standart boot (no ramdisk)
- choose RAMBOOT and all your files on the root partition will be loaded to a tmpfs
Thanks Sulunia. I've tried echoing, but the notice will only remain on the screen for a few seconds.
...
Does anyone know how we can update the ramboot or change it? I tried going back and repeating the instructions at least a dozen times in different orders and with different configs, and I keep ending up with 'init not found' and 'cp: command not found' error at boot. To get it working again I just copy the old /boot/initrd.img-ramboot.bak back to /boot/initrd.img-ramboot, but that's just the old ramboot file.
EDIT
All has been fixed when I did a complete reinstall and got rid of my FrankenDebian OS, which had a mixture of stable + unstable packages—yeah, I know, what was I thinking??? Anyways, I can now update grub and run mkinitramfs without issue.