Automating Removal of Partitions from HDDs

  • SpinRite v6.1 Release #3
    Guest:
    The 3rd release of SpinRite v6.1 is published and may be obtained by all SpinRite v6.0 owners at the SpinRite v6.1 Pre-Release page. (SpinRite will shortly be officially updated to v6.1 so this page will be renamed.) The primary new feature, and the reason for this release, was the discovery of memory problems in some systems that were affecting SpinRite's operation. So SpinRite now incorporates a built-in test of the system's memory. For the full story, please see this page in the "Pre-Release Announcements & Feedback" forum.
    /Steve.
  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in please checkout the “Tips & Tricks” page for some very handy tips!

    /Steve.
  • BootAble – FreeDOS boot testing freeware

    To obtain direct, low-level access to a system's mass storage drives, SpinRite runs under a GRC-customized version of FreeDOS which has been modified to add compatibility with all file systems. In order to run SpinRite it must first be possible to boot FreeDOS.

    GRC's “BootAble” freeware allows anyone to easily create BIOS-bootable media in order to workout and confirm the details of getting a machine to boot FreeDOS through a BIOS. Once the means of doing that has been determined, the media created by SpinRite can be booted and run in the same way.

    The participants here, who have taken the time to share their knowledge and experience, their successes and some frustrations with booting their computers into FreeDOS, have created a valuable knowledgebase which will benefit everyone who follows.

    You may click on the image to the right to obtain your own copy of BootAble. Then use the knowledge and experience documented here to boot your computer(s) into FreeDOS. And please do not hesitate to ask questions – nowhere else can better answers be found.

    (You may permanently close this reminder with the 'X' in the upper right.)

cpuguru

Active member
Sep 25, 2020
27
3
I have multiple spinning drives that were removed from RAID arrays and I'd like to repurpose them.

Unfortunately, pre-existing partitions can confuse some RAID hardware/software.

Any thoughts on a DOS utility or batch file that I could use by booting from a thumb drive and erase all partition information from the drive?

No need to over-write or erase sectors on the drives - just remove pre-existing partition configurations.

Cheers!
 
I'm sure someone will chime in with a recommendation. There's a Linux-based USB-bootable partition manager that will almost certainly do the trick. I used it a year or two ago, but its name escapes me at the moment.
 
Steve,
You are probably thinking of GParted. Also DBAN would be another choice. I believe DBAN has been forked recently, as someone took over the original DBAN code and is charging for it.
 
  • Like
Reactions: cpuguru
I would expect FDISK to do the trick, but it being DOS based means it doesn't understand very large drives (anything above about 2 TB). I guess you could try though
Yes. That was my first thought, too. FDISK will remove unknown partition types... but it won't know about GPT format partition tables. So GParted might be the better choice.
 
Thanks - I'll look into GParted.

One option we've used in the past was booting from a CD into a WinPE environment and run a batch file to clear the partition prior to installing Windows.

Now I'm wondering if it would even work on non-MBR or more exotic RAID partitioning schemes?

The .BAT file would just contain one line:
DISKPART /s diskpart.txt

The diskpart.txt file contains the following lines:
SELECT DISK 0
CLEAN
CREATE PART PRI
SELECT PART 1
ACTIVE
ASSIGN LETTER=C:
FORMAT FS=NTFS LABEL="CDRIVE' QUICK
EXIT
 
Any thoughts on a DOS utility or batch file that I could use by booting from a thumb drive and erase all partition information from the drive?

No need to over-write or erase sectors on the drives - just remove pre-existing partition configurations.

My method will depend on how comfortable you are poking around disk sectors, but for this sort of task I usually just use a sector editor and zero out the disk's Sector 0. That's where the MBR partition table or the GPT "protective" partition info is, so if zeroed out the disk will behave like a brand new, unformatted disk.

With something like Roadkil's SecEdit, one can work from within Windows without the need to reboot from alternate boot media. So my process is to slap the target disk into a USB dock, plug it into my running Windows system, launch SecEdit (with admin privileges), select the appropriate disk from the menu, and use the "Zero Data" option on the first sector. (This zeroes only that one sector, so is practically instantaneous.) Save the changes, exit SecEdit, and unplug. Done. The whole procedure takes less than a minute.

This shouldn't matter for Spinrite, but if you feel the need to put a partition back on it you can plug it back in and Windows will rediscover it anew and offer to initialize it.

The caveat, though, is you have to make sure you know which disk to zero; you wouldn't want to inadvertently wipe your Windows system disk! SecEdit will refer to them as "Disk 0", "Disk 1", etc., and those designations will typically follow what is shown in Windows "Disk Management". But if you have a lot of disks in your system I wouldn't advise relying on that method to identify the disks in SecEdit. For safety, it's best if your Windows computer has only a single disk and you plug your target in via a USB dock or enclosure. That way, there are only two disks for SecEdit to see, and Windows will be Disk 0 while the USB disk will be a higher number. That way, it will be clear which disk you want SecEdit to modify.
 
Gparted will wipe all partitions, and it can also create them, edit them, resize to a good part, and format and verify them as well.
 
  • Like
Reactions: cpuguru