LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 11-29-2009, 06:42 PM   #1
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 956

Rep: Reputation: 34
removing grub from MBR of a flash drive


I have a flash drive that i used on my old netbook to temporally hold a copy of ubuntu as the netbooks internal drive was dead.

i have since got a new netbook and wanted to return the flash drive to simple removable storage

ive re-partitioned it back to 14gb fat32 2gb ext2 and everything is working fine

except that if i try to boot with the key inserted grub loads then errors imminently (sort of obious if grub is still in the MBR but there is no menu.lst file anymore...)

googleing for removal of GRUB just gives me loads of hits for how to restore windows mbrs when you dont want to keep linux anymore...


none of these methods seem to have any targeting.

i need to remove grub from sdb while keeping it intact in sda

sdb shouldn't even be bootable, so that when boot from usb is higher in the bios than boot from hdd the usb key is ingnored and the hdd is booted as normal.

any suggestions?
 
Old 11-29-2009, 07:30 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,300

Rep: Reputation: 138Reputation: 138
If you are absolutely sure that the device file for your usb flash drive is sdb then run as root with any and all partitions on sdb unmounted:

# dd if=/dev/zero of=/dev/sdb bs=512 count=1

If you are running on a *buntu distro which doesn't have a root account run:

$ sudo dd if=/dev/zero of=/dev/sdb bs=512 count=1

Grub resides on the mbr of the flash drive which is the first sector of the drive and is 512 bytes in size. The above command will zero out the mbr of sdb. All data on the flash drive will be lost and you will have to repartition and reformat the flash drive afterwards.
 
Old 11-29-2009, 08:42 PM   #3
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
actually
the above command will zero out the whole usb
you then need to use cfdisk or preferably Gparted to recreate
a partition table and then reformat it

To just delete the MBR
it is
Code:
# dd if=/dev/zero of=/dev/xxx bs=446 count=1 

bs=446 => removes MBR
bs=512 => removes the partition table
please refer here
http://www.linuxquestions.org/questi...78#post3508978
 
Old 11-29-2009, 09:19 PM   #4
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 956

Original Poster
Rep: Reputation: 34
Quote:
Originally Posted by linus72 View Post
actually
the above command will zero out the whole usb
you then need to use cfdisk or preferably Gparted to recreate
a partition table and then reformat it

To just delete the MBR
it is
Code:
# dd if=/dev/zero of=/dev/xxx bs=446 count=1 

bs=446 => removes MBR
bs=512 => removes the partition table
please refer here
http://www.linuxquestions.org/questi...78#post3508978
zeroing out just the mbr (first 446 blocks) left me with just a flashing cursor on boot when the usb was inserted, still fine when its out

both partitions still work fine and neither have the boot flag set

any more ideas?


[edit]
ahh my problem, it seems the bios wont skip any usb device wether its bootable or not
if its not you just get the blinking cursor
[/edit]

Last edited by dasy2k1; 11-29-2009 at 09:21 PM.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Fedora: Need help removing GRUB from the mbr from within Linux k0mdk Fedora 16 01-20-2010 12:20 PM
Removing grub from MBR alek66 Linux - General 5 04-20-2007 10:32 AM
removing GRUB from MBR gomez6211 Linux - Newbie 1 07-25-2005 10:09 AM
problems with formatting second disc after removing grub from mbr aabeeikora Linux - Newbie 2 08-02-2003 02:05 PM
Removing GRUB and restorung MBR TotalNoob Linux - Newbie 1 04-04-2003 09:47 PM


All times are GMT -5. The time now is 05:26 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