BootToRAM

Differences between revisions 4 and 5
Revision 4 as of 2007-05-04 16:46:31
Size: 2751
Editor: STRATTON-THREE-THIRTY
Comment:
Revision 5 as of 2007-05-04 16:51:24
Size: 3516
Editor: STRATTON-THREE-THIRTY
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:

'''WARNING''': The author asserts that this procedure works for him, but cannot guarantee that this procedure works for anyone else. Although this procedure is meant to be 100% safe, it is feasible that there may be mistakes, or a chance of misunderstanding the instructions in a manner that causes loss of data. Please make a backup and do not attempt on mission critical systems. Read through this article thoroughly, and do not attempt if you do not comprehend or feel comfortable about any of the instructions!
Line 34: Line 36:
First, we need to unpack the LiveCD for customization. First, we need to unpack the LiveCD for customization. For this article, I am going to place the compressed filesystem image at /casper/filesystem.squashfs and the kernel/initrd at /casper/vmlinuz and /casper/initrd.gz respectively. We are going to unpack a temporary root for editing at /casper/chroot

Booting Ubuntu To RAM

Preface

This article aims to document the process of creating a customized Ubuntu that loads an image from the hard disk to RAM, then boots an entire Ubuntu session out of RAM. It is intended for intermediate to advanced Ubuntu users who are familiar with the shell, and may have limited experience customizing the livecd (LiveCDCustomization) and shell scripting. We will customize a LiveCD and copy it to the hard drive, and make a few modifications to bootup scripts so that it copies to RAM via our good friend tmpfs.

WARNING: The author asserts that this procedure works for him, but cannot guarantee that this procedure works for anyone else. Although this procedure is meant to be 100% safe, it is feasible that there may be mistakes, or a chance of misunderstanding the instructions in a manner that causes loss of data. Please make a backup and do not attempt on mission critical systems. Read through this article thoroughly, and do not attempt if you do not comprehend or feel comfortable about any of the instructions!

Use Cases

There are many cases where one would like to boot Ubuntu to RAM:

  • Performance: The desktop performance is dramatically improved. A 400MB squashed filesystem in RAM, that holds 1200MB of data, is read back on a 1.6GHz Core Duo in about 3 seconds, including decompression time.
  • Power, Noise, Durability: Although modern hard disks don't use much power compared to other system components, this may still be important for some. In laptops, hard disks are often the noisiest components, so this setup can reduce system noise. With the hard disk spun down, a laptop can potentially withstand greater shocks without damage.
  • Abrupt poweroff: Since the hard disk is only momentarily used in read-only mode during boot, then never touched again, there are few or no negative consequences of an abrupt poweroff. If a system is used where power is inconsistent, or the system is regularly used in a context where fast shutoffs are required, this is very handy.

Requirements

The most obvious increased requirement is RAM. For best performance, I recommend having 256MB RAM + enough RAM to hold a customized image. Stripping Openoffice and some fonts and documentation from a stock Ubuntu LiveCD results in a 400MB compressed image, which fits in RAM comfortably on a system with 1GB RAM.

Tmpfs can fall back on swap (Ubuntu LiveCD scripts will mount any swap it finds), which is excellent for a bit of overflow, but if you regularly need to fall back on swap, performance will naturally suffer.

I have not investigated CPU requirements, but squashfs is compressed and decompressing takes some CPU power, so this is probably not a great idea on systems older than the Pentium III era.

As far as setting this system up, the requirements would be:

  1. Having a Feisty LiveCD ISO or CD handy.
  2. About 2-4GB of free space
  3. A combined 1GB or so of RAM and swap available.

The Process

Unpack LiveCD

First, we need to unpack the LiveCD for customization. For this article, I am going to place the compressed filesystem image at /casper/filesystem.squashfs and the kernel/initrd at /casper/vmlinuz and /casper/initrd.gz respectively. We are going to unpack a temporary root for editing at /casper/chroot

BootToRAM (last edited 2011-07-18 07:35:36 by 96)