Removing hidden Windows partitions

Q I've been contemplating a Linux-on-USB-key project. I have a 4GB Toshiba USB which has an extremely annoying 0.3GB partition with some sort of automount 'smart' software (for Windows, naturally) that tries to self-install when connected to a Windows machine. Under Linux it appears as a separate partition, and does no harm.

My problem is that when I tried PartitionMagic to remove it and recover the wasted space, it reports that the partition is formatted as a CD-ROM and I cannot get rid of it. Apart from judicious application of a large-ball peen hammer, is there any methodology for excising this canker?

A Simply removing all partitions with a Linux partitioning tool should work (that's how I did it with my SanDisk device). Linux programs, unlike a lot of Windows software, tend to assume that you know what you are doing and if you want to reformat something it sees as a CD, that's your choice. It doesn't try to protect you from your perceived stupidity.

If the graphical tools fail, there are a couple of other options you can try. Running

cfdisk /dev/sdb

in a terminal (make sure you use the right device name) should enable you to delete partitions and create a new one. It needs to be run as root, either from a root terminal or with sudo. If this fails, try

cfdisk -z /dev/sdb

The -z option causes cfdisk to ignore the existing partition table and start with a blank canvas. Either way, cfdisk is entirely keyboard-controlled: D deletes a partition, N creates a new one, Shift+W (capital) writes the new layout to the device and H brings up the help when you get stuck. If even this fails, you can use

dd if=/dev/zero of=/dev/sdb bs=512 count=1

to overwrite the partition table of the device with zeros, guaranteeing a fresh start. Run this (as root) to overwrite the partition table and MBR with zeros; or you could omit the bs and count options to zero the entire device, but you really shouldn't have to resort to such an extreme measure.

Back to the list