HOWTO: setup full Debian on USB and boot from there 

Newsgroups:  gmane.linux.debian.user
Date:        Sun, 14 May 2006 17:40:11 -0400

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

George Hein

installing slackware from HD directory 

http://wardonx.orcon.net.nz/slin.html

If you are lucky enough to have a DOS/Windows partition, you can get round the requirement of making 6 floppies if you can't boot off a CD-ROM.

I got the idea for doing this from Debian, who've had the option of booting an install this way for years, & figured out the method from Kent Robotti's RamFloppy .

ftp://ftp.ibiblio.org/pub/Linux/system/recovery/ramf-118.exe

Linux boot process 

http://www.geocities.com/potato.geo/bootlinuxcd.html

usual Linux boot process 
CD boot process 

The CD boot process is somewhat different. Again we need a boot loader, but we don't necessarily know what device our CDROM is. It could be /dev/hdb, /dev/hdc, /dev/hdd. Even if we told the boot loader where the kernel is, we would still need to tell the kernel where its root filesystem is. ISOLINUX helps us get around this, by working out where the CD is. This allows us to boot the kernel, but it doesn't really help us to load the initial root filesystem. Many boot disks use a thing called an initrd (Initial ram disk) to get around this. initrd is an initial root filing system running in RAM. It loads prior to when the kernel attempts to mount the 'real' root file system. Yes this is odd. The idea is is that your initrd starts up, loads some critical modules, then mounts your real root file system.

my CD startup process 

So why does it have to be a two phase process? Linux doesn't really know how to boot off a CD yet. The beauty of the initrd phase is that the initrd filesystem is loaded by the bootloader (ie. not the kernel). It means that we can effectively boot off any device, so long as the bootloader is able to read from it.

cd:Knoppix 

v3.1-08-11-2002

Info 

KNOPPIX is a bootable CD with a collection of GNU/Linux software, automatic hardware detection, and support for many graphics cards, sound cards, SCSI devices, and other peripherals. It can be used as a Linux demo, educational CD, rescue system, etc. It is not necessary to install anything on a hard disk due to on-the-fly decompression.

Source 

Homepage: http://www.knopper.net/knoppix/index-en.html Tar/GZ: http://freshmeat.net/redir/knoppix/29892/url_tgz/KNOPPIX_V3.1-08-11-2002-EN.iso Mirror site: ftp://ftp.gwdg.de/pub/linux/knoppix/ freshmeat project page: http://freshmeat.net/projects/knoppix/

Build your own rescue CD. 

Newsgroups: comp.os.linux.setup,comp.os.linux.misc
Date: Wed, 1 Jan 2003 07:02:12 +0000 (UTC)
> > Is there a kit out there that allows you to build your own
> > Linux  rescue CD?
>
> I'd give the Knoppix CD a try; I don't know how well it does SCSI
> and/or XFS, but it certainly does come with a lot of tools -- if
> you're into minimal, you can just ignore most of them.  I use it as my
> rescue CD, and it works just fine for my systems.
>

You can try remastering knoppix if it doesn't suit your needs as-downloaded. (Although I warn you you'll need a lot of unpartitioned HDD space to accomplish this task.)

Looks like a relatively simple process, as it sets up partitions to create approximately a working debian distribution. Then just use apt-get to remove stuff and add stuff to suit your desires.

http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/gnumed/gnumed/gnumed/test-area/knoppix/readme.html

Hot tip, you aren't required to actually have a linux distribution installed on your computer to accomplish this task.

Build your own rescue CD. 

My favorite is mkcdrec, it does just what you want. Search for "mkcdrec" on freshmeat.net. You can specify which kernel and modules you want, put as many utilities on it as you want, and it runs off a ramdisk, so you don't need anything but a cd and ram. You can make the ramdisk any size you want.

Build your own rescue CD. 

http://www.bablokb.de/index.html see BBLCD, GENDIST, RECCD

cmd:mkCDrec 

Basic Info 

Info 

mkCDrec — Make CD-ROM Recovery

Description 

Make CD-ROM Recovery (mkCDrec) makes a bootable (El Torito) disaster recovery image, including backups of the linux system to the same CD-ROM if space permits, or to a multi-volume CD-ROM set.

Source 

http://sourceforge.net/projects/mkcdrec

Help 

After a disaster (disk crash or system intrusion) the system can be
booted from the CD-ROM and one can restore the complete system as it was
(at the time mkCDrec was run) with the command
/etc/recovery/start-restore.sh
Disk cloning (clone-dsk.sh script) allows one to restore a disk to
another disk (the destination disk does not have to be of the same size
as it calculates the partition layout itself).  A thrid script,
restore-fs.sh, will restore only one filesystem to a partition of your
choice, and the user can choose with which filesystem the partition has
to be formatted.
MkCDrec supports  ext2 , ext3, minix, xfs , jfs, reiserfs file systems,
LVM and software RAID (multiple devices). Each file system is backed up
as a compressed tar archive (including the tar log).  The compress
program used is the user's choice (compress, gzip, bzip2, lzop,...)  :-)
Moreover, msdos, fat, vfat and ntfs mounted partitions are
recognized and are saved as compressed dumps (on CD, tape, etc.)
The user has the possibility to encrypt all backups with openssl if
desired (see the Config.sh configuration file for more information).
To restore your system completely  just boot from the first CD-ROM made
by mkCDrec and type "/etc/recovery/start-restore.sh " to restore
everything from CD. With the clone-dsk.sh script one can restore
selective a disk or partitions to another free disk.
mkCDrec supports IDE (inclusive ATA), SCSI  disks, hardware RAID based
disks (e.g. Compaq SMART2 Disk Array), LVM and software RAID. With an
El-Torito CD-ROM you can boot from an IDE or SCSI based CD-ROM drive on
Intel based computer systems only.

Versions 

0.7.6, November 24, 2003

Linuxcare Bootable Toolbox 

http://lbt.linuxcare.com/index.epl

The LBT is a fully usable miniature Linux distribution which can be placed on a credit-card sized CD media. The distribution should work in almost any PC with almost any operating system. We offer over 101mb of software including a 2.4 kernel, Xfree86 4.1, full network services for both pci and pcmcia cards, wireless connectivity, perl, and a lot more.

This site will provide several pages of information on this new bootable mini distribution including:

Timo's Rescue CD Set 

http://rescuecd.sourceforge.net/download.html

Boot Scriptor 

v 1.2.11b

Info 

Boot Scriptor is a program that allows a high degree of interactivity when booting from a CD- ROM drive. It provides a set of commands that enable users to boot a system in a number of ways, as well as providing interactive menus. Boot Scriptor runs on top of a specialized version of Isolinux and can act as a front end to it, as well as expanding on the Isolinux feature set to allow more complex boot scenarios. It supports a simple scripting language.

Source 

Linux that runs on a CD 

Newsgroups: comp.os.linux.misc
Date: Mon, 23 Dec 2002 21:39:05 +0000 (UTC)
> I recall some discussion somewhere about some distibutions that run
> completely on a CD.  So far, I have not found them, so I would
> appreciate any pointers and comments (on the distribution).

I know of four such distributions.

Of these, I think Knoppix is the best, followed by the SuSE demo cd. Knoppix also looks like the easiest to remaster with a different set of applications, if you need to and have a couple free gigabytes of HD space.

Ken Bloom