LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 01-10-2007, 02:48 AM   #1
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Rep: Reputation: 15
Boot Linux from external hard drive??


Is it possible?

I installed Slack 11.0 on /dev/sdb2 of an external (USB)
hard drive, configured as master. I made a boot floppy.
Lilo was installed into the root partition superblock.

When I booted from the floppy I got a certain distance
into the boot and then got a kernel panic. Specifically:

.....
Linux IP multicast router 0.06 plus PIM-SM
NET4: Unix domain sockets
NFS: Cannot open root device "sdb2" or 08:12
Please append a current "root=" boot option
Kernel panic: VFS: Unable to mount root fs on 08:12

I tried various boot options and other procedures
using a boot manager (Ranish) but always get kernel panic.
Linux fdisk correctly identifies /dev/sdb and /dev/sdb2
is bootable. I can mount /dev/sdb2 from another Linux OS
and the partition appears to be OK.

Any suggestions as to what to do next?

Thanks.
 
Old 01-10-2007, 03:16 AM   #2
sadiqdm
Member
 
Registered: Nov 2003
Location: London, UK
Distribution: openSUSE, Ubuntu
Posts: 357

Rep: Reputation: 35
Which boot image did you use? this sounds like it doesn't have SB support.
 
Old 01-10-2007, 03:50 AM   #3
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Original Poster
Rep: Reputation: 15
> Which boot image did you use?
> this sounds like it doesn't have SB support.

Good point. I used the default sata.i.
What would be a better choice?
 
Old 01-10-2007, 09:34 AM   #4
gbowden
Member
 
Registered: Dec 2003
Location: Spain
Distribution: Slackware 14.1
Posts: 145

Rep: Reputation: 24
Smile

You will probably need to make a initrd. See this.
 
Old 01-11-2007, 02:14 AM   #5
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Original Poster
Rep: Reputation: 15
Thanks for that pointer, gbowden.
Very informative. I tried to use it as
a basis for booting to the USB partition
using a boot loader (Ranish).

I booted to the Slack11 CD and installed the default
Linux on /dev/sdb2. Then

# mount /dev/sdb2 /mnt
# cd /mnt/boot
# chroot /mnt /usr/sbin/mkinitrd -c -k 2.4.33.3 -m jbd:ext3
-f ext3 -r /dev/sdb2
# cd /mnt/etc
edit lilo.conf to include the lines:
image=/boot/vmlinux
initrd=/boot/initrd.gz
root=/dev/sdb2
label=Linux
Save file then
# chroot /mnt /sbin/lilo

When I select the partition /dev/sdb2 through the boot loader
this happens:

......
/boot/initrd.gz: Loading kernel modules from initrd image
Using /lib/modules/2.4.33.3/jbd.o.gz
insmod: not an ELF file
insmod: could not load the module
mount: Mounting /dev/sdb2 on /mnt failed: No such file or directory
ERROR: mount returned error code 1. Trouble ahead
mount: mounting /dev/sdb2 on /mnt failed: Invalid argument
/boot/initrd.gz: exiting

I guess there is something I am doing wrong, but what?
Is the mkinitrd command correct?

Thanks for your help...
 
Old 01-11-2007, 03:37 AM   #6
Fluxx
Member
 
Registered: Aug 2005
Location: Bavaria, Germany
Distribution: Slackware (Current)
Posts: 225

Rep: Reputation: 30
Here you can find a way like I did it ...

http://www.linuxquestions.org/questi...=usb+initrd.gz

Fluxx.
 
Old 01-11-2007, 05:01 AM   #7
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Original Poster
Rep: Reputation: 15
Thanks Fluxx. I'm gradually getting it all together.

I must be fairly close. I can boot the usb partition through
my boot loader and the usb modules are installed. Then I get:

Attached scsi disk sdb at scsi2, channel0, ide0, lun0
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: sdb1 sdb2
mount: Mounting /dev/sdb2 on /mnt failed: No such file or directory
ERROR: mount returned error code 1. Trouble ahead.
mount: Mounting /dev/sdb2 on /mnt failed: Invalid argument.
/boot/initrd.gz: exiting

What is going on here? Why does the device fail to mount?
 
Old 01-11-2007, 06:06 AM   #8
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Original Poster
Rep: Reputation: 15
GOT IT! The trick was *not* to set the boot device in the
initrd config file rootdev. With /dev/sdb2 removed from
rootdev I was able to boot to the external USB HD through
my boot loader (Ranish).

In summary I used the Slack 11.0 boot disk and Ranish
to install the default kernel (2.4.33.3) in the partition
/dev/sdb2 of the USB drive, and then to boot Linux from this
partition. The procedure was:

(1) Boot to the Slack CD and format the partition. Install
Linux into /dev/sdb2 (use ext2 fs) and put lilo in the superblock.

(2) With the CD still in place make sure /dev/sdb2 is mounted
on /mnt.

(3) Set up the initial ramdisk

# cd /mnt/boot
# chroot /mnt /usr/sbin/mkinitrd -k 2.4.33.3

(4) Copy usb modules to the initrd-tree/lib/modules/2.4.33.3
These are
USB_MODULE_PATH/usbcore.o.gz,
USB_MODULE_PATH/storage/usb-storage.o.gz
USB_MODULE_PATH/host/ehci-hcd.o.gz,
USB_MODULE_PATH/host/uhci.o.gz
where
USB_MODULE_PATH = /mnt/lib/modules/2.4.33.3/kernel/drivers/usb
The files should be gunzipped after transfer.

(5) Insmod the usb modules in /mnt/boot/initrd-tree/load-kernel-modules.
Use the vi editor to insert them in this order:
insmod /lib/modules/$(uname -r)/usbcore.o
insmod /lib/modules/$(uname -r)/ehci-hcd.o
insmod /lib/modules/$(uname -r)/uhci.o
insmod /lib/modules/$(uname -r)/usb-storage.o
Other modules may be inserted as desired (eg if using
ext3 or reiserfs instead of ext2)
Make sure the file is executable
(chmod 755 load-kernel-modules)

(6) Use vi to insert the line "sleep 10" in
/mnt/boot/initrd-tree/linuxrc
after the lines
......
done
unset module
fi
fi
.......
sleep 10
......
Make sure linuxrc is executable (chmod 755 linuxrc)

(7) Make sure /mnt/boot/initrd-tree/rootdev is empty

(8) chroot /mnt /usr/sbin/mkinitrd

(9) Run lilo
# cd /mnt/etc
Edit lilo.conf with vi and insert the lines
image=/boot/vmlinuz
initrd=/boot/initrd.gz
root=/dev/sdb2
label=Linux
# chroot /mnt /sbin/lilo

(10) Reboot

(11) If using Ranish select /dev/sdb2 as a boot item
and boot to the USB partition.
 
Old 01-13-2007, 10:33 PM   #9
BORELLI
LQ Newbie
 
Registered: Jan 2007
Posts: 3

Rep: Reputation: 0
Mandriva?

I Am Working On This Same Project But With Mandriva
The Exact Same Thing Happens When The System Tries To Mount Root
Will I Be Able To Use The Same Technique That Was Just Used Here?
I Wonder If I'll Have A Problem Editing These Files If I Have My Usb Drive Plugged Into My Machine That Is Running Mandriva.
Kernel Is 2.6.17
 
Old 01-19-2007, 05:46 AM   #10
wootletootle
Member
 
Registered: Jul 2002
Location: New Zealand
Distribution: slackware
Posts: 81

Original Poster
Rep: Reputation: 15
I don't know Mandriva, but it is probably worth a try.
You need a bootable CD and then you must install the OS
(in basic form) on the USB drive. You also need some
utilities on the boot CD such as chroot and an editor,
and of course you need mkinitrd either on the CD or
from the installed OS. The correct USB modules must be
available, and insmodded in the correct order. If you
get this wrong then you will have those nasty error messages.

Also you need some sort of boot manager which allows you
to set the bootable partition.

I can't see why you should have any problem editing the
files on the USB partition. If you can mount it then
you can treat it like any other partition.

There's nothing wrong with experimenting, since you will
still have your main Mandriva partition there if things
go wrong. I had to to try quite a few times before I got it
right.....

Cheers,
Wootle.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
External Hard Drive Dual-Boot munst64804 LQ Articles Discussion 1 01-03-2007 07:13 PM
SUSE boot from external hard drive shikhar Suse/Novell 0 09-14-2006 04:12 AM
Daul Boot with external hard drive Haloony Linux - Newbie 7 01-05-2006 11:13 AM
External 2.5" hard drive for linux boot? roboticservo Linux - Hardware 1 10-19-2004 12:00 AM
dual boot using external hard drive? Baggy Linux - General 2 11-15-2003 07:13 AM


All times are GMT -5. The time now is 03:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration