Login or Register to Ask a Question and Join Our Community


How to zero a disk (especially MBR)?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to zero a disk (especially MBR)?
# 1  
Old 03-15-2007
How to zero a disk (especially MBR)?

I'm confused. Originally I did

telinit 1
cp /dev/sda /dev/sdb

where sda is my boot disk and sdb is a USB disk. This probably copied my MBR.

Since /dev/sdb is 300GB and /dev/sda only 160GB I had a bunch of space left which I decided to experiment with by creating partitions of various sizes.

Then I did "telinit 1; cp/dev/sda /dev/sdb" again and I could not create additional partitions beyond the orginal 160GB like I had done before. Neither QTParted nor fdisk would let me partitition the 140GB of remaining free space like it had previously.

Now I run VMWare and I tell it I want a new virtual machine and I want it to use /dev/sdb. Well this does not work so well so I run "fdisk /dev/sdb" and delete all the partitions and then I use "dd if=/dev/zero of=/dev/sdb bs=1000 count=200000000" figuring this ought to be more than enough to zero out the MBR. Well dd comes back (very quickly) and says "dd: writing: /dev/sdb: no space left on device ... 65MB copied".

Why does it say that? I asked it to zero out more than 65MB?

Why is this not sufficient to delete GRUB from the entire disk?

I want to zero the entire 300GB disk. How do I do that?

Hmmm... so then I fire up VMWare and assign /dev/sdb to the new virtual machine which promptly gives me a grub prompt but nothing to boot. Arghhh! Why am I getting a grub prompt?

This is a problem because I don't know how to tell it (VMWare) to boot from the CD first instead of the hard disk. I want to install debian on /dev/sdb. Instead VMWare keeps running grub. I figure if I can zero out the entirety of /dev/sdb VMware will try to boot from /dev/sdb and fail and then boot form the CD.

Why do I want to do this? Because I've burned about 6 CDs of various versions of debian etch (net install) and they all register dump on me when I do a physical boot (boot without VMware) from the CD. I cannot boot debian sarge because it does not have support for my marvel network adapter. However, I have discovered that if I boot windows and run VMWare to create virtual disk for debian etch (on /dev/sda), I can boot and install debian etch. Unfortunately, I'm running out of disk space on /dev/sda and I need to use /dev/sdb!

Can someone please tell me now to zero a disk? (Or better yet, tell me how to change the device boot order for VMWare? -- but that is off topic!)

Thanks,
Siegfried
# 2  
Old 03-15-2007
i constantly reload the OS of my unix box, so i create a script like this

#!/bin/sh

MBR=`df -hl | grep -v Filesystem | awk '{print $1'} | head -1 | sed -e 's/[0-9]//'`
echo GRUB is installed in $MBR
dd if=/dev/zero of=$MBR bs=512 count=1

make it executable & run it. It will wipe your master boot record.

#WARNING, think twice before you blow off the mbr.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Hardware

Hard Drives and MBR

Hello everyone. I have a question which I may know the answer to, I'm just looking for a confirmation. When it comes to the MBR of a hard drive, i've read in multiple sources that it's always located in the first sector of the hard drive. Is the MBR there from the factory? When I buy a new blank... (3 Replies)
Discussion started by: Lost in Cyberia
3 Replies

2. Fedora

Disk Paritioning Scheme--GPT or MBR

Hi, I just built myself a new machine which has an ASUS motherboard with is UEFI based. I noticed after I installed Fedora 17 that my sda is MBR and my sdb is GPT: sda is a ssd drive. Should the ssd drive be GPT or is MBR okay? sda is 60Gb drive. (3 Replies)
Discussion started by: mojoman
3 Replies

3. Boot Loaders

GRUB MBR and restoring a partition

I tried to install another Linux O.S along with MS and to make two Linux's and one windows.Usually when I try this GRUB losses the ability to boot the first Linux install. It did it again. I would really like to get this first install bootable again. Here are some facts. -I have a rescue... (0 Replies)
Discussion started by: theKbStockpiler
0 Replies

4. Boot Loaders

Lost MBR on disk

trying to recover a lost partition table, where the signature (0x55AA) has been lost, though attempting to restore using a number of tools (fdisk, testdisk et al) the write fails. also the os is unable to read the disk geometry correctly, after attempting to correct the geometry, the updated... (2 Replies)
Discussion started by: xaphan
2 Replies

5. Boot Loaders

GPT/Protective MBR problem...

Hi, short thing: I've done something I didn't know what happens; bad thing: I did it with my partition table. :D My OS is Ubuntu 10.10. I've used GPT and now want to convert it to MBR with gdisk. I started gdisk, chose 'r' for "transformation options" and chose 'g' to "convert GPT into MBR... (3 Replies)
Discussion started by: Blackbird
3 Replies

6. SCO

Backup MBR an Partition Table

hi How can I backup MBR an Partition Table of SCO 5.0.6? (7 Replies)
Discussion started by: ccc
7 Replies

7. UNIX for Dummies Questions & Answers

What Does Happen During Boot Process? - BIOS and MBR

I'm talking about boot process in multi-boot Linux perceptive. Please tell me whether my explanation is right or wrong? If wrong, please explain. "The BIOS checks the system and loads this initial bootstrapping code into memory. This initial bootstrap code searches for an active partition... (0 Replies)
Discussion started by: f.ben.isaac
0 Replies

8. UNIX for Dummies Questions & Answers

About MBR,Boot Loader programe.

Hi all, I am newbie here.I want to know what is MBR,boot loader & boot strap programe. What is procedure of loading OS in to memory. Thanx in advance:) (1 Reply)
Discussion started by: vishwasrao
1 Replies

9. Red Hat

Dual boot (Booting Windows from Linux MBR)

Hi , I have two disk installed with Linux(disk 1) and WinXP(disk 2) .Now i am changing Hardisk jumbper manualy to get in to Linux/Windows .I want to configure my REDHAT linux boot manager to list Linux and WindowXP and wanna boot according to my choice . Here is what my fdisk -l shows (Only... (2 Replies)
Discussion started by: gkrishn
2 Replies

10. UNIX for Dummies Questions & Answers

Installing Linux on an individual drive and the MBR..

-------------------------------------------------------------------------------- If I install linux on my 2nd HD which is aprox 30 Gigs do I still need to worry about all this W2k MBR editing stuff, and could anyone tell me a good size for each area (Root, Home, var etc etc)) (1 Reply)
Discussion started by: PravusMentis
1 Replies
Login or Register to Ask a Question

Featured Tech Videos