Operating System - Linux
1819928 Members
3267 Online
109607 Solutions
New Discussion юеВ

howto remove GRUB from the partition using fdisk ?

 
SOLVED
Go to solution
'chris'
Super Advisor

howto remove GRUB from the partition using fdisk ?

hi

howto remove GRUB from the unix partition, without damage the partition (partition table) using linux fdisk ?

kind regards
chris
17 REPLIES 17
xyko_1
Esteemed Contributor

Re: howto remove GRUB from the partition using fdisk ?

Hi Chris,

What you want to do ? If you remove grub from mbr you will not be able to boot your computer unless you have a bootdisk or using rescue mode from de installation CD.

waiting for more information.
xyko
'chris'
Super Advisor

Re: howto remove GRUB from the partition using fdisk ?

sorry, the GRUB was installed on the wrong unix partition and I don't need GRUB in my case.

I use only NT-Bootloader from WIN2000 installed on the primary hard disk.

to boot linux and unix with NT-Bootloader I use bootpart:
http://www.winimage.com/bootpart.htm

this combination works very well !

my problem is to remove GRUB from the linux partition /dev/hdb5
and I'm not worried about booting.

Andrey Dmitriev
New Member

Re: howto remove GRUB from the partition using fdisk ?

If you use windows start "fdisk /mbr"
Huc_1
Honored Contributor

Re: howto remove GRUB from the partition using fdisk ?

Beware I am not sure I understant this correctly ! , but if you dont need Grub and are sure you do not use it or want it then you could backup the file from /boot/grub to some where safe (to be delete when your sure this will not be needed ... better safe then sorry)

If you want to get uninstall grub from system
fist do a
#rpm -ql grub
just to see what is installed where

#rpm -e grub
!!! will erase it

This should do it , the quetion is do you realy need to do this grub does not use very many blocks... and if its not in the way why bother or have not understood this ?

Jean-Pierre
Smile I will feel the difference
Andrew Cowan
Honored Contributor

Re: howto remove GRUB from the partition using fdisk ?

Chris,

Is "hd5" also your root partition or do you have a separate "/boot"? If this is the case and you use a tool such as Partition Magic to delete the disk partition and reclaim the space, your partition numbering in "/etc/fstab" will then be wrong and the system will fail to boot. In this case you can:

(AFTER DELETING) boot into single-user using the installation CD-ROM and edit "/etc/fstab"

or

(BEFORE DELETING) edit "/etc/fstab" and move all your slices down one. E.g. "/ = /dev/hda6" becomes "/ = /dev/hda5".

This operation would be largely a waste of time unless you need to reclaim a partition to use elsewhere, as "/boot" is generally very small.
David Timms
Frequent Advisor

Re: howto remove GRUB from the partition using fdisk ?

If it's still unclear from previous responses,
can you post: [mod hd? to appropriate disk)
/sbin/fdisk -l /dev/hda

if grub is installed in the MBR, then
you need to replace the mbr with a suitable
alternate one: eg from XP: fdisk /mbr
[I don't know if this can be done from linux - although maybe its possible to use dd to write a suitable 512 bytes ???]

if grub is installed on a partition, then ...
i'm not sure!

dave.
Andrew Cowan
Honored Contributor

Re: howto remove GRUB from the partition using fdisk ?

Maybe I'm reading this wrong but Chris said:

"howto remove GRUB from the unix partition, without damage the partition (partition table) using linux fdisk ?"

He never mentioned the MBR so I assume he means remove a disk slice because he has grub installed in the root partition?

Chris can you please clarify this?
'chris'
Super Advisor

Re: howto remove GRUB from the partition using fdisk ?

I don't mean MBR and don't want any changes on MBR,
my problem is to remove GRUB from the unix slice.

greetings
chris
Andrew Cowan
Honored Contributor

Re: howto remove GRUB from the partition using fdisk ?

When you boot Linux does it basically appear to boot twice because it uses your utility then starts Grub, and so you get two boot menus, and thus its just an inconvenience, or is Grub causing the boot to fail?

Is it possible that you can talk us through your boot procedure/experience?

When you mention fdisk it makes me think that you have a specific slice that you want to remove?
ayion
New Member
Solution

Re: howto remove GRUB from the partition using fdisk ?

hi chris

open your linux pc in CLI mode and type

dd if=/dev/zero of=/dev/hda bs=400 count=1

then reboot your pc

ayion
ayion
New Member

Re: howto remove GRUB from the partition using fdisk ?

hi chris

open your linux pc in CLI mode and type

dd if=/dev/zero of=/dev/hda bs=400 count=1

then reboot your pc

i hope u got ur dentination.

ayion
'chris'
Super Advisor

Re: howto remove GRUB from the partition using fdisk ?

thanks !

dd if=/dev/zero of=/dev/hda bs=400 count=1

that's good idea !

I think, fdisk is not a good tool to do that, what I want.
fdisk cannot selectively delete only parts of a partition !

in this partition I have important data.
anyway I saved everything using freesbie.

maybe other solution is to use /dev/random, but I have never used before.
Knows someone, how it should work using /dev/random ?
Andrew Cowan
Honored Contributor

Re: howto remove GRUB from the partition using fdisk ?

If all you want to do is blank the partition without removing it simply run "newfs" on it.
'chris'
Super Advisor

Re: howto remove GRUB from the partition using fdisk ?

sorry, I think correct is:

dd if=/dev/zero of=/dev/hda bs=446 count=1


this will not overwrite the partition table !
the partition table is kept in the last 66 bytes of the MBR.

greetings
chris
Bojan Nemec
Honored Contributor

Re: howto remove GRUB from the partition using fdisk ?

chris,

Maybe a:

dd if=/dev/hda of=backupmbr bs=446 count=1

will be good before

dd if=/dev/zero of=/dev/hda bs=446 count=1

So if something goes wrong, you can boot from a rescue disc and do:

dd if=backupmbr of=/dev/hda bs=446 count=1

to restore the parition table.(replace backupmbr with yours favorite file name)

Bojan
'chris'
Super Advisor

Re: howto remove GRUB from the partition using fdisk ?

thanks,

but I don't have any MBR BACKUPS !
Charles Lacour_1
New Member

Re: howto remove GRUB from the partition using fdisk ?

Chris,

I sincerely hope you didn't follow any of the advice given so far, especially the stuff about overwriting the first xxx bytes of /dev/hda!

Folks, he said, several times, that grub is installed on a PARTITION. It is NOT installed on the Master boot record. In fact, it's not even on drive hda at all.

The difference is if you went into grub and said
setup (hd0) # Installs to /dev/hda, like everyone has been assuming

and

setup (hd1,4) # Installs to /dev/hdb5, which is what Chris said.

Chris, I found this thread in the first place because I'm looking for the same info.

If you use dd on anything the output file (of = parameter) will be /dev/hdb5, not /dev/hda.

What I DON'T know right now is whether copying 400, 446 or 512 bytes of zeros will mess up your partition.

Copying 512 bytes will be the entire first sector of the partition, and will definitely get rid of grub on it. It may also screw up your partition badly. You haven't said what you have on it, how hard it would be to recover, etc.

What effects are you seeing from this?

In my own case, I deliberately installed it on hda7, because I already had a different grub installed on hda. Long story short, it now wants to double boot, once from hda, then from hda7.

I have stuff I want to keep on hda7, so I'm a little leery of trying anything drastic.

If I find an answer or try something drastic and it works, I'll post a followup.

Hope this helps,

Charles Lacour