Jump to content

Booting from a USB drive


bcondemi

Recommended Posts

I using SimplyMepis 3.3 right now but want to install it on an external USB drive (portability). My motherboard supports every boot option that's out there including booting from a USB drive and it works just fine.I undertsand however that Grub needs USB support first in order to mount the drive initially if I want to go with booting from a USB Drive. I just don't know how to do that.Is there some simple solution to be able to achieve this? I know other distro's are able to boot from a USB drive but am unsure how to do it with SimplyMepis?Anyone know where I could continue to look?thank-youBC

Link to comment
Share on other sites

  • Replies 121
  • Created
  • Last Reply

Top Posters In This Topic

  • bcondemi

    58

  • Bruno

    57

  • teacher

    6

  • ian

    1

Top Posters In This Topic

BCWelcome to the forum. I don't personally use Grub but I am sure someone will be along shortly that can help you.

Link to comment
Share on other sites

Hi BCIs it not possible to install Grub on the fixed HD and move the vmlinuz and initrd to a directory on the fixed HD ?? Have you got any other distros installed on the fixed HD ?? And could we maybe use that Lilo or Grub ( I prefer Lilo ) to multiboot that distro but also Mepis ??:thumbsup: Bruno

Link to comment
Share on other sites

Found this via google "linux boot usb drive".Looks possible but complicated. Certainly beyond what I feel comfortable about playing with........This article talks about an IBM experiment of booting Linux from an iPod to rescue Windows systems.

Link to comment
Share on other sites

I don't have any other distros installed on the HD. I have windows on it and would rather not touch it. (don't fix it if it aint broke). I just downloaded lilo and will install it (Itstead of Grub). I understand it has more options.I'm not a fast editor and rather new to linux (3 months) and have some command line experience but am able to navigate my way around.(slowly).What I did was, installed an ide drive as a master and installed SimplyMepis(Pretty easy for a beginner) and it came with grub so i installed it in the MBR. Works fine after reboot.I then removed the drive and put it in a USB enclosure. Re-connected my origional drive(windows) and booted the USB. started up ok but then had a 'kernal error' then died.Obviously USB support needs to be loaded first before grub will mount the drive (I hope the terminlogy is right)The link provided 'booting linux from a usb drive' is rather difficult. I have to make modifications to Grub or Lilo (I assume) with my 'live cd' but not sure where to start yet.I guess I'll start with lilo. unless anyone thinks otherwisethanksBruno (another one) :lol:

Link to comment
Share on other sites

Did you install lilo already? Or do you need some help to walk through that?Once you have lilo installed, we will check your boot sequence to see if it works correctly.

Link to comment
Share on other sites

To see what your grub looks like you will need to try something like this:

# cat /boot/mepis33/grub/menu.lst

Then post that output here and we will go from there.

Link to comment
Share on other sites

I very much appreciate this and I thank-you.The kernal I'm using is 2.6.10.I've downloded lilo 22.6.1 and extracted the zip file. Not sure how to install it yet.My file:/mnt/sdc1/boot/grub/menu.1st is......timeout 15color cyan/blue white/blueforeground ffffffbackground 0639a1gfxmenu /boot/grub/messagetitle MEPIS at hda1, kernel 2.6.10kernel (hd0,0)/boot/vmlinuz-2.6.10 root=/dev/hda1 nomce psmouse.proto=imps quiet splash=verbose vga=791 initrd (hd0,0)/boot/initrd.splash title MEPIS at hda1, kernel 2.4.29kernel (hd0,0)/boot/vmlinuz-2.4.29 root=/dev/hda1 nomce quiet splash=verbose vga=791 hdc=ide-scsi hdd=ide-scsi initrd (hd0,0)/boot/initrd.splash title MEMTESTkernel /boot/memtest86.binThe drive its on is actually /dev/sdc1 not /dev/hda1Keep in mind that I'm using the 'live cd'(The OS is running from the cd right now) and that I did not boot the usb drive that I have my SM linux OS on (obviously). I'm reading and have access to all its files however.thank-youBruno

Edited by bcondemi
Link to comment
Share on other sites

Hi BrunoHere is your problem:When you installed Mepis that HD was called "hda" by linux and the partition "hda1" . . now that you changed drives Windows is "hda" and the drive in the USB dock is "sdc" with Mepis on "sdc1".Now, your Grub that you are trying to boot ( and the fstab ) are still telling the computer to boot hda1 ( Windows ) with the kernel from Mepis . . . can you follow so far ? This won't go !Now there are 2 ways to fix this:1). You put the Mepis HD back as master just for the time that it takes to edit 2 files.2). You reinstall Mepis with the Mepis drive on the USB and the Win drive as Master ( exactly how the setup is now ) . . BUT when it comes to installing Grub you have to be extra careful: the default action is to write it to the MBR on hda ( overwriting the Windows boot ) you have to tell it to install on sdc ( NOT sdc1 but sdc !!! ) . . . . . I hope you have a Windows-install-CD for the case that you make a mistake and it goes wrong.Now, if you choose option "1)." tell me and I will post exact instructions for you how and what to do.If however you choose option "2)." be really really carefoul at the Grub part because getting grub written to the correct location is of huge importance if you later want to choose from the BIOS what drive you want to boot first: IDE-0 or the USB-HD ;)B) Bruno* LOL . . . . 2 Bruno's that will be nice to confuse the folks here . . :rolleyes: :D

Link to comment
Share on other sites

I follow you quite well. I figured I had the hda, hda1, sda, sdc etc... somehow messed up. I'm used to C, D, E and so on..Anyway... I'll re-install Linux on the USB drive and leave the WIndows drive as master (just as I have now) Option (2). Just a note: My windows drive is a serial drive so it will probably be named sda not hda (which I even get confused) with sdc. And yes I'll be carefull when chosing where to install grub. I guess when I done, I'll repost my grub and fstab?thanks againBruno(2) :D

Edited by bcondemi
Link to comment
Share on other sites

title MEPIS at hda1, kernel 2.6.10kernel (hd0,0)/boot/vmlinuz-2.6.10 root=/dev/hda1 nomce psmouse.proto=imps quiet splash=verbose vga=791 initrd (hd0,0)/boot/initrd.splash title MEPIS at hda1, kernel 2.4.29kernel (hd0,0)/boot/vmlinuz-2.4.29 root=/dev/hda1 nomce quiet splash=verbose vga=791 hdc=ide-scsi hdd=ide-scsi initrd (hd0,0)/boot/initrd.splash
See ? your Grub is thinking it is hda1 . . . . . . and sure you can edit it using your Live version but you can not write it to the MBR of the USB drive using the Live CD . . for that you need to be booted on the USB drive.Also the /etc/fstab file ( look "cat /etc/fstab" ) will show the same hda numbers . . . . .Anyway if you reinstall . . . read my warning again about the MBR of your windows drive ;)B) Bruno
Link to comment
Share on other sites

Ok re-installed Linux Option (2) and didn't forget about the mbr. This time however, the USB drive was not called sdc it was sdb. Therefore I wrote the mbr to sdb not sda(which was the default)here goes...grubbackground 0639a1gfxmenu /boot/grub/messagetitle MEPIS at sdb1, kernel 2.6.10kernel (hd1,0)/boot/vmlinuz-2.6.10 root=/dev/sdb1 nomce psmouse.proto=imps quiet splash=verbose vga=791 initrd (hd1,0)/boot/initrd.splash title MEPIS at sdb1, kernel 2.4.29kernel (hd1,0)/boot/vmlinuz-2.4.29 root=/dev/sdb1 nomce quiet splash=verbose vga=791 hdc=ide-scsi hdd=ide-scsi initrd (hd1,0)/boot/initrd.splash title Windows at sda1rootnoverify (hd0,0)chainloader +1title MEMTESTkernel /boot/memtest86.bin...and file system table...# Static entries below, do not use 'users' option in this area/dev/sdb1 / ext3 defaults,noatime 1 1/dev/sdb2 swap swap sw,pri=1 0 0none /proc proc defaults 0 0none /proc/bus/usb usbfs devmode=0666 0 0none /dev/pts devpts mode=0622 0 0none /sys sysfs defaults 0 0/dev/sdb3 /home ext3 defaults,noatime 1 2Ok hope this is enough info.I'm very hopeful now!thank-youBruno(2) B)

Link to comment
Share on other sites

Well that grub and fstab are looking good . . . so, crossing fingers, booting from the USB-HD ( setting in BIOS ) should give no more errors.The only thing is that every time you want to boot another OS you have to change the BIOS . . . but for now that will be okay . . you can always later, when you are sure about using linux, you can switch to using the MBR of sda for multibooting by replacing the windows MBR by a Grub adapted to boot Linux & Windows.So reboot . . . and see if it works ! . . . Note: I am offline for the next 3 hours, getting my daughters over for dinner . . . but after that I will be logged in on the forum for at least 4 hrs non stop. ;)B) Bruno

Link to comment
Share on other sites

The re-boot didn't work. I booted the USB-HD drive, The boot screen came up and I chose kernal 2.6.10 (as usual) but it did not boot I got a grub editior. and went to a neverending loop.I re-installed a second time, this time I disconnected the drive off the motherboard (windows drive) and All I had was the USB drive connected. Now all I had is the sda (tried to elliminate too many drive designations)I re-booted, got grub to start booting, the splash screen came up (thought it would happen) and then got a error..'kernal panic - not syncing: VFS : unable to mount fs on unknown-block(0,0)'At least I got closer this time! Anyway, as I understand it maybe...Grub can't handle USB drives. That is why I was exploring the lilo bootloader...Here's my grub again...timeout 15color cyan/blue white/blueforeground ffffffbackground 0639a1gfxmenu /boot/grub/messagetitle MEPIS at sda1, kernel 2.6.10kernel (hd0,0)/boot/vmlinuz-2.6.10 root=/dev/sda1 nomce psmouse.proto=imps quiet splash=verbose vga=791 initrd (hd0,0)/boot/initrd.splash title MEPIS at sda1, kernel 2.4.29kernel (hd0,0)/boot/vmlinuz-2.4.29 root=/dev/sda1 nomce quiet splash=verbose vga=791 hdc=ide-scsi hdd=ide-scsi initrd (hd0,0)/boot/initrd.splash title MEMTESTkernel /boot/memtest86.binand fstab....# Static entries below, do not use 'users' option in this area/dev/sda1 / ext3 defaults,noatime 1 1/dev/sda2 swap swap sw,pri=1 0 0none /proc proc defaults 0 0none /proc/bus/usb usbfs devmode=0666 0 0none /dev/pts devpts mode=0622 0 0none /sys sysfs defaults 0 0/dev/sda3 /home ext3 defaults,noatime 1 2Bruno

Edited by bcondemi
Link to comment
Share on other sites

I think you definitely need to switch to Lilo . . . because that Grub is just a little bit odd ( sorry I did not see this last time . . . must have been distracted by my visitors B) )Look here:

title MEPIS at sda1, kernel 2.6.10kernel (hd0,0)/boot/vmlinuz-2.6.10 root=/dev/sda1
See . . . on the fiorst line it says correctly sda1 . . but then on the second line it says that the kernel can be found on hd0,0 ( hd0,0 is grub-talk for hda1 ), which is plain wrong has to be sd0,0 . . . and root is on sda1 ( which is correct )Your fstab is looking okay . . . . to change Grub is not the real problem but writing it to the MBR of the USB drive is if you are not booted in Mepis on the USB drive.Another remark: Next time you get a Grub prompt you can try this:http://forums.scotsnewsletter.com/index.ph...14&t=503&st=229 the "Emergency" section.If you manage to boot it that way . . . we can have a go at Grub and write the edited grub to the MBR of sda.B) Bruno
Link to comment
Share on other sites

Gotcha!I'm going to try to edit the (hd0,0) to (sd0,0) (if that works)...I guess if I had a program to edit the mbr directly, I guess that would work maybe.if I have no other option, I guess I have to use lilo then?let me get back to you...thanks Bruno

Link to comment
Share on other sites

I'm going to try to edit the (hd0,0) to (sd0,0)  (if that works)...

Sure you can edit the Grub file . . . . but that is only the config file . . and not what is in the MBR of the USB drive.And you have no way of writing that new config file to the MBR without being root on the mepis HD install ( to give the command "grub-install /dev/sda" ) . . . See, this will not work from the Live CD :(The only way to do that from the live CD is to "chroot" the mepis partition:http://forums.scotsnewsletter.com/index.ph...14&t=503&st=232But with the new 2.6 kernels there ar so many changes that I would not know the exact commands to chroot in Mepis ( is also different for every distro ). You can give it a try though . . you never know, you might be lucky . . B) Bruno
Link to comment
Share on other sites

Sure you can edit the Grub file . . . . but that is only the config file . . and not what is in the MBR of the USB drive.And you have no way of writing that new config file to the MBR without being root on the mepis HD install ( to give the command "grub-install /dev/sda" )  . . . See, this will not work from the Live CD :(The only way to do that from the live CD is to "chroot" the mepis partition:http://forums.scotsnewsletter.com/index.ph...14&t=503&st=232But with the new 2.6 kernels there ar so many changes that I would not know the exact commands to chroot in Mepis ( is also different for every distro ). You can give it a try though . . you never know, you might be lucky . . :unsure: Bruno

Actually I can be root on the live cd. It gives me every function that the installed version gives me. if not, I'll try the chroot just in case.Just a note, I now have to go for a few hours and will be back later. I'll try the chroot or root and see if I can write to the mbr. if it works, maybe I'll post what I edit first (so that I don't edit the wrong thing!thanks I'll post later on!Bruno
Link to comment
Share on other sites

Sure you can be "root' on the live CD . . . but that is not the same . . . really, the only option is to chroot the mepis partition and then give the command.Will catch you later ;):unsure: Bruno

Link to comment
Share on other sites

Okay . . . . I ran a test and it looks like it could work . . . Here is what you do . . first edit the /boot/Grub/menu.lst file:

timeout 15color cyan/blue white/blueforeground ffffffbackground 0639a1gfxmenu /boot/grub/messagetitle MEPIS at sda1, kernel 2.6.10kernel (sd0,0)/boot/vmlinuz-2.6.10 root=/dev/sda1 nomce psmouse.proto=imps quiet splash=verbose vga=791 initrd (sd0,0)/boot/initrd.splash title MEPIS at sda1, kernel 2.4.29kernel (sd0,0)/boot/vmlinuz-2.4.29 root=/dev/sda1 nomce quiet splash=verbose vga=791 hdc=ide-scsi hdd=ide-scsi initrd (sd0,0)/boot/initrd.splash title MEMTESTkernel /boot/memtest86.bin
( if you need help with the edit . . stop here and let us know )After you saved the file and checked if the corrections are really saved . . open a terminal and do:
demo@ttyp1[demo]$ su< rootpasword >root@ttyp1[demo]# mount /dev/sda1 /mnt/sda1root@ttyp1[demo]# mount -t devpts none /mnt/sda1/dev/ptsroot@ttyp1[demo]# mount -t proc none /mnt/sda1/procroot@ttyp1[demo]# chroot /mnt/sda1

( If the "mount /dev/sda1 /mnt/sda1" gives an error, do "mkdir /mnt/sda1" first and try again )Here you have to be quick because you get an endless output of:

bash: /dev/null: Permission deniedbash: /dev/null: Permission deniedbash: /dev/null: Permission deniedbash: /dev/null: Permission deniedbash: /dev/null: Permission denied
You interrupt this with Ctrl+C !!After that you will see that the prompt has changed to:
bash-3.00#

That means the chroot was successful :DNow you can give the command:

bash-3.00#  grub-install /dev/sda

After that you are not finished yet . . . you have to "log-out as chroot" with Ctrl+D and you will get the "normal prompt" back:

bash-3.00# exitroot@ttyp1[demo]#

Now we have to umount what we mounted before:

root@ttyp1[demo]# umount /mnt/sda1/procroot@ttyp1[demo]# umount /mnt/sda1/dev/ptsroot@ttyp1[demo]# umount /mnt/sda1root@ttyp1[demo]# reboot

And start crossing your fingers . . . ;):unsure: Bruno

Link to comment
Share on other sites

ok here are the first errors I get.root@ttyp1[demo]# mount /dev/sda1 /mnt/sda1root@ttyp1[demo]# mount -t devpts /mnt/sda1/dev/ptsUsage: mount -V : print version mount -h : print this help mount : list mounted filesystems mount -l : idem, including volume labelsSo far the informational part. Next the mounting.The command is `mount [-t fstype] something somewhere'.Details found in /etc/fstab may be omitted. mount -a [-t|-O] ... : mount all stuff from /etc/fstab mount device : mount device at the known place mount directory : mount known device here mount -t type dev dir : ordinary mount commandNote that one does not really mount a device, one mountsa filesystem (of the given type) found on the device.One can also mount an already visible directory tree elsewhere: mount --bind olddir newdiror move a subtree: mount --move olddir newdirA device can be given by name, say /dev/hda1 or /dev/cdrom,or by label, using -L label or by uuid, using -U uuid .Other options: [-nfFrsvw] [-o options] [-p passwdfd].For many more details, say man 8 mount .root@ttyp1[demo]# mount -t proc none /mnt/sda1/procmount: mount point /mnt/sda1/proc does not existroot@ttyp1[demo]#Not sure what happened..root@ttyp1[demo]# mount -t devpts /mnt/sda1/dev/pts (seemed ok but got a whole lot of other text) What do you think?Bruno(2) B)

Link to comment
Share on other sites

Hi B2I tested this on Simply Mepis 3.3 ( HD install and Live CD booted default kernel ) . . . is that the same as you are trying ?What went wrong here is that you forgot an "argument" in your command . . . . you typed:mount -t devpts /mnt/sda1/dev/ptsand I wrote:mount -t devpts none /mnt/sda1/dev/ptsA good thing you did not give the "chroot" command yet because we first want the preceding commands to be successful and not print back error messages. ;):thumbsup: Bruno

Link to comment
Share on other sites

Good evening Bruno!I logged as root to help reduce the amount of time I have to type in my root password.I edited the boot/grub/menu.lst. (no problem)Then this is what I got.....root@1[root]# mount /dev/sda1 /mnt/sda1root@1[root]# mount -t devpts none /mnt/sda1/dev/ptsmount: mount point /mnt/sda1/dev/pts does not existroot@1[root]#I saw in you instructions that... If the "mount /dev/sda1 /mnt/sda1" gives an error, do "mkdir /mnt/sda1" first and try again )I got an error after the next line. I didn't want to do anything just in case.what do you think?Bruno(2)

Edited by bcondemi
Link to comment
Share on other sites

:wacko: Good morning Bruno (2) ;)That is strange, because I specially I installed exactly the same version as you have . . . could you please show me: ( from the live cd )
cat /mnt/sda1/etc/fstab

Maybe the time comes close to try another distro that uses Lilo by default and not Grub . . . I would suggest PCLos . . . :) ( also a Live CD that has an easy HD install )Homepage: http://www.pclinuxonline.com/pclos/ISO: ftp://ftp.nluug.nl/pub/metalab/distributi...inuxos-p81a.isoChecksum: ftp://ftp.nluug.nl/pub/metalab/distributi...inuxos-p81a.asc:D Bruno

Link to comment
Share on other sites

root@1[root]# cat /mnt/sda1/etc/fstabcat: /mnt/sda1/etc/fstab: No such file or directoryroot@1[root]#I hope we can get this to work bacause I've worked with Mepis for the last three months and have backed up everything in my home directory including tweaking that has taken a long time.If it doesn't work, maybe I'll try to re-install everything.Bruno(2)

Link to comment
Share on other sites

I am wondering where you saved those files ? In your /home on the HD ??Anyway try this:

 mount /dev/sda1 /mnt/sda1cat /mnt/sda1/etc/fstab

I hope that gives a bit more info then above :lol: . . . I think though that you better back up the files you want to save to your Windows partition and start downloading PCLos . . . because I fear that with Mepis we keep running into deadend streets . . . . . Grub is the biggest obstacle and as long as you can not boot the HD install you will not be able to install Lilo and start using that one.Another idea would be to set that HD as slave ( not in the USB dock ) so you will not have the limitation that Grub has with USB booting.;) Bruno

Link to comment
Share on other sites

root@1[root]# mount /dev/sda1 /mnt/sda1mount: /dev/sda1 already mounted or /mnt/sda1 busymount: according to mtab, /dev/sda1 is already mounted on /mnt/sda1root@1[root]# cat /mnt/sda1/etc/fstabcat: /mnt/sda1/etc/fstab: No such file or directoryroot@1[root]#I must be saving in the wrong drive or something?what if I remove the hda directory and only have the sda (usb) installed.How can I check that the data is being installed in the correct drive/partition?Bruno(2)

Link to comment
Share on other sites

what if I remove the hda directory and only have the sda (usb) installed.

Not clear what you are saying there . . . . . What I was trying to say is leace the HD1 connected and take the other HD out of the USB dock and connect that one as well . . . but then as "slave" . . . . ;) Bruno
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...