How do I reset a bootable drive so that it no longer is bootable?

26,450

Solution 1

As root, run dd if=/dev/zero of=/dev/sdX bs=512 count=1

Then you can add a partition table (fdisk /dev/sdX and press o, or you could use one of the graphical tools like gparted) and a new NTFS partition.

Solution 2

From Fedora install GParted from the Fedora package manager. Unmount the bootable USB drive. Open GParted and find the USB drive from the menu list of drives (see mouse cursor on screenshot below).

enter image description here

From the GParted menu choose: Partition -> Manage Flags. From the Manage flags on... window uncheck boot (see screenshot below).

enter image description here

From the GParted menu select Partition -> Format to -> NTFS.

Solution 3

You can achieve this by a simple system tool like diskpart from windows.

1)Open up the Start Menu and type “diskpart” in the run box.

2)Type “list disk”.enter image description here 3)“select disk #” where # is the disk number of your USB stick.

4)now enter the command “clean all”

The "clean" command zeroes out the sectors of the disk that contain the partition data. “clean all”command zero out all data on the USB stick .

Now you can format it from context menu as usual.

(since you mentioned NTFS , i hope you have access to a windows system)

To zero fill the drive from linux you can make use of dd. To wipe a disk by writing zeros:

dd if=/dev/zero of=/dev/sda bs=4k conv=notrunc

where /dev/sda with your device.

Solution 4

You can use diskpart from the command line or the disk management tool (inside computer management).

Disk Management: http://windows.microsoft.com/en-us/windows7/delete-a-hard-disk-partition

Obviously repartitioning / reformatting will erase all your files on the drive.

Diskpart command line: http://ss64.com/nt/diskpart.html

Usually the procedure is : delete the partition, create a new one, then format it

Solution 5

While the accepted Answer works, it is overkill.

The MBR contains the partition table as well as the bootloader. The bootflag is yet another thing. To boot from the USB, you need a bootloader installed and the bootflag set on one partition. To use the drive at all (whether or not you want it to be bootable), you need a partition table.

You could just use your drive as-is, with no changes (so what if it's bootable).
You could also unset the bootflag to make it non-bootable.
A step further is to remove the bootloader (the first 446 bytes, IIRC) - but not the partition table. At that point, it is non-bootable and all your data is still intact.

Granted, you say that you want a NTFS partition, and I guess we can infer that it is/was not NTFS before, so you'll move your data and reformat anyway.

Share:
26,450

Related videos on Youtube

Dave
Author by

Dave

Studied physics, Works at statistical data analysis, Plays at making music.

Updated on September 18, 2022

Comments

  • Dave
    Dave over 1 year

    I made a bootable USB stick (Fedora) to install on a system. I'd like to reuse the stick, so I want to remove all traces of the functioning system; in particular I'm not sure how to reset the MBR so that, when treated as a disk, the stick does not look bootable.

    My ultimate goal is to have a blank, non-bootable, NTFS (re-)formatted USB stick.

  • user55325
    user55325 over 10 years
    You don't actually need to zero the whole drive, just the MBR. This will save a write cycle on the flash memory.
  • Dave
    Dave over 10 years
    Is unchecking the boot flag equivalent to zeroing the MBR via dd?
  • Ashildr
    Ashildr over 10 years
    I agree to that.
  • Blaizz
    Blaizz over 10 years
    The USB drive has a boot flag somewhere in one of the first sectors of the drive which can be set/unset to bootable using gparted. So gparted will unset the identical boot flag as dd does, only it has a graphical front-end to show you what it's doing.
  • Canadian Luke
    Canadian Luke over 10 years
    Slow to the races, and you don't give any clear instructions, just links. Welcome to superuser, but realize we don't like answers of just links. Summarize the points, and add the link as a source for your information
  • hunter2
    hunter2 over 10 years
    @Dave No, it is not the same. Unsetting the flag will leave your MBR intact.