[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

HOWTO: setup full Debian on USB and boot from there, problems solved



BOOT DEBIAN on and from a USB-harddisk. How I did it.

Only newer computers allow this.
I used a ThinkPad-T42, sometimes with original harddisk in DVD/CD bay.
This will not work with 600e, T20, 240 or 240x thinkpads, too old.

Several months ago, DSL(DamnSmallLinux) and RIP(RecoveryIsPossible) mini-Linux distributions allowed for booting from USB-flash-cards. I did it with RIP, located on USB-sda2-vfat. This involves a boot image containing all files booted into memory and run from memory. USB can be removed after boot.

I also tried to do it with full SUSE and Debian but failed initially.

Lately I noticed that when I copied a Debian partition to a different partition, the kernel would boot completely due to partition info stored in initrd.img by mkinitrd.yaird which is executed at install time.

However, if I temporarily changed /etc/fstab to point to another partition and executed mkinitrd.yaird, I could create a new initrd.img that would work. That gave me the idea that perhaps that was what needed to run on USB as well.

I spent many hours on this and failed until I realized that somehow Debian's annoying change opened up a way of fully executing the kernel
from USB.

----------------------------------------
DIRECTIONS:
----------------------------------------
(0) connect and partition USB flashcard or harddisk

(1) copy a working partition of debian onto a partition

(2) make temp change to your working debian /etc/fstab
e.g. " /dev/hda6 / reiserfs noatime 0 1 "
change hda6 to sda6 or whatever you want

RUN: mkinitrd.yaird -o /initrd.img.USB

UNDO YOUR CHANGE TO /etc/fstab

move this /initrd.img.USB to USB partition in / or /boot
(you may want to browse this img, go to bottom and see fstab information)

(4) install grub-boot programs onto USB
    create device.map (BELOW)
    creat menu.lst    (BELOW)

(5) BE CAREFUL: RUN:
                     grub
                     root (hdx,y)
                     setup (hdx)
                     quit

    where x= 1 if you have 1 hard disk in addition to USB
          x= 2             2
          x= 0 is what you are using for main/only disk
    where y= USB partition# less 1 where your grub files are

(6) try booting, if it does not work, check to see if you have allowed
for boot from USB,  GOOD LUCK

====================================================

To explain my GRUB-MENU-LIST:

I have several PC's + extra drives.  I have them mostly setup as:
hda1- WinJunk
hda2- spare
hda4- backup data and RIP bootable for emergency (I bkup this to DVD)
hda5- swap
hda6- Debian-test
hda7- data
hda8- Debian-test or Debian-Sid-unstable
...

----------------------------------

#/boot/grub/device.map for USB

(hd0)    /dev/sda
(hd1)    /dev/hda
(hd2)    /dev/hdc

-------------------------------------------------

#/boot/grub/menu.lst for USB on sda4

# grub.conf:  grub  :  root (hd1,3)  :  setup (hd1)   GRUB_PARTION=hda4/BKUP
#
#timeout 8
color black/cyan yellow/cyan
#default 3
#fallback 2

title  W2K-vfat (USB-SDA1) executable, marked hidden from other WinJunk
# rootnoverify (hd0,0)                         does not work
# chainloader +1                               does not work
  chainloader --edx=0x0080 (hd0,0)/ntldr

title  RIP-linux-vfat (USB-SDA2->memory)
  rootnoverify (hd0,1)
  chainloader +1

title  FIX-RIP-reiserfs  (USB-SDA4-Locus_of_GRUB-BOOT) [kernel locks up]
  kernel (hd0,3)/boot/kernel root=/dev/sda4 vga=2 acpi=off

title  Debian-reiserfs   (USB-SDA6)
kernel (hd0,5)/vmlinuz root=/dev/sda6 ro vga=791 selinux=0 noresume pci=assign-busses
  initrd (hd0,5)/initrd.img.USB  # or rename it

  title  RIP-linux-reiserfs-(HDA4)
  kernel (hd1,3)/boot/kernel root=/dev/sda4 vga=2 acpi=off

  title  Debian-reiserfs   -(HDA6)
  kernel (hd1,5)/vmlinuz root=/dev/hda6 ro vga=791 selinux=0 noresume
  initrd (hd1,5)/initrd.img

  title  Debian-reirserfs  +(HDC6)
  kernel (hd2,5)/vmlinuz root=/dev/hdc6 ro vga=791 noresume
  initrd (hd2,5)/initrd.img

-------------------------------------------------



Reply to: