Guest mevatron Posted March 21, 2005 Report Share Posted March 21, 2005 Hi, I'm new to Mandrake, but I have used Gentoo for a while. I am currently trying to boot from an external USB 2.0 Hard drive. I have installed the distribution just fine, but the problems are arrising at boot time (as expected). I have figured out how to modify the linuxrc file contained within the initrd image, but I am still having problems getting the kernel to select /dev/sda to boot from. Here is the linuxrc file after running mkinitrd with the appropriate modules added. #!/bin/nash echo "Loading usbcore.ko module" insmod /lib/usbcore.ko echo "Loading ohci-hcd.ko module" insmod /lib/ohci-hcd.ko echo "Loading scsi_mod.ko module" insmod /lib/scsi_mod.ko echo "Loading uhci-hcd.ko module" insmod /lib/uhci-hcd.ko echo "Loading pcmcia_core.ko module" insmod /lib/pcmcia_core.ko echo "Loading sd_mod.ko module" insmod /lib/sd_mod.ko echo "Loading usb-storage.ko module" insmod /lib/usb-storage.ko sleep 5 echo "Loading reiserfs.ko module" insmod /lib/reiserfs.ko echo Mounting /proc filesystem mount -t proc /proc /proc echo Mounting sysfs mount -t sysfs none /sys echo Creating device files mountdev size=1M,mode=0755 echo starting udev udevstart echo -n /sbin/hotplug > /proc/sys/kernel/hotplug echo Creating root device mkrootdev /dev/root echo Mounting root filesystem with flags notail,noatime mount -o notail,noatime --ro -t reiserfs /dev/root /sysroot echo 0x0100 > /proc/sys/kernel/real-root-dev pivot_root /sysroot /sysroot/initrd umount /initrd/sys umount /initrd/proc echo Initrd finished I'm pretty positive this will not work because I'm not rescanning the scsi bus to pick up the new disk. Does anyone here have any suggestions on how to rescan the scsi bus using the new udev. I'm used to devfs which is what the IBM article about the Firewire drive uses to rescan the scsi bus. Also, I have been using a floppy with GRUB on it to boot the kernel and initrd images because whenever I type in the /boot/grub/menu.lst file nothing changes at boot up. Does anyone know how to make Mandrake update the grub screen after updating menu.lst? Thanks for your time. -Will Quote Link to comment Share on other sites More sharing options...
Guest mevatron Posted March 21, 2005 Report Share Posted March 21, 2005 YES!!!! I figured it out guys WOOOOHOOO! Wow now that was some uber hard work there. Let me know if you guys want to know how I'll post how to do it tomorrow I'm pretty beat now, and I'm gonna update this USB install :). -Will Quote Link to comment Share on other sites More sharing options...
Guest mevatron Posted March 21, 2005 Report Share Posted March 21, 2005 (edited) Okay, I'm going to give the steps I took to boot from and external USB 2.0 Maxtor hard drive. Problem Outline: My main problem was that my Dell Inspiron 8200 did not support booting from USB drives in the BIOS. Also, I had only USB ver 1.1 built-in to my laptop so I also needed to worry about using an Adaptec USB 2.0 PCMCIA card. Also I'm assuming you have Mandrake 10.X already installed on the /dev/hda right now. I haven't made a bootable CDROM yet almost there though. Steps Step 1: Installation As you probably know if you've read some other posts on this topic, DiskDrake does not handle partitioning external drivers very well (err not at all might be more precise :)). So, you're going to need something like KNOPPIX or in my case I just used an old Gentoo LiveCD I had laying around. Take a LiveCD of your choice (needs to have fdisk on it) and manually partition your hard drive. Gentoo has a nice step by step manual on how to do this if you are new to this sort of thing. It can be found here. Once you have partitioned your USB HDD, keep following the gentoo manual on creating the filesystems. The critical one for me was creating the swap space because that's what my DiskDrake kept failing on. After you are finished partitioning and formatting, reboot with the Mandrake Installation CD 1. This time when you get to the partitioning screen just say "Use existing partitions" and the install should proceed as normal. After the USB install, reboot to your Mandrake Install that resides on your internal hard drive. Step 2: Creating your own initrd (the HARD part) In this phase I spewed many explitives and smashed the keyboard several times, so if you get stuck don't feel bad :). Step 2A: Unpacking the initrd In order to get the USB drive to boot you have to load all the usb modules and all the pcmcia modules before the kernel mounts the real root device because you want your USB disk to be the real root device! Make sure to login as root. # cd /boot # cp initrd-2.6.8.1-12mdk /root # cd /root # mv initrd-2.6.8.1-12mdk initrd.mdk.gz # gunzip initrd.mdk.gz # mkdir /mnt/images # mount initrd.mdk -o loop /mnt/images Okay now you should have the default initrd file mounted under /mnt/images. Now, you need to make your own initrd so that you can copy an extra binary and some more kernel modules into it. Step 2B: Make your own initrd I'm just going to copy the steps given in The Loopback Root Filesystem HOWTO by Andrew Bishop. mkdir /root/initrd dd if=/dev/zero of=initrd.img bs=1k count=4096 mke2fs -i 1024 -b 1024 -m 5 -F -v initrd.img mount initrd.img /root/initrd -t ext2 -o loop cd initrd [create the files] <-- don't worry about this step and the below steps yet. cd .. umount /root/initrd gzip -c -9 initrd.img > initrdgz.img In the tutorial, Andrew used count=1024 which will only give you 1MB of ramdisk, so I moved it up to 4096, which will give you 4MB of ramdisk to house the libraries, binaries, and the modules we'll need later. Make sure you are in the newly created custom initrd folder. It should have like just a lost+found folder in it. Now let's copy everything from the default initrd over to our new one. # cp -R /mnt/images/ . Now, you should have everything from the default initrd in your new initrd. Forgive me if the above copies the images folder into your new initrd as well. If it does just do the following # cd images # mv * ../ # cd .. # rmdir images If the images directory is not in your new initrd folder then my copy worked yay, and never mind the above step. Step 2C: Setting up the new initrd disk You will need to collect all the nescessary modules for the USB disk onto the initial ramdisk. # cd /lib/modules/KERNEL_VERSION_HERE/kernel/drivers // first we'll get all the usb modules we need # cd usb # cd host # cp echi-hcd.ko.gz ohci-hcd.ko.gz uhci-hcd.ko.gz /root/initrd/lib # cd .. # cd core # cp usbcore.ko.gz /root/initrd/lib # cd .. # cd storage # cp usb-storage.ko.gz /root/initrd/lib // now let's go get the pcmcia modules [optional use only if you need this] # cd ../.. # cd pcmcia # cp pcmcia_core.ko.gz /root/initrd/lib // NOTE: you may not need the yenta_socket module if you card uses the i82365 //driver so just use which ever one is generally listed when you type /sbin/lsmod # cp yenta_socket.ko.gz /root/initrd/lib // let's get the scsi modules we need # cd .. # cd scsi # cp sd_mod.ko.gz /root/initrd/lib # cp scsi_mod.ko.gz /root/initrd/lib Whew! That was a lot of typing :). Okay, now go back to /root/initrd/lib # cd /root/initrd/lib # gunzip *.gz Now all the modules are in place now let's update that linuxrc file! Step 2D: Modifying the linuxrc file # cd /root/initrd # vi linuxrc // now copy and paste the following into linuxrc #!/bin/nash echo "Loading pcmcia_core.ko module" insmod /lib/pcmcia_core.ko echo "Loading yenta_socket.ko module" insmod /lib/yenta_socket.ko echo "Loading usbcore.ko module" insmod /lib/usbcore.ko echo "Loading ehci-hcd.ko module" insmod /lib/ehci-hcd.ko echo "Loading ohci-hcd.ko module" insmod /lib/ohci-hcd.ko echo "Loading uhci-hcd.ko module" insmod /lib/uhci-hcd.ko echo "Loading scsi_mod.ko module" insmod /lib/scsi_mod.ko echo "Loading sd_mod.ko module" insmod /lib/sd_mod.ko echo "Loading usb-storage.ko module" insmod /lib/usb-storage.ko sleep 10 echo "Loading reiserfs.ko module" insmod /lib/reiserfs.ko echo Mounting /proc filesystem mount -t proc /proc /proc echo Mounting sysfs mount -t sysfs none /sys echo Creating device files mountdev size=1M,mode=0755 echo starting udev udevstart echo -n /sbin/hotplug > /proc/sys/kernel/hotplug echo Creating root device mkrootdev /dev/root /bin/sfdisk -R /dev/sda sleep 5 echo Mounting root filesystem with flags notail,noatime mount -o notail,noatime --ro -t reiserfs /dev/root /sysroot echo 0x0100 > /proc/sys/kernel/real-root-dev pivot_root /sysroot /sysroot/initrd umount /initrd/sys umount /initrd/proc echo Initrd finished Okay, now you have a cool linuxrc, but it won't work without that nice little sfdisk binary on the initial ramdisk, so let's fix that now. Step 2E: Move sfdisk binary over to initrd # cd /root/initrd/bin # cp /sbin/sfdisk . # ldd sfdisk linux-gate.so.1 => (0x...) libc.so.6 => /lib/tls/libc.so.6 (0x...) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x...) # cp -L /lib/libc.so.6 /root/initrd/lib # cp -L /lib/ld-linux.so.2 /root/initrd/lib # cd /root/initrd/lib # mkdir tls # cd tls # ln -s ../libc.so.6 libc.so.6 Before we're through I had to make one more mod to the initrd file (NOTE: my drive booted without this step, but when i left it out one of my ethernet cards would initialize properly so you can try it without it and see if yours works). # cd /root/initrd/etc/udev/rules.d # vi 00-me.rules // paste this line in the file and save it BUS="usb", KERNEL="sd*", SYSFS{serial}="Your devices serial number goes here", NAME="%k", SYMLINK="usbhd%n" To get my devices usb serial number i just followed this guys cool udev guide here Okay now let's pack this bad boy up and put it onto the /boot partition of the current mandrake partition. # cd /root # umount /root/initrd # gzip initrd.img # cp initrd.img.gz /boot Step 3: Booting the darn thing FINALLY! Now you need a GRUB floppy or LILO ( if you must :)) Here's the GRUB instructions for that GRUB Floppy Install Boot to the floppy grub> kernel (hd0,0)/vmlinuz root=/dev/sda3 resume=/dev/sda2 // status info is printed grub> initrd (hd0,0)/initrd.img.gz // more status blah blah grub> boot and voila your external hard drive should begin purring to life!! If not just post back here and I can try to help you through it. -Will Edited March 21, 2005 by mevatron Quote Link to comment Share on other sites More sharing options...
Guest mevatron Posted March 21, 2005 Report Share Posted March 21, 2005 Hey again, I got the bootable CD working by following pmpatrick's instructions, but I'm wondering is there a way to make the boot up go faster? Can I use a different filesystem other than msdos in the iso? Because right now it takes forever to load the kernel and initrd image into memory. But, I have to say that it does work! Now I can boot my external hard drive without using the internal hard drive anymore! -Will Quote Link to comment Share on other sites More sharing options...
Guest lugnut Posted May 10, 2005 Report Share Posted May 10, 2005 I'm trying this using Mandrake 9.1 Some of the files must be different . I was down to here: # cd usb # cd host # cp echi-hcd.ko.gz ohci-hcd.ko.gz uhci-hcd.ko.gz /root/initrd/lib where host isnt found. then I searched for echi-hcd.ko.gz and echi-hcd.ko and couldnt find either way. Im wondering if you tried this on 9.1 or have any clues. Thnanks for any help. Quote Link to comment Share on other sites More sharing options...
watkinb Posted May 10, 2005 Report Share Posted May 10, 2005 (edited) I tried this method using Mandriva 2005LE and couldn't get it to work. Has anybody had any success in doing this with other versions? I'm kind of in a jam and need to get mine up and running really soon. I've been able to create a bootable usb hard drive with Fedora 2 Linux, but not with Mandriva. I ran into some problems with Fedora2 that Mandriva doesn't seem to exhibit upon installation. Mandriva.com offers "GlobeTrotter" which uses a LaCie 40GB HDD with Mandrake 10.0 installed. I have a LaCie 80GB HDD and Mandriva 2005LE and am trying essentially to do the same thing. I'm also currently downloading Mandrake 10.1 and am going to attempt the above method again hoping it will work. Edited May 10, 2005 by watkinb Quote Link to comment Share on other sites More sharing options...
watkinb Posted May 11, 2005 Report Share Posted May 11, 2005 Well, just an update on my own situation. I installed Mandrake 10.1 and it booted off of a USB drive without modification. I couldn't get 2005LE to work this way, but I may have tried to create a new initrd file without first trying it bone stock. Quote Link to comment Share on other sites More sharing options...
adamw Posted May 11, 2005 Report Share Posted May 11, 2005 Warly has his own version of how to boot MDV off a USB key up here: http://ylraw.free.fr/files/mkusb/ Quote Link to comment Share on other sites More sharing options...
crazyspongebob Posted September 9, 2005 Report Share Posted September 9, 2005 Well, just an update on my own situation. I installed Mandrake 10.1 and it booted off of a USB drive without modification. I couldn't get 2005LE to work this way, but I may have tried to create a new initrd file without first trying it bone stock. <{POST_SNAPBACK}> I think the problem of LE2005 is the kernel. The default kernel for installation does not recognize the usb drive if you just hit ENTER at the boot prompt. After hitting F2, you enter alt2 (kernel version 2.6.8.1-12) as the boot option as the installation kernel, LE2005 recognizes the usb drive and installs without any problem. However, LE 2005 installs the default kernel (version 2.6.11) which does not recognize the usb drive. For me I don't know how to get kernel 2.6.8.1 to be the default booting kernel for my usb drive installation of LE2005. It's a bit strange that even though I choose the alternative kernel to install but LE 2005 installation still uses the other kernel as the installation kernel. I think 101. using 2.6.8.1 kernel is the reason why 10.1 works but not LE2005. J.T. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.