LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   removing grub from MBR of a flash drive (https://www.linuxquestions.org/questions/linux-general-1/removing-grub-from-mbr-of-a-flash-drive-772327/)

dasy2k1 11-29-2009 06:42 PM

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?

kilgoretrout 11-29-2009 07:30 PM

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.

linus72 11-29-2009 08:42 PM

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

dasy2k1 11-29-2009 09:19 PM

Quote:

Originally Posted by linus72 (Post 3773825)
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]


All times are GMT -5. The time now is 03:09 PM.