Installing Fedora 15 in less than 640M of RAM

Saturday, June 4, 2011

So there’s a hard limit of 640 megs of ram with Anaconda in Fedora 15…which is rather annoying on the livecd, because it doesn’t need anything like that amount to install, moreover a cumulation of the unified initrd, anaconda, yum and semodule on the dvd’s installation which will eat your RAM.

Anyway, below is a method for installing the livecd image in much less than 640…I’ve tested it at 512, but it doesn’t seem to get much more than 200M so I’m guessing it would work lower.

Use at your own risk…it worked for me πŸ™‚

#method for installing Fedora15 live in less than 640M RAM
#
#this particular version is for a vm, but the basic rules should apply
#
#create a raw disk image big enough
qemu-img create -f raw FedoraLive.img 10G

#boot the liveCD, along with the disk image, with 512M RAM

qemu-kvm -m 512 -hda FedoraLive.img -cdrom Fedora-15-i686-Live-Desktop.iso

# you can boot either runlevel 3 or 5, but you only need a console, so 3 is enough (append 3 to the boot argument)
# next, confirm that your unpartitioned, raw disk is available
fdisk -l | grep sd

#should return something like “Disk /dev/sda doesn’t contain a valid partition table”
#fdisk the device and create a valid partiton table of 3 partitions (one for /boot, one for /, one for swap
# in my case, I have /dev/sda1 (200M) for /boot, /dev/sda2 (2G) for swap, /dev/sda3 (the rest) for /boot
#
#make the filesystem
mkfs.ext3 /dev/sda1
mkfs.ext3 /dev/sda3
mkswap /dev/sda2

# loopmount the squashfs
mkdir /squash
mount -o loop /mnt/live/LiveOS/squashfs.img /squash

# dd the contents of the filesystem to /dev/sda3 (or whichever you used for /)
dd if=/squash/LiveOS/ext3fs.img of=/dev/sda3

#this could take a while, because its 4G in size. I haven’t played with various blocksizes (bs=fooM), but I guess that might speed things up a bit

#now to check everything went across ok

#make the sysroot directory
mkdir /sysroot
#mount the device
mount /dev/sda3 /sysroot
#mount the boot partition
mount /dev/sda1 /sysroot/boot
#check that the contents of /sysroot looks like a proper filesystem, then resize /dev/sda3 to the maximum size
resize2fs /dev/sda3
# copy the kernel into your sysroot
cp /boot/vmlinuz-* /sysroot/boot
# copy the splash image into your sysroot (make it pretty)
cp /boot/grub/* /sysroot/boot/grub/
# chroot into your filesystem
chroot /sysroot
# create an initramfs
dracut -f
# make a menu.lst in /boot/grub/
# it should look something like this

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora
kernel /vmlinuz-2.6.38.6-26.rc1.fc15.i686 root=/dev/sda3 quiet rhgb
initrd /initramfs-2.6.38.6-26.rc1.fc15.i686.img

# now, exit the chroot
exit
# next, install grub on your new filesystem
grub-install –root-directory=/sysroot /dev/sda
#
#reboot and enjoy your Fedora 15 πŸ™‚

10 Comments

  1. Bob Lightfoot says:

    Tested the How To on 512M with the i686 livecd just now.

    Note need to mkdir /sysroot/boot/grub directory before you can copy the splash screen into sysroot.

    Also STRONGLY advise that open Terminal and su to root and run passwd to lock down root account on new system.

  2. Bob Lightfoot says:

    Tested the i686 LiveCD install by this method with only 256 meg ram for the vm. It works.

    Another note the dracut -f command will generate several missing firmware errors, this is expected and has not been an issue for me. There will also be a sed cannot find file to set context error.

    NOTE : nano is not installed as an editor with this procedure.

  3. Dave says:

    Awesome that it works in 256 also.. Yeah the dracut noise happened for me also.

    Nano isn’t a default package in any of the fedora installs afaik, but yeah.

  4. Bob Lightfoot says:

    Notes from Dell Inspiron B120 Install on Real Hardware.
    1. Note this was an F14 /WinXP Dual Boot System which was being upgraded to F15/WinXP Dual Boot
    2. Had to reboot live CD after modifying Partition Table and before making file systems.
    3. As Advertised had to create my own /etc/fstab for mounting / ; /boot and swap partitons
    4. Also found it nice to edit /etc/sysconfig/network to change Hostname and Domainname for machine
    5. Will Post More as I use this install and see what else must be tweaked versus standard install

  5. Bob Lightfoot says:

    I should note that the Install to Real Hardware was approximately 30 minutes.

  6. Dave says:

    Hrm, sounds alot…is there any possibility of us stringing together a scripted install on that box to remove the human element from the timing calculation?

    The longest part of the task is dd’ing the filesystem to the new partition, although there isn’t much we can do, adjusting the block size to say 4M might help…cool test case though πŸ™‚

  7. Krystian says:

    “# next, install grub on your new filesystem
    grub-install –root-directory=/sysroot /dev/sda
    #”

    grub-install: The file /boot/grub/stage1 not read correctly

    Shame, but this method is the only to install F14 on older machines :-/ Upgrading from F14 not working – Anaconda won’t start, and even netinstall. In future thinking – it’s the only way to get newest version, upgrading not working anymore for 512MB and lower PC’s (ok, not working on my laptop). Best solution is to buy more RAM or change distro :-/

  8. Dave says:

    yeah, Anaconda, yum, semodule eat the ram…I think yum’s latest incarnation is supposed to be 100M leaner during the installation process, although I’m yet to try it

  9. Bob Lightfoot says:

    Just isntalled F15 Grapical Desktop to a VM with 1024 of ram and ran the command
    rpm -qa –qf ‘%{name}\n’ >> ks.cnf on the Graphical Desktop installed normally.
    Used scp to move that file to the system I installed by this “hackstall” and
    Then ran yum install $(cat ks.cnf) and found that 148 packages were missing / not installed.

  10. Bob Lightfoot says:

    Please Note I like this install method and my earlier comment calling it a “hackstall” was not meant to carry a negative connotation, just that it is not an automatic scripted install. My 148 package difference was between the LiveCD Install and the GoldDVD Install. And would most likely exist no matter how the LiveCD was installed.

Leave a Reply