Newsgroups: gmane.linux.debian.user Date: Sun, 14 May 2006 17:40:11 -0400
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
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 .
The PC starts up and runs LILO or some other bootloader
LILO knows where the kernel image is and starts to load it
The kernel runs. When its finished doing all its checks, it attempts to mount the root filesystem. The major and minor numbers for this device are usually encoded in the kernel itself or passed to it as arguments from LILO
Once the file system is mounted, /sbin/init is executed and your system starts up as per your inittab … and your /etc/rc*.d scripts
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.
The CD is installed with ISOLINUX, so it boots first.
ISOLINUX loads the kernel from the /isolinux directory on the CD.
ISOLINUX now loads the initrd.gz compressed ext2 file system. Its important to note that ISOLINUX loads this, and not the kernel. The kernel will grab it later.
The kernel starts up and eventually decompresses the initrd.gz to ram (in /dev/ram0 actually) and mounts it as root. You have to enable INITRD and Ram disk support in the kernel to have this happen.
The kernel tries to execute the /linuxrc file in the new root filesystem (because its an 'initrd').
The linuxrc program tries to mount the CDROM (It has to make a few guesses to work out where it is), then copies a compressed 'real' root filesystem from the CD into /dev/ram1. We mount the new filesystem just so we can add a softlink in its /dev directory for the CD (so we don't have to work out where the CD is again).
When the linuxrc script finishes, control returns to the kernel and it attempts to mount its configured root filesystem. In this case, I've rdev'd the kernel to make it use /dev/ram1 as the root filesystem. This will mount our newly created ram based root file system. In this file system I have an /sbin/init and the system starts up running entirely in RAM.
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.
v3.1-08-11-2002
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.
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/
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.
Hot tip, you aren't required to actually have a linux distribution installed on your computer to accomplish this task.
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.
http://www.bablokb.de/index.html see BBLCD, GENDIST, RECCD
mkCDrec — Make CD-ROM Recovery
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.
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.
0.7.6, November 24, 2003
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:
downloading your own ISO image;
general information on the product;
links to other existing bootable media products; and
our new online companion.
v 1.2.11b
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.
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.
Knoppix (based on Debian) http://www.knopper.net/knoppix/
DemoLinux (based on Debian) http://www.demolinux.org/
SuSE Live Demo CD (based on SuSE) http://www.suse.com/
Virtual Linux (based on Mandrake) http://sourceforge.net/projects/virtual-linux/
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