Phil Schaffner wrote:
On Fri, 2006-06-23 at 17:31 -0700, Mike wrote:
  
Greetings CentOS Fans.

I'm working on an Inspiron 9400 Laptop.  It supports booting from USB
devices, so I'd like to install CentOS on a USB hard drive as an
alternative to XP.

I tried booting to the 4.3 (disk 1) CD, but it doesn't see the USB
Drive when it gets to the stage of partitioning... any idea what's
involved in getting the USB drive recognized so I can install CentOS
onto it?
    

OK - got my curiosity up.   Had wanted a USB stick install also.  Was
unable to figure out how to get the installer to see the USB thumb
drive, despite being able to modprobe ehci-hcd, scsi_mod, etc.  in the
Ctrl-Alt-F2 virtual console.  (Anybody else able to manage this?  Would
have allowed a direct install to USB if it had been possible to make it
visible to the installer.)

Here's a kludge for a (per Karanbir - unsupported) 2GB-USB-key-bootable
CentOS 4.3 install:

In a nutshell - do a minimal install to a hard disk partition (may be
done on a different machine - that was my method); boot to it; insert,
fdisk, mke2fs, and mount the USB stick; copy the installed system to the
USB drive; edit /etc/fstab and /boot/grub/grub.conf; make an appropriate
initrd; grub-install; and away you go.  Used a procedure based on
http://www.simonf.com/usb/ for FC3.

In more detail (and omitting some trial/error):

Installed minimal system to a 2GB partition (since my USB drive is 2GB)
using custom install with disk-druid to install to a single partition
(not using LVM), and ignoring warnings about no swap.

Booted from the installed system, logged on as root, and inserted USB
drive which was then recognized.  On my system the USB drive
is /dev/sda.   Ran:

# fdisk /dev/sda
(Made primary partition 1, filling up the entire 2GB USB device, and
made active.)
# mke2fs -jL /el4 /dev/sda1
# mount /dev/sda1 /mnt
# tar lcf - / | tar xf - -C /mnt

Edited /mnt/etc/fstab to look like:
----------------------------------------------------------------------------------------------------
LABEL=/el4        /                        ext3    defaults        1 1
none                    /dev/pts             devpts  gid=5,mode=620  0 0
none                    /dev/shm           tmpfs   defaults        0 0
none                    /proc                 proc    defaults        0
0
none                    /sys                   sysfs   defaults        0
0
----------------------------------------------------------------------------------------------------
Edited /mnt/boot/grub/grub.conf to look like:
----------------------------------------------------------------------------------------------------
default=0
timeout=5
hiddenmenu

title CentOS-4 i386 (2.6.9-34.EL)
	root (hd0,0)
	kernel /boot/vmlinuz-2.6.9-34.EL ro root=LABEL=/el4
	initrd /boot/initrd-2.6.9-34.EL.img
----------------------------------------------------------------------------------------------------
[First guessed (hd1,0) but GRUB sees  the USB drive as (hd0,0) when it
is selected as the boot device.]

Ran:

# chroot /mnt
# mkinitrd -f --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod \
 --preload=sd_mod /boot/initrd-2.6.9-34.EL.img 2.6.9-34.EL

# grub-install /dev/sda

Plugged the USB key into my laptop, booted and chose USB boot device.
Let Kudzu remove/install new hardware.  Success!

Logged on as root, ran:

# yum update
# mkinitrd -f --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod \
 --preload=sd_mod /boot/initrd-2.6.9-34.0.1.EL.img 2.6.9-34.0.1.EL 
# yum install emacs xorg-x11 system-config-display xterm
# yum groupinstall "XFCE-4.2" "Graphical Internet"

(Group "GNOME Desktop Environment" was too big for the stick.  Might be
able to manage a GNOME or KDE environment by careful package selection.
The updates and installs could have been done before the move to the USB
drive.  Using a larger install partition and cleaning up install
packages before the copy operation might have allowed more packages on
the target USB device.)

Rebooted to new kernel, ran:

# system-config-display

Added user with useradd.  Logged in as new user and ran:

$ switchdesk XFCE
$ startx

Got a GUI environment.

Not exactly pretty, and may be problematic when booting on other
hardware, but did yield a reasonable CentOS 4.3 system on USB media.
(I'd still recommend a dual-boot install of CentOS with XP on the laptop
if you want to use it very much.  Knoppix Live-CD, or SuSE or Mandrake
installers can be used to shrink an NTFS partition to make room.)

Phil

  
Now that sounds achievable.  If I can free some time up this week I'll be giving that a try.
Nice work!