LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-27-2013, 07:15 AM   #1
blnl
Member
 
Registered: Nov 2009
Location: The Netherlands
Distribution: Fedora
Posts: 93

Rep: Reputation: 1
Question Create MBR on a USB stick for booting F18 on /dev/sda3


Background:
It is a dual boot machine with F18 installed on /dev/sda3. In order to boot F18, I have created (during F18 installation) an MBR on a USB stick. So now when I insert the USB stick, my laptop boots F18 system (otherwise it boots Win7). MBR on HDD boots only Win7 and I do not want to touch or modify it. I have a good reason for that, which I do not want to discuss here.

Problem description:
Yesterday I lost my USB stick. Without USB stick I can't boot F18...

Question:
How can I (re)create MBR on another USB stick (without having to reinstall F18) that will point to /dev/sda3 as the boot partition?
 
Old 06-27-2013, 03:10 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
If you really do mean MBR then I'd think a few things. One would be that it is the 512Kb data (or more) on the first part of the disk. It has a few parts. One part being the partition table data.

I'd use some tool maybe a live cd like partition magic or such to get the current data off your hard drive before you start. I know Norton had some partition info tools that I used to use. Maybe Ranish can be used from ultimate boot cd or rescue cd.

To put a generic one might use a command like

ms-sys --partition /dev/sdax (be sure x is your usb drive boot order double check)


Some live cd's would also offer a way to boot to the hard drive and you could use it. Some live cd's might be installed briefly to the usb to use it's loader and mbr.

Pretty sure you could use syslinux or even windows to put a loader on the usb that might allow you to load linux.

Usually I'd think grub install would do this but I am not that good at grub/2

Grub4dos or Grub4nt would or should also work. Maybe even plop loader or other loader or multiboot loaders.

I assume you may have to put grub or some loader some place or chained off to some place if it isn't already on the hard drive or new usb.

I'm sure others would have some ideas.

Last edited by jefro; 06-27-2013 at 03:12 PM.
 
Old 06-27-2013, 07:49 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Simply boot any liveCD/USB and chroot into the installed F18 system. "grub-install /dev/sdb" should do the job - providing you hit the correct USB drive node. The cfg should be o.k. as-is seeing as you want to run the hard disk system once booted, but in need you can run grub2-mkconfig - Fedora doco here.

N.B. - Fedora is a bit different to (for example) Ubuntu in its grub2 setup. Be careful using docs off the web that are (even unknowingly) heavily Debian-centric.
 
Old 06-27-2013, 09:10 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
This may also be worth a look at.

http://www.supergrubdisk.org/
 
Old 06-28-2013, 03:13 AM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
--- edited ---

Last edited by John VV; 06-28-2013 at 03:14 AM.
 
Old 06-28-2013, 04:54 AM   #6
blnl
Member
 
Registered: Nov 2009
Location: The Netherlands
Distribution: Fedora
Posts: 93

Original Poster
Rep: Reputation: 1
Talking

It took me some trial and error, but eventually I successfully recreated MBR on the USB stick.

The exact procedure is:
1) Use gparted to create NTFS partition on the USB stick (and make it bootable)
2) Start F18 Live DVD
3)
Code:
mkdir /mnt/f18sys
mount /dev/sda3 /mnt/f18sys
grub2-install --root-directory=/mnt/f18sys /dev/sdb
 
Old 06-28-2013, 03:52 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Thanks for the update.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I ruined my Window's MBR by trying to install Ubuntu on a USB stick baldurpet Linux - General 13 07-02-2009 04:53 AM
after kernel upgrade slackware boots only if I pass root=/dev/sda3 when booting zux Slackware 5 12-05-2008 09:50 AM
lilo /dev/sda3 not a valid boot dev puntjuh Linux - Software 1 02-15-2007 05:29 PM
Erasing MBR from USB stick spiffytech Linux - Software 9 01-10-2006 05:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:29 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration