-   Linux - Hardware (
-   -   Confusing USB Filesystem Problem (Can't Wipe Ext3 Filesystem) (

dkaplowitz 04-14-2007 11:20 AM

Confusing USB Filesystem Problem (Can't Wipe Ext3 Filesystem)
Hi all, I have this confusing problem with an externally (USB2) mounted hard drive. I have it formatted as an ext3 partition and I want to wipe that and format it with another filesystem. I've used cfdisk, fdisk and parted. Every time I successfully delete partition 1 (the only partition), it goes well, says "free space" for the full size of the drive. The minute I create a linux label (type 83), the drive automounts as the old filesystem with all the old files still in tact. (!)

I recall having this similar problem with a FAT partition and the cfdisk man page tells me to do a dd if=/dev/zero of=/dev/sdf1 bs=512 count=1. That also works, but when I create a new label, the old filesystem and files are still there. (I've tried dd if=/dev/zero of=/dev/sdf bs=512 count=1 too)

I even booted into a Windows partition and zapped that partition using their native disk mgmnt utils and got the same thing (though I didn't format as NTFS --should have tried, but I don't want to boot back into Windows).

This is Ubuntu Feisty, so I'm wondering if they have some weird protection in place, or if I'm just missing something really obvious.

Thanks for any help.


michaelk 04-14-2007 11:36 AM

This is normal with any operating system or filesystem. Deleting files does not really erase any actual data just the pointer that says where it is located.

cfdisk, fdisk and parted are used to create and manipulate partitions. They do not create filesystems. Deleting and recreating will not erase the actual data which is why you can magically can still see all of your data.

"dd if=/dev/zero of=/dev/sdf bs=512 count=1" again will wipe out the MBR and partition table but will not erase the actual data either.

mkfs is the command to create filesystems. For example to create a ext3 filesystem
on your USB device.
mkfs -t ext3 -j /dev/sdf1

dkaplowitz 04-14-2007 04:38 PM

Thanks for the reply.

Hmmm... I would have thought that deleting the partition (1) and writing that to the disk, thus leaving the disk with all free space and then creating a new label would have effectively wiped everything on the disk (even before the mkfs/mkreiserfs). I guess I was wrong about that. Just making a new filesystem did the trick. I guess I have a superstitious fear that it wasn't as clean as first wiping a disk then formatting. Either way, I'm good to go.



syg00 04-14-2007 06:30 PM

The problem is there is an in-storage copy of the partition table. After a reboot things would have been as you expected.
Similarly had you done the mkfs first, then assigned the label. Labels are a file-system concept, not part of the partition (table) definition.

All times are GMT -5. The time now is 11:21 AM.