Go: linux-load your root partition to RAM and boot it

Source: Internet
Author: User

This tutorial would guide you through the steps to modify your Initramfs to load all files from/to aTmpfs. This would only work withDebianOrUbuntu? or any UNIX thats supports booting from aInitramfs. Since This was a virtual filesystem in RAM, not a virtual harddisk, the this has many advantages.

What do you need:
* Lots of RAM
* Debian based distribution or any, 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 your split it into multiple partitions (/,/boot,/home, swap, ...).

Step 3:
Boot your new system, install updates, drivers if neccessary (this would improve performance), strip it down to the minimum . Every file would be loaded to RAM! A Fresh install uses about 2 GB auf Harddisk-space.

Step 4:
Modify/etc/fstab:
* Make a backup

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 have no error checking# Mount rootmount ${roflag}-t ${fstype} ${rootflags} ${root} ${rootmnt}

* Change it to:

# FIXME This have no error checking# Mount root#mount ${roflag}-t ${fstype} ${rootflags} ${root} ${rootmnt}mkdir/ramboott Mpmount ${roflag}-t ${fstype} ${rootflags} ${root}/ramboottmpmount-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 Local

Step 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/initrd.img-ramdisk

* Label the new Entrie as Ramboot
This would 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 would be loaded to a TMPFS

Results:
Test Setup:
*kernel:linux 2.6.38-8-generic (i686)
*compiled: #42-ubuntu SMP Mon Apr 03:31:50 UTC 2011
*distribution:ubuntu 11.04
*no Graphics Driver
*desktop HP 8100E
*core i7 860
*4GB Memory 2 Modules (DDR3)
*wdveliciraptor 10k RPM 160GB

Go: linux-load your root partition to RAM and boot it

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.