PDA

View Full Version : Boot from USB to IDE hard



crisaish
1st October 2006, 07:57 AM
I have 3 hd: IDE, SATA and an externel hd USB to IDE. If I try to boot FC5, witch is installed on the external hd, I have "Error 23.Error on parsing number"
I started in "linux rescue" of the instalation CD, but it told me that I don`t have any Linux partition and I can`t mount sysimage.I can`t even reinstall Fedora, because the instalation CD don`t see the USB to IDE hard.
fdisk -l showed me the following drives:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 2 19457 156280320 f W95 Ext'd (LBA)
/dev/sda5 2 19457 156280288+ b W95 FAT32

Disk /dev/sdb: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 701 5630751 7 HPFS/NTFS
/dev/sdb2 2002 4361 18956700 f W95 Ext'd (LBA)
/dev/sdb3 4362 4997 5108670 7 HPFS/NTFS
/dev/sdb4 702 2001 10442250 83 Linux
/dev/sdb5 3593 3723 1052226 82 Linux swap / Solaris
/dev/sdb6 3724 3978 2048256 6 FAT16
/dev/sdb7 3979 4361 3076416 b W95 FAT32

Partition table entries are not in disk order


Grub.conf configuration:


# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (sd1,3)
# kernel /boot/vmlinuz-version ro root=/dev/sdb4
# initrd /boot/initrd-version.img
#boot=/dev/sdb
default=0
timeout=10
splashimage=(sd1,3)/boot/grub/splash.xpm.gz
#hiddenmenu
title Fedora Core (2.6.15-1.2054_FC5)
root (sd1,3)
kernel /boot/vmlinuz-2.6.15-1.2054_FC5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.15-1.2054_FC5.img
title Other
rootnoverify (sd1,0)
chainloader +1


Can anyone suggest me what should I do to boot from external hd ?
Thank you.

couran
5th October 2006, 03:05 PM
Hi,

If you want to boot your FC5 on /dev/sdb4 and /dev/sdb is your external drive,
then you need to do several things.
Some of these are pretty obvious but I will say them anyway.

Make sure usb hard disk is listed before the ide and sata drives in your BIOS boot order.

Make sure your usb-external disk is plugged in to a USB2.0 port
(If you plug your drive into a running FC5 system, dmesg shows several new lines, one of which reads something like:
usb 1-3: new high speed USB device ....
If it doesn't say "high speed" then you are in trouble.
Still, all might not be lost since some motherboards have a mixture of USB2.0 and the earlier USB1.0 or USB1.1 ports. Try the other ports.)

If "high speed" is there, keep going.

When you installled FC5 onto the usb-external drive make sure grub was installed onto the mbr of that drive.

In the grub.conf of your external drive you need to change the root line.
Your external drive will be the first hard disk encountered, so:

root (hd0,3) # for /dev/sdb4 in your case.

If you boot now, you should get a kernel panic.

That's good, since only a few things left to do.

You need to make sure that your kernel line in the grub.conf file points to your kernel:
kernel /boot/vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/sdb4

Adjust the first line of your /etc/fstab to match the above line:

/dev/sdb4 / ext3 defaults 1 1

Next you need to build a new initrd which contains the drivers to load
your usb disk.

Boot using the first install CD or the DVD and use linux rescue.
Go past all of the options until you get to a command line.
Don't expect linux rescue to know where your new installation is.

At the command line:
mount /dev/sdb4 /mnt/system
chroot /mnt/system
Now if you do a "ls" you should see your new system.
cd boot
ls will show your new kernel

Now you need to build the new initrd:
mkinitrd --preload=echi-hcd --preload=usb-storage --preload=scsi_mod \
--preload=sd_mod usb-initrd-2.6.15-1.2054_FC5.img 2.6.15-1.2054_FC5

You should now find the new usb-initrd-2.6.15-1.2054_FC5.img in the present directory, (/boot)

So now, edit the initrd line in grub/grub.conf file:

initrd /boot/usb-initrd-2.6.15-1.2054_FC5.img

Change the title line so you know what is being booted from the grub
menu.

exit && exit
Reboot.

Let us know how you go.

Couran.

crisaish
6th October 2006, 10:45 PM
I did what you told me and I get an error: "No modules available for Kernel "usb-initrd-2.6.15.-1.2054_FC5".
Please help!
Thanks.

couran
6th October 2006, 11:53 PM
I did what you told me and I get an error: "No modules available for Kernel "usb-initrd-2.6.15.-1.2054_FC5".
Please help!
Thanks.

Hi crisaish,

If you got as far as I think you got, then you have a usb-initrd-2.6.15-1.2054_FC5.img in your /boot directory.
If this is so, then all you have to do is get the initrd line in /boot/grub/grub.conf right.

The line you sent and quoted above has an extra "." between usb-initrd-2.6.15 and -1.2054_FC5.img

So remove this extra "." and try again.

If your kernel didn't load or if you don't have the usb-initrd-2.6.15-1.2054_FC5.img in the /boot directory, then we have to go back a bit further.

If you are still getting the same error message about not finding the modules, then we need to rebuild the usb-initrd again.

When you write the lines above:

mkinitrd --preload=echi-hcd --preload=usb-storage --preload=scsi_mod \
--preload=sd_mod usb-initrd-2.6.15-1.2054_FC5.img 2.6.15-1.2054_FC5

make sure that there is no space after the "\" before you press the return key before writing the second line.
Alternatively, put both lines on a single line and leave out the "\"

Let me know if either of these steps helps.

Couran.

crisaish
8th October 2006, 12:33 PM
Hello!
I tried again and in /boot appeared usb-initrd-2.6.15-1.2054_FC5.img, but when I try to boot FC5 it stopps and it gives me an error:

Mounting root filesystem
mount: missing mount point
Setting up other filesystems
Setting up new root fs
setuproot:moving /dev failed: No such file and directory
no fstab.sys, mounting internal default
setuproot: error mounting /sys: No such file and directory
setuproot:error mounting /proc: No such file and directory
switching to new root and running init
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file and directory
Kernel panic-not syncing: Attempted to kill init!

I would be grateful, if you could help me again.

couran
8th October 2006, 04:21 PM
Hi crisaish,

Well, I'm not sure exactly what is happening but could you check that
you have an entry in /boot/grub/grub.conf on the usb-external drive
which says:


title Fedora Core (2.6.15-1.2054_FC5) on USB2 external hard disk.

root (hd0,3)

kernel /root/vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/sdb4

initrd /boot/usb-initrd-2.6.15-1.2054_FC5.img


The /etc/fstab file on the usb-external partition /dev/sdb4 should look
much like this:


#LABEL=/ / ext3 defaults 1 1
/dev/sdb4 / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/sdb5 swap swap defaults 0 0


You can see that I have "commented out" the line which begins with
"LABEL=/ " by putting a # in front of it.
Make sure it lookes like this, with nothing moved onto the next line
from a line above or it will not be read properly.

I think you are probably close to getting things finished.

Check again that you have no typos, that spaces are where they should
be, that hyphens (-) are not mixed up with underscores (_) and so on.

I will be online for a little while. Let me know.

Couran.

Addition:
If all of the above looks good but still not finding your root device, then try changing the entries which say /dev/sdb4 to /dev/sda4.

Perhaps the sata drive wil be /dev/sdb when you boot first to the usb external drive.
Change the entries in the kernel line of the grub.conf and in /etc/fstab

couran
8th October 2006, 04:28 PM
crisaish,

Sorry but the formatting of the grub.conf entry and of the entry in /etc/fstab were completely lost in the last post I sent. I think it is something to do with the way spaces and tabs are handled and I am not sure how to overcome this.

Please make sure that the formatting and spaces for these entries in the grub.conf and /etc/fstab file match the way they normally are.

I will have to read up on how to post so that formatting is retained.

Couran.

P.S.
Please see addition to the last post.

crisaish
8th October 2006, 07:39 PM
Hello, Couran!
Here is my grub.conf:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,3)
# kernel /boot/vmlinuz-version ro root=/dev/sdb4
# initrd /boot/initrd-version.img
#boot=/dev/hdc
default=0
timeout=5
splashimage=(hd0,3)/boot/grub/splash.xpm.gz
#hiddenmenu
title Fedora Core (2.6.15-1.2054_FC5)
root (hd0,3)
kernel /boot/vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/sdb4
initrd /boot/usb-initrd-2.6.15-1.2054_FC5.img
title Other
rootnoverify (hd0,0)
chainloader +1

fstab:

#LABEL=/ / ext3 defaults 1 1
/dev/sdb4 / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/sdb5 swap swap defaults 0 0
/dev/sdb1 /mnt/win2000 ntfs defaults 0 0
/dev/sdb3 /mnt/winxp ntfs defaults 0 0
/dev/sdb7 /mnt/fat32 vfat defaults 0 0

Whwn booting, it see sata as sda, so usb must be sdb.It is trying to resume swap partition from /dev/hdc5 in stead from /dev/sdb5. Maybe partition table from MBR was not refreshed?
Thanks again for your help.

couran
8th October 2006, 10:37 PM
Hi crisaish,

No, I think that your usb external drive is not being detected
as /dev/sdb

Try changing the kernel line in grub.conf to /dev/sda4
and the first active line in /etc/fstab to start with /dev/sda4

If still no go, then change both to /dev/sdc4 and give that a try.

Couran.

couran
12th October 2006, 01:58 PM
Hi crisaish,

Haven't seen a post from you on this thread for a while, so I was wondering whether you had managed to boot from your usb external hard drive.

Earlier on it seemed that your kernel was loading and later on that you had built the new initrd, only to find that your root device was not being found.

I don't think that the problem is a partition table entry, since your partition table doesn't know whether your disk will be /dev/hda1 or /dev/sdb or even c:\ or d:\

I was thinking that to get around the issue of whether your external disk is /dev/sda4 or not you could change the entries in the grub.conf and in /ec/fstab back to the LABEL format.

So, in /etc/fstab you would have:


LABEL=/ / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
#/dev/sda5 swap swap defaults 0 0

At least for now you could leave out the swap file until you have worked out which /dev/sdX it is on.
Similarly, don't try to automount the other partitions until you get your operating system running.

The entry in /boot/grub/grub.conf would look like:


title Fedora Core (2.6.15-1.2054_FC5)

root (hd0,3)

kernel /boot/vmlinuz-2.6.15-1.2054_FC5 ro root=LABEL=/

initrd /boot/usb-initrd-2.6.15-1.2054_FC5.img


If your BIOS still won't find your external drive before finding the SATA drive and boot from the external drive, I would check again that:
1. The boot options are set to boot from the external usb device before looking for other hard disks;
2. That the external hard disk is set as a master drive not slave or cable select; and
3. That the partition is bootable.
For this last setting you may need to use fdisk. I saw that in one of your earlier posts you had mounted the external drive on a running system and that the external drive was listed there as /dev/sdb
So mount the drive there again and, as root, do
/sbin/fdisk /dev/sdb
Select "a" to change your partition 4 to bootable.
Before exiting choose "w" to write the changes to the partition table of the drive.

Now see again if the the external drive will boot.

Couran.

crisaish
13th October 2006, 09:00 PM
Hello.Couran!
I didn`t resolved the problem. External drive is first boot device and it`s set as a master drive.Changing bootable partition or sda4 with sdb4 didn`t help.I have disconnected the others drives and I reinstalled FC5 directly onto external drive using "linux expert" I followed the steps I did before, but I received the same error while booting. I searched the forums and I saw that others have the same problem.
While booting, FC5 initialised SATA driver before USB storage device and it might be necessary to remove the SATA drive detection at kernel startup.I arrived at this point but I did not continue, because I`m not yery good at Linux and i don`t know how it is done.But i`m still searching for a solution.

couran
14th October 2006, 01:09 AM
Hi,
This may not help your overall problem but did you find out what happens if you disconnect the SATA drive?
Is the usb exteranl drive detected first then? Or still not detected at all?
Sorry to waste your time.

Couran.

crisaish
14th October 2006, 09:20 AM
If I disconnect both internal drives, I receive the same error. While booting FC5 loads drivers for SATA ,even if SATA drive is disconnected.
Couran,you don`t waste my time, I appreciate any suggestion.

couran
15th October 2006, 03:27 PM
Does that mean that you are seeing the grub menu and splash screen on the usb external drive and that the kernel loads from the usb external drive when the other two hard disks are disconnected?

If that is the case, then I would try renaming your root device entry in the grub.conf to:
root (hd1,3)
since perhaps the SATA drive will always be detected first by grub and partitions on the SATA drive is then called (hd0,X)
If that entry starts the kernel loading then you might have to experiment with the kernel line to see if your kernel is located at /dev/sda4, /dev/sdb4 or even /dev/sdc4 depending on how many scsi-emulation storage devices are detected.

Alternatively, if the system insists on finding the bootable SATA drive before it looks for the usb external drive, then it will not be able find the external drive unless grub is installed onto the MBR of the SATA drive.
If you do this then you will need the right entry in that grub bootloader to find your system on the usb external drive.

Perhaps I misunderstand what is happening when the internal ide and SATA drive are "disconnected".

Couran.

crisaish
15th October 2006, 09:22 PM
Maybe I didn`t explained too well. Weather the two internal devices are connected or not, the grub menu appears and the kernel loads, but it ends with the error that I posted about already.
My /etc/dev, /etc/proc and /etc/sys are empty. Does that means anything? Shouldn`t there be any files ?
Thanks again for help.

couran
16th October 2006, 12:33 AM
OK.
Normally there are no such directories as /etc/dev /etc/sys or /etc/proc
They should not exist in a fresh installation.
In your "/" directory you should have /dev, /etc, /sys, /proc, but these are not subdirectories of /etc
I don't understand why the init (system loading) program should be looking for them in /etc
Sorry but I guess I would start again with the whole installation.
For safety I would disconnect the ide and SATA drives and use "linux expert" to reformat the fourth partitiion and reinstall there.
Use manual partitioning and don't use raid or LVM.
Just put everything in "/" with no separate /boot or /etc partitions.
Install the grub bootloader on the MBR of that disk for now.
After this, use linux rescue to do the mkinitrd step in your /boot directory, as in earlier post.
Now see if you can start FC5 before before reconnecting the other drives.
At this stage the root line in /boot/grub/grub.conf should be
root (hd0,3)
and the kernel line should have the root part saying either
root=LABEL=/
or
root=/dev/sda4
If you open the /etc/fstab file it should have the first line matching whatever is in the kernel line of /boot/grub/grub.conf (see earlier posts)
Let me know if you still get errors on booting.

Couran.