遊龍

游龙
君不見黃河之水天上來,奔流到海不復回? 君不見高堂明鏡悲白髮,朝如青絲暮成雪?人生得意須盡歡,莫使金樽空對月。天生我材必有用,千金散盡還復來。烹羊宰牛且為樂,會須一飲三百杯。岑夫子,丹丘生,將進酒,杯莫停。與君歌一曲,請君為我傾耳聽。鐘鼓饌玉不足貴,但願長醉不願醒。古來聖賢皆寂寞,惟有飲者留其名。陳王昔時宴平樂,鬥酒十千恣歡謔。主人何為言少錢,逕須沽取對君酌。五花馬,千金裘,呼兒將出換美酒,與爾同銷萬古愁!

Monday, June 16, 2008

How to Boot Fedora 9 Live from the Hard Drive

I just wanna give Fedora 9 a try. After downloading the iso image of the Live CD. I tried several times to boot it from my hard drive but no luck. I almost quit and burn the iso image to a CD and boot it from the CD drive. Jeez, it took me almost ten minutes to get into the gnome desktop on my laptop (1.6GHz AMD Turion 64 processors, 512MB RAM). That's not standable. I can't imagine how slow the installation process would be. So I get back to my initial attempt: boot the Live system from the hard drive. I search the web but find almost nothing except in the Fedora forum a thread which talks the same thing though without a solution. I look around in the iso image. Finally I find something useful and with its help I successfully boot the Live system from the hard drive. In case of help to others, I write down the detailed steps below. (I assume you already have got a GNU/Linux in your box. Mine is Ubuntu.)

1. Get the ISO Image
Download an iso image of Fedora 9 Live CD/DVD from its website. Save it somewhere. In our case, ~/Distro/

2. Prepare your Hard Drive
Create a new partition on your hard drive using your favourite partition manager. GParted for gnome users, QtParted for KDE users. Or if you prefer the command line, cfdisk or fdisk is there for you. Anyway, create a new partition of size 1GB (750MB should be enough, but I am not sure, anyway, better more than less). In our case the newly created partition is `/dev/sda8'. Format it. We choose ext3. The name for SATA/SCSI hard drive is sdxn, while for IDE hard drive is hdxn (where x is the disk number, almost always a letter, and n is the partition number, counting from 1). You should be aware of what you have and choose the right name for your hard drive. But note that GRUB does not distinct them, any hard drive is simply called hdxn, where x is the disk number while n is the partition number (counting from 0). Don't confuse them. For more, read the GRUB manual, by typing the command `info grub' in your terminal.

3. Dump the ISO Image into the Hard Drive
Open a terminal, type in the following commands. Note that the su-way is for non-Ubuntu users. Ubuntu users, skip the first command su, add sudo to each command below if you prefer the sudo-way.)
su
cd /mnt/
mkdir fedora{ISO,Live}
mount -o loop -t iso9660 ~/Distro/Fedora-9-Live.iso fedoraISO
mount -t ext3 /dev/sda8 fedoraLive
cp -a fedoraISO/* fedoraLive/
umount /mnt/fedora*
Replace `Fedora-9-Live.iso' with the ISO image you get and `/dev/sda8' with the partition you created in Step 2.

4. Edit the GRUB Configuration
Open the famous `/boot/grub/menu.lst' file of GRUB using your favourite editor. Add the following lines to the end of the file.
# Fedora 9 Live
title Fedora 9 Live
root (hd0,7)
kernel /isolinux/vmlinuz0 root=/dev/sda8 rootfstype=ext3 rw quiet liveimg rhgb
initrd /isolinux/initrd0.img
Replace `root (hd0,7)' with `root (hdx,n-1)' if your partition is `/dev/sdxn' (or `/dev/hdxn'), `root=/dev/sda8' with `root=/dev/sdxn' (or `root=/dev/hdxn' ) , `ext3' in `rootfstype=ext3' with the file system type name you choose for the partition in Step 2, e.g., xfs. Save the changes to the `menu.lst' file.

5. Reboot and Done
Reboot and choose ``Fedora 9 Live'' from the GRUB menu.


That's all. I know you are curious how I make it, right? The key point is the options to the kernel. I get these options from the `isolinux.cfg' file lying in the same directory as the kernel, i.e., `/isolinux/'. Below is what's in the file. I am sure you will find it.
default vesamenu.c32
timeout 100

menu background splash.jpg
menu title Welcome to Fedora-9-Live-i686!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color timeout_msg 0 #ffffffff #00000000
menu color timeout 0 #ffffffff #00000000
menu color cmdline 0 #ffffffff #00000000
menu hidden
menu hiddenrow 5
label linux0
menu label Boot
kernel vmlinuz0
append initrd=initrd0.img root=CDLABEL=Fedora-9-Live-i686 rootfstype=iso9660 ro quiet liveimg rhgb
menu default
label check0
menu label Verify and Boot
kernel vmlinuz0
append initrd=initrd0.img root=CDLABEL=Fedora-9-Live-i686 rootfstype=iso9660 ro quiet liveimg rhgb check
label memtest
menu label Memory Test
kernel memtest
label local
menu label Boot from local drive
localboot 0xffff
Finally thanks to the Fedora team, you guys have done a really good job!


0 comments:

The Jedi Code

There is no emotion; there is peace.
There is no ignorance; there is knowledge.
There is no passion; there is serenity.
There is no death; there is the Force.