This tutorial explains how to fix the Ubuntu Boot to Ram or "toram" feature that was broken in Ubuntu 7.04. Boot to Ram will enable a user to copy the entire Ubuntu live environment to system ram and run the Ubuntu Operating System entirely from there. You can then remove the CD or USB device and continue to do your work from system memory. BootToRam is also commonly referred to as CopyToRam.
Update: With recent Ubuntu distributions and derivatives, You just append the toram boot parameter at startup.
Notes: This tutorial is for the intermediate Linux user. As of 10/15/2007 you cannot copy to ram and use casper persistent both during boot. Toram does not know how to handle the persistent partition. So you must choose one option over the other at boot.
- Ubuntu Live CD
- CD-Rom drive
- 3-4GB USB storage device or hard drive (partitioned as ext2 or ext3) for storing the extracted filesystem
Fixing the Boot to Ram "toram" feature in Ubuntu
The first step is extracting or decompressing filesystem.squashfs:
1. Insert your Ubuntu 7.04 Live CD and reboot your PC
2. Insert a USB hard-drive or use a partition on your local hard drive
3. Open a terminal and type sudo su (to change to root)
4. Type fdisk -l and locate the drive/partition you want to use.
5. Type the following commands, replacing sdxx with your actual drive/partition found in step 4:
mkdir /c && mount /dev/sdxx /c
mount -o loop -t squashfs /cdrom/casper/filesystem.squashfs /mnt
rsync -avx -P /mnt/. /c/fix/.
6. To correct the casper boot script to allow booting to ram, type:
cp -r casper /c/fix/usr/share/initramfs-tools/scripts/casper
7. To regenerate the initrd.gz, type:
chroot /c/fix /bin/bash
mkinitramfs -o /new-initrd.gz 2.6.20-15-generic
mv /c/fix/new-initrd.gz /c/initrd.gz
8. To rebuild and compress the new filesystem.squashfs, type:
apt-get install squashfs-tools
mksquashfs /c/fix /c/filesystem.squashfs -noappend -always-use-fragments
9. Insert your bootable USB Ubuntu pendrive and replace the old filesystem.squashfs and initrd.gz files with the new files from the "new" directory on your other USB drive or partition
10. Press f6 at startup and then append toram to boot Ubuntu into System Memory
*Ubuntu is a product of Canonical Ltd