Booting distros from an external hard disk - a trial
Booting distros from an external hard disk
I know there are problems of booting distros from an USB hard disk so I thought I would wait and let others to sort out all the trouble before coming in to enjoy fruit of their success. Therefore I waited and waited but my patience ran out.
Last weekend I made my second serious attempt to boot some distros off an external hard disk with some degree of success. Here is the write-up on the attempt.
The USB disk is a 200Gb Pata known to Linux as sda. I have disconnected the internal disk temporarily to do the installations. I pre-partitioned the disk with 3 primaries sda1 (1Gb fat16), sda2 and sda3 (25Gb each, sda2 in partition type a5 for ufs filing system and sda3 not used), sda5 as a 1Gb swap, sda6 to sda10 in 10Gb each and the remainder from sda11 to sda15 20Gb each. sda6 to sda15 are partition type 83 for native Linux. I used cfdisk program for the partitioning work.
The installation is no different to the one for internal hard disk except the hard disk name will be the SCSI/Sata type for being a USB disk. The same disk was used internally as a hda before. I just put it into an external hard disk enclosure and hooked it to a PC via a USB cable.
The PC has a MSI KT8 Neo mobo, a AMD64 3000 CPU, 2GB ram, a Nvidia fx5200 video card and onboard Gigabyte nic and sound.
12 installed systems
A SCSI/Sata/USB hard disk can have a maximum of 15 partitions and I used them as follow:-
sda1 : FreeDOS, the only system not installed but ported directly from another disk
sda2 : PcBSD 1.0, the only BSD that works. FreeBSD and Solaris failed.
sda3 : not yet filled
sda4 : extended partition for sda5 to sda15
sda5 : swap partition for all the Linux
sda6 : Slax 4.1.8
sda7 : Mandriva 2007
sda8 : Suse 10.3 alpha1 (booted by FC6 kernel)
sda9 : Fedora Core 6
sda10 : Slackware 11 (booted by FC6 kernel)
sda11 : Ubuntu 7.04
sda12 : PCLinuxOS 2007 test 2
sda13 : Sabayon 3.0
sda14 : Raysx 1.5 (booted by Knoppix kernel)
sda15 : Knoppix 18.104.22.168
All the above 12 installed systems are working normally.
I made the attempt because only recently I discovered the USB legacy support had been disabled all the time and I couldn't get the USB hard disk to boot. When I corrected it I was surprised Mandriva boots without a hitch. Hence I decided to try the big names like Red Hat, Slackware, Suse, Ubuntu, Gentoo and Knoppix
The FreeDos was what left in the disk in a different partition when it was working as an internal disk before. I just migrated it to sda1. It was the first Dos I run from an USB drive.
I tries FeeBSD 6.2, DesktopBSD 1.0, Solaris 10 and PcBSD 1.0. Only the last one was successful. These Unix-like distros need to be installed in the primary partitions of sda2 or sda3. It was a surprise to me PcBSD boots as I wasn't expect any of them would work.
For Linux installation I just used a single partition for each distro and tell each installer to use the single partition to mount the root “/” of the Linux.
The common swap in sda5 was seized by every distro without any intervention from me.
The output of terminal command “fdisk -l” is show below
Linux systems that boot immediately after installation
root@saikee-desktop:~# fdisk -l
Disk /dev/sda: 203.9 GB, 203928109056 bytes
255 heads, 63 sectors/track, 24792 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 122 979933+ 6 FAT16
/dev/sda2 123 3161 24410767+ a5 FreeBSD
/dev/sda3 3162 6200 24410767+ c W95 FAT32 (LBA)
/dev/sda4 6201 24792 149340240 5 Extended
/dev/sda5 6201 6322 979933+ 82 Linux swap / Solaris
/dev/sda6 6323 7538 9767488+ 83 Linux
/dev/sda7 7539 8754 9767488+ 83 Linux
/dev/sda8 8755 9970 9767488+ 83 Linux
/dev/sda9 9971 11186 9767488+ 83 Linux
/dev/sda10 11187 12402 9767488+ 83 Linux
/dev/sda11 12403 14834 19535008+ 83 Linux
/dev/sda12 14835 17266 19535008+ 83 Linux
/dev/sda13 17267 19698 19535008+ 83 Linux
/dev/sda14 19699 22130 19535008+ 83 Linux
/dev/sda15 22131 24792 21382483+ 83 Linux
I found all the distros have no resistance against being installed in a USB external hard disk and the following Linux boot straight way without hestiation:-
Slax 5.1.8, Fedora Core 6, Mandriva Free 2007, Ubuntu 7.04, PCLinuxOS 2007 Test 2, Sabayon 3.0 (representing Gentoo) and Knoppix 22.214.171.124.
Linux systems that failed to boot after installation
Three distros Suse 10.3 Alpha 1, Slackware 11 and Rayslx 1.5 didn't boot after installation with error like panic and not syncing etc.
I believe the proper way to make such distros bootable could require a different ram disk file and possibly a re-compilation of the kernal, all of which are foreign and a lot of work to me at this stage.
Being lazy by birth I thought if distro A can successfully boot from an external disk while distro B can't then what is stopping me from using the kernel and ram disk file from of distro A on distro B. So I tried and had some success.
Suse 9.3 doesn't boot by iteslf. Attempting to boot it with Mandriva and Knoppix kernel also failed but it boots happily with Fedora C6 kernel and initrd.
Slackware 11 doesn't boot by itself. It boots when I substituted the Fedora C6 kernel and initrd.
Rayslx 1.5 doesn't boot by itself too. Fedora and Mandriva sets of kernel and initrd failed to fire it up but those from Knoppix did the trick.
I can't offer any explanation except that a Linux user has enormous amount of choices of kernel and ram disk files at his/her disposal and trying a few ones out can bring an happy ending to the booting problems. I know it is a short term fix and even be regarded cheating but it is perfectly legal in Linux and I have seen some distros offer to multi-boot fellow Linux by this technique.
Boot loader consideration
When installing each system I only allow FC6 to take over the MBR and for the rest of the distros I require each installer to install the boot loader inside the root partition, thereby making each distro “chainloadable” by either Grub or Lilo.
The FC6 menu.lst is shown below
The red bits in the above indicate how I added the absolute partition reference in front of the kernel and initrd statements to “source” another kernels to boot the Linux. If I miss the red bits out Grub will search the vmlinuz and initrd files within the partition specified by the “root” statement.
title Fedora Core (2.6.18-1.2798.fc6) @ sda9
kernel /boot/vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet
title Freedos @ sda1
title PcDOS 1.0 @ sda2
title Slax 5.1.8 @ sda6
title Mandriva 2007 Free @ sda 7
title Suse 10.3 @ sda8
kernel (hd0,8)/boot/vmlinuz-2.6.18-1.2798.fc6 ro root=/dev/sda8 rhgb quiet
title Slackware 11 @ sda10
kernel (hd0,8)/boot/vmlinuz-2.6.18-1.2798.fc6 ro root=/dev/sda10 rhgb quiet
title Ubuntu 7.04 @ sda11
title PCLinuxOS 2007 Test 2 @ sda12
title Sabayon 3.0 @ sda13
title RaysLx @ sda14
kernel (hd0,14)/boot/vmlinuz-2.6.19 root=/dev/sda14 rw ramdisk_size=100000 apm=power-off nomce vga=791
title Knoppix 126.96.36.199 @ sda15
For comparison purpose I list out the relevant menu.lst of the three Linux that can't boot themselves from the USB external hard disk (they boot after kernel and initrd substitutions)
Suse 10.3 menu.lst
Slackware 11 lilo.conf
title openSUSE 10.3
kernel /boot/vmlinuz-2.6.20-2-default root=/dev/disk/by-id/usb-Maxtor_6_Y200P0_68-part8 vga=0x31a resume=/dev/sda5 splash=silent showopts
Rayslx 1.5 menu.lst
boot = /dev/sda
message = /boot/boot_message.txt
timeout = 1200
vga = 773
image = /boot/vmlinuz
root = /dev/sda10
label = Linux
title RAYS LX
kernel /boot/vmlinuz-2.6.15-1-486 root=/dev/sda14 ro vga=785 splash=silent
In attempting to install the 12 operating systems into an external hard disk the following 9 distros boot normally just as though they are in an internal hard disk.
FreeDOS, PcBSD 1.0, Slax 4.1.8, Mandriva Free 2007, Fedora Core 6, Ubuntu 7.04, PCLinuxOS 2007 test 2, Sabayon 3.0, and Knoppix 188.8.131.52
These 3 Linux did not boot initially but fire up if their kernels are replaced by those from other Linux
Suse 10.3 alpha1 (booted by FC6 kernel)
Slackware 11 (booted by FC6 kernel)
Raysx 1.5 which is a Chinese Debian (booted by Knoppix kernel)
I failed to install the following systems : FreeBSD 6.2, Desktop BSD 1.0 and Solaris 10.
The only Linux that I didn't manage to install was Gentoo which reported one of my partitions its installer “dislikes”.
It looks like Debians (Ubuntu and Knoppix), Red Hat (Fedora), Mandrake (Mandriva, PCLinuxOS), Gentoo (Sabayon) and Slax familes distros are USB-disk friendly.
Suse and Slackware are not bootable out of the box from a USB hard disk. They could be overcome by selectively substituting their kernel and initrd files with those from Linux that boot successfully from the same USB hard disk.
Last edited by saikee; 05-03-2007 at 10:26 AM.
I think you could add MEPIS 6.0 to the list of usb-disk friendly distros, with a couple of disclaimers. First, it only appears to work if you have rootdelay=10 added to the /boot... line, though I've never tried it chainloaded from another distro on the same drive. Second, I could only get it to boot that way from my desktop, not my wife's Averatec laptop, until I set up grub for dos on the laptop's win xp internal hd as described in this thread:
Run, Bill! It's Tux, the linux monster!
Hmm, I have MEPIS running on an external drive and I don't think I had to do anything particularly special to get it to work. I just tell the BIOS to boot that drive and away I go. I know I had a few issues at first because I had planned to chainload it from my normal Grub installation, but that wasn't a good idea because then it changed the drive assignments (hda, hdb, etc.) from what they had been when I installed and that confused the partition scheme in fstab.
I have pclinux, on a small 80 gb ion drive works great.
The external disk allows only 15 partitions so I might have to hook up another one external hard disk get more operating systems in.
It was easier than I thought but hopefully more distros will become external disk friendly in time to come.
I have tried to install ubuntu.6.06 to an external drive with no luck. I then tried Suse 10.1 which successfully installed once I selected the correct place for the GRUB location. I then tried to install ubuntu 6.10 and once again it failed. Whats more with both ubuntu distros the external drive would not boot from a warm boot at all. It would boot as far as the grub menu but selecting anything resulted in grub error 22. To this day I have not got it working with ubuntu??
I suggest you disable the gfxmenu statement by preceeding it with a "#", like
in Suse's /boot/gryb/menu.lst.
This allows you to activate a Grub prompt by pressing the "c" key at the Grub boot screen.
In a Grub prompt you can ask if Grub can see all the disks by commands
If you can see the external disk among the disks then Ubuntu can be booted by Grub.
FRom a Grub prompt you can go back to Suse boot screen with command
To diagnose why your Ubuntu doesn't boot you have to provide the following information
(1) Output of root terminal command "fdisk -l"
(2) /boot/grub/menu.lst from Ubuntu partition
(3) /boot/grub/device.map from Ubuntu partition
(4) /etc/fstab from Ubuntu partition
as it turns out when I do the ubuntu installation the menu.lst file is created with my external drive as hd1 and the bootable sector as the second ie. it writes
root (hd1,1) which I would expect to work perfectly. However when I boot from the usb drive the hd is reversed so that hd1 is now the internal and hd0 the external drive, something to do with the boot ordering I guess. Anyway by editing the menu entry when I get to the boot options screen (by pressing 'e') I can change the root entry to (hd0,1) and it boots. It still only boots from a cold boot mind you, but I think this may have something to do with the quick POST that is applied for warm boot, I will try when I get home and post response on here. Thanks everyone for your advice, it is much appreciated
It seems that this is an old thread but I want to ask a question anyway. Is your usb hdd transferable to other pc, I mean not the same hardware specs as the one you use in installing them?
By the way, did you used Linux Installer CD or live CD as I've read from other forum? Can you please provide guide for me to follow to install several Linux distro on my external hdd? Thank you in advance!
You can put certain Linux distros into a USB device, be it a hard disk or a memory device, and use them on different machines. In such a case you simply copy the expanded iso, by a loop back device, from a download iso file to the USB device. Since an iso is supposed to be booted from a CD so its boot loader isolinux has to be replaced by Grub. This thread shows the basic steps, first putting several iso to one DVD and secondly onto a USB jump drive. If the USB hard disk is the final destination it is just the change of the device name. The above link has the isolinux to Grub conversions showed by examples.
The bad news is not all the iso have been written to boot from a hard disk and the installer may keep searching the system files from the CD drive. Less than 40% of the iso are bootable after they have been transferred into a USB hard disk/memory device at the time I wrote the thread.
You can install any Linux distro into an external hard disk the same way it is installed into an internal hard disk. A normal installation is hardware specific and may not work if the installed distros are moved to a new machine.
For installation it doesn't matter what kind of CD is used. The different between an installation CD and Live CD is the Linux can be used without being installed first in the latter.
There is no difference between installing several Linux distros in a USB hard disk and a USB memory device. The procedure is exactly as installing them in an internal hard disk. The trick is knowing the device names and the disk order before and after the installation. If you find it hard to cope with then temporarily disable the internal hard disks leaving the USB hard as the sole bootable disk will simplfy the matter considerably.
It is noteworthy to point out that when booting a Linux from a USB device the support by USB drivers has to be compiled into the initrd file but is not universally done in every distro. Thus while there is no problem in installing the distro in a USB hard drive or memory device the distro may not necessarily bootable in the end. This is not a hardware problem but just the way the distro has been arranged.
In conclusion one should be aware that booting from USB devices is not yet fully developed/implemented in every distro.
Last edited by saikee; 08-26-2008 at 05:55 AM.
Thank you very much for the fast reply, though it is not yet very clear to me. Please let me explain as I understand it and correct me if I'm wrong.
I make reference to 2 other threads with similar topic 1) http://www.justlinux.com/forum/showthread.php?t=150078 2) http://justlinux.com/forum/showthread.php?t=147959
Supposed I have 10 Linux live distros and I wanted to run all from my usb hdd, I will do the following:
1.) Create the following partitions on my usb hdd
Partition 1 - 1 Gb for DOS
Partition 2 - 1 Gb for Grub
Partition 3 - 2 Gb for Linux swap (common to all)
Partition 4 - 10 Gb ext3 for distro 1
Partition 5 - 10 Gb ext3 for distro 2
Partition 6 - 10 Gb ext3 for distro 3
Partition 7 - 10 Gb ext3 for distro 4
Partition 8 - 10 Gb ext3 for distro 5
Partition 9 - 10 Gb ext3 for distro 6
Partition 10 - 10 Gb ext3 for distro 7
Partition 11 - 10 Gb ext3 for distro 8
Partition 12 - 10 Gb ext3 for distro 9
Partition 13 - 10 Gb ext3 for distro 10
Partition 14 - 100 Gb FAT32 for files (common to all)
2.) Install DOS on partition 1
3.) Install grub on partition 2.
4.) Expand each live distro's iso to its designated partition.
5.) Edit menu.lst according to each distro.
Should I use this
- title Videolinux 2.0 @ hda7
or this one
- LABEL slax
MENU LABEL Slax Text mode
APPEND vga=normal initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw
Both example are copied from 2 threads mentioned above.
What's the difference of the 2 menu.lst?
What else should I do next.
Your choice (1)
is a indirect booting.
title Videolinux 2.0 @ hda7
Your choice (2)
is a direct booting.
MENU LABEL Slax Text mode
APPEND vga=normal initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw
Normally you must boot one system directly by placing its Grub or Lilo in the MBR. The rest can either be all directly or all indirectly or a combination of both.
Basically in an indirect booting you use the Grub in the MBR to boot another boot loader. It is then up to the second boot loader to fire up its own Linux. Indirect booting is easy to work with as you only need to know the partition name correctly whereas for the direct method the kernel and initrd names must be supplied accurately.
In any Linux if you tell its installer to place its boot loader inside its root partition (that is the partition you install the Linux) then the Linux is chainloadable or can be booted indirectly. Nothing else is needed.
In my 145 systems thread I put Grub in a data-only partition and installed it in the MBR. Thus I did not have any operating system to boot directly and every one of the 145 systems could be booted indirectly. It is an example to show how easy to use Grub this way because I could write the menu.lst before installing any of the 145 systems.
You can do the same with your second partition.
Your partition scheme has one flaw and that is not knowing an extended partition has to come out from giving up one of the 4 primaries. Therefore your 4th partition must be scarificed as the extended partition. This leaves you with a total of 10 systems as follow
1st partition Dos
5th to 13th Partition inclusively have a Linux
2nd partition has no operating system but just Grub
3rd partition is a swap
4th partition is an extended partition defining the 5th to 14th partition
14th partition is data only.
A hard disk has 16 device names. Leaving the entire disk device name like sda aside you can have 15 devices names from sda1 to sda15. Thus you can have the 15th partition if you want.
If you are not already aware the 1st to the 4th partitions are reserved as the primary partitions.
Last edited by saikee; 08-26-2008 at 06:38 PM.
Can I use indirect booting even the files on each partitions are only expanded from the live cd? Or do I need to install each distro to its respective partion?
Can you help me decide how much space is needed for each of the following distros:
Trinity Rescue Kit
System Rescue CD
Forensic Boot CD
And which of the above list will most probably run on usb hdd using indirect booting. I am using MS eversince I learned using PC but I want to shift to Linux. The reason I want to do this project is to familiar myself to as many distros as possible and bring my distros whenever I go. You could expand my distro list if you have other suggestion. I also have vmware images of some of the distros mentioned above.
One more thing, if the format of my Linux partitions is ext3, how could I expand iso images to each if I'm in Windows. Or how could I do the same if I'm using Ubuntu live cd. I'm not yet familiar with Linux commands.
I also downloaded grub and the file stage1.5 is not there, only stage1 and stage2.
Please understand if I'm asking too much. I'm just in the learning stage. Your help is very much appreciated. Thank you.
Just a couple of comments, if you're just trying them out, and especially if you already have VMWare images of them, I'd just install one and run the rest in VM's until you decide what you want to use. A VM will give you a pretty good idea of what each distro is all about and it's a whole lot easier than messing around with trying to install each to an external drive.
Also, Red Hat is not free anymore. Might not be the best candidate for experimentation if you're not sure you want to use it.
As far as isos go, there are ext3 drivers you can install in Windows (for instance, this one), or you can just download the isos in Linux and burn them using something like K3B or another burning app. That's probably the easiest way.