Problems deleting ISO-fs'es from USB?

Story: Using an IMG instead of an ISO to put Debian on a USB Flash driveTotal Replies: 23
Author Content

Oct 29, 2010
8:48 PM EDT
What I like to ask is,

did you (or anybody else reading) ever had problems deleting an ISO9660-partition from a USB-stick? Seems lots of people are having this problem, and it simply _CANNOT_ be done in Linux. Windows however, no problem. That's weird, normally these kind of issues are the other way around. Weirder, you can delete those ISO's in Linux using WinXP from VirtualBox (non-ose version).

I invite anybody who doesn't believe me to create an ISO-fs on a USB-stick (or SD card for that matter) and try to delete it. Be warned, you should be prepared to throw it away after the effort because sometimes even Windows fails.

It seems to be, ISO9660 is not a 'normal filesystem', but different. But I don't know 'how' it's different.

I hope IMG instead of ISO solves the problem. Already tried Steven?

Oct 29, 2010
9:38 PM EDT
> ...did you (or anybody else reading) ever had problems deleting an ISO9660-partition from a USB-stick?

Some brain dead manufacturers ship USB drives with an ISO9660 partition with their software on it. Since the partition is marked as read-only, I couldn't find any way to delete it under either Windows or Linux. I never tried a dd if=/dev/zero of=/dev/sdx though. That might work.

Oct 29, 2010
9:53 PM EDT
IIRC, there was a discussion on the LXer forum a year or two ago, about this very issue. I didn't have any spare Flash to try it out on, but now I do have a quarter gig SD to play with.

(Yikes, that sounds weird.)

Before proceeding, though, I do want to ask a few fairly obvious questions. Please don't take offense; I merely want to cover the bases and try to create something as close to your situation as possible.

1. Are you sure the containing partition is unmounted? Like, if the ISO resides on /dev/sdc1, make sure it's unmounted. A complication is that some desktops will auto-mount hot-plugged devices.

2. Even if it is mounted, have you tried jdixon's "dd" trick to wipe the descriptor blocks in the partition?

3. Failing that, have you tried wiping the entire partition table on the Flash with "dd"? Maybe if you wipe the partition table AND the descriptor blocks on the partition, then a new partition table...

4. Another possibility is to run a destructive "badblocks -wsv" on the entire device. Your final result should be a totally zeroed device.

5. What other commands have you tried?

6. Oh yeah, are there any other partitions on the device?

I think that's a good start...

Oct 29, 2010
10:55 PM EDT
One more question: Was this behavior observed on a non-USB Flash as well (if there is such a thing, anyway)?

Oct 30, 2010
12:48 AM EDT
I have run into the problem and yes, you can zero the device with dd and start over.

Oct 30, 2010
1:15 AM EDT
I have had this problem, and I've just taken the easy way out and reformatted in Windows and then went back to Linux.

Oct 30, 2010
12:38 PM EDT
dd works at the block level so it cares not at all for filesystems and their silly read-only restrictions. They are as the barking of the spiders, the whispering of the gnats.

Oct 30, 2010
10:12 PM EDT
*No, fs was not mounted, *no, dd to descriptor block didn't work, *no, dd'ing entire partition didn't work (this is where you go wrong TC: dd gives an error and bails out! Hence, I said: Try!) *no, did not try 'badblocks -wsv', *other commands tried: sfdisk, cfdisk and fdisk, all as root of course, all give errors, *tried this on two USB sticks, at least one had a second ext3 partition on it (persistent storage for LiveUSB), and tried it on at least two SD cards which were fitted in some Icidu thingy which you connect via USB.

IIRC, I also tried putting the SD cards in a photo camera (Fuji probably) and it failed to 'format' (to FAT). Yes, as mentioned, Windows via VirtualBox solved the issue (one SD, two USB-sticks, one SD failed), three of four times.

If you search on Google, you can find a handful of people who posted the same problem, were also told to dd, but it didn't work. The 'U3' topic is noise and can be ignored, it's not the way to fix the issue. I tried some "un-U3" tools both in wine and VirtualBox, but to no avail. Moreover, my sticks didn't come with U3 installed.

Maybe I have to add I put the ISO-fs in place with dd, if such a thing would matter.

Oct 30, 2010
10:23 PM EDT
It would help a lot of you posted the error emitted.

Oct 31, 2010
11:23 AM EDT
Then I'd might have to 'offer' another SD-card to the ISO-gods if I can't fix it afterwards, but I'll see what I can do.

Oct 31, 2010
11:35 AM EDT
> The 'U3' topic is noise and can be ignored,

U3 is one of the software sets which comes on a partition formatted as ISO9660, which is why you see it in with your query. The USB sticks I've seen which come from the factory this way mostly used the U3 software.

Oct 31, 2010
12:32 PM EDT
Quoting:I'd might have to 'offer' another SD-card to the ISO-gods if I can't fix it afterwards, but I'll see what I can do.
No, just the error from trying to wipe with "dd". No need to destroy another card, when a card already destroyed should generate an error message.

BTW, about that U3... For someone trying to eliminate the U3 partition, this might be useful:

Oct 31, 2010
12:40 PM EDT
I guess I've been lucky. I haven't had a USB stick or SD card I couldn't recover. I'm not discounting Hans' experiences and I know he certainly knows what he is doing. I've just always found a way to recover.

One thought: Hans, you said taking dd to the entire partition didn't work. Did you consider taking dd to the entire device, as in wiping out the partition table? I had to do that with a 1GB USB stick that unetbootin turned into an ornament rather than anything functional.

Oct 31, 2010
1:11 PM EDT
Thanks for the comments Caitlyn, I've had such an ornament as well. Will try dd'ing to entire device and post a vid, just installed 'recordmydesktop'.

gus3: All 3 cards / sticks were recovered with Windows, and the 'bricked' one was thrown away by my sister. But I will try again.

Oct 31, 2010
11:57 PM EDT
There it is, my first 'desktop capture' of a konsole session:

I was new to desktop capturing, so I hope you can view the OGG-file with mplayer or vlc (I tested them both).

Made sure the 'lock' pin of the physical card isn't set to 'lock'. This shows an 1GB SD-card fitted in my Icidu 13-in-1 cardreader (identified as Alcor). Dolphin can see the card and contents (forgot to do a cd and ls). It is configured with two partitions, sdd1 ISO9660 Fedora 13 partition of ~700+MB, probably made by unetbootin, but I'm not sure anymore; could be dd as well. It's mounted by Dolphin (not in the capture) and one other partition for persistent storage. FS type looks wrong (should be 96 I found out), but can't change it.

Sorry for my clumsy typing (should go to bed earlier), but it should show cfdisk, fdisk, badblocks and dd failing (and me trying to highlight errors).

If I feel like it, I could post a vid of how VBox-bin + WinXP saves the day tomorrow. I'll promise not to touch the SD card.

BTW on my desktop, mplayer hangs after playing the vid. Close manually if it does.

Nov 01, 2010
1:50 AM EDT

Yeah, my mplayer also hanged. Minor issue, contrasted to the issue at hand.

I'm guessing that you used something like:

dd if=/path/to/image.iso of=/dev/sdd1

to write the ISO image to your Flash drive's first partition. Am I correct?

What is your output from "fuser -m /dev/sdd1" and "fuser -m /dev/sdd"? If you have any processes accessing the Flash drive in question, this will list them. You can then see what these processes are, via "ps".

And another, frustrating question: What if you set the partition type to 0x83 (Linux non-swap) before you copy the image to /dev/sdd1? Does the partition type remain the same? Frustrating, because I know it will require yet another recovery via a Win boot.

Now, as I type this, I'm running the "badblocks -wsv" command. I've had no problem of any kind mounting, unmounting, writing, re-writing, or wiping the partition in question (in my case, /dev/sdc1). I even set the partition type of /dev/sdc1 to 0x17, as yours was, before I wrote the ISO to the partition... And now badblocks has finished, and the partition is completely wiped.

It's nice to have experience in tech support. And it's especially nice to be able to use it, without answering to someone else about using it. Yay Freedom!

Nov 01, 2010
8:47 AM EDT
As promised, a kinda boring 1 minute vid 1of how XP saved the day, showing the drive is mounted via VirtualBox at the end:

Showing what cfdisk and fdisk think of the disk after halting WinXP afterwards; seems Linux and Windows don't understand each other. Output doesn't make sense at all, though booting XP a second time, it's completely fine with the SD card.

But the nice thing is, after Windows did something 'miraculous' to the card, I can dd the complete drive (of=/dev/sdd) with zeros, and reformat using fdisk. Which means, Linux doesn't see the drive as read-only anymore.

Now I'm going to try the fuser / partition type hints.

Nov 01, 2010
9:13 AM EDT
Surprise, setting it to 0x83 (and maybe unsetting DOS compatible mode) solves the issue!

So, here's the next session:

--- fdisk /dev/sdd; n, p, 1, [Enter], [Enter], t, 0x83, w, p:


/dev/sdd1 2048 1983999 990976 83 Linux

I thought the topic of this tread / article was Debian, hence a Debian derivative following.

#md5sum linuxmint-9-gnome-cd-i386.iso: Turned out OK via Google; #dd if=${PWD}/linuxmint-9-gnome-cd-i386.iso of=/dev/sdd1

707096576 bytes (707 MB) copied, 295.35 s, 2.4 MB/s

Afterwards, type is still 0x83, as suggested.

#fuser -m /dev/sdd1 returns nothing; empty.


Afterwards fdisk can delete the partition first time.

I think the faulty SD-card was created with a tool like unetbootin or something, next thing on the list to find out.

Nov 01, 2010
11:53 AM EDT
Or, Windows screwed around with the partition type ("Hidden HPFS/NTFS") without telling anyone. That passes both Occam's Razor and Hanlon's Razor with ease.

Nov 01, 2010
9:55 PM EDT
What I thought, but I don't think Windows is to blame though. More 'research' to follow.

Nov 02, 2010
7:57 PM EDT
Turns out it was Fedora 13 (KDE) iso who set the 'type' to 17, NTFS/HPFS hidden, even if you set type 83 before.

However, when dd'ing that one, you can delete it afterwards. So probably the problem occurs if you use a tool / script like livecd-creator or something.

Nov 02, 2010
9:29 PM EDT
I can't imagine that happening as a side-effect. That has to be deliberate.

But dagnabbit, WHY?!?

Nov 02, 2010
9:40 PM EDT
Even more questionable as the HOWTO suggest setting 'type' to 06 (FAT16):

Nov 02, 2010
10:21 PM EDT
Well, that's another DOS/Windows partition type. I suppose setting it to 0x83 (Linux non-swap) would be unusable to Windows.

No, I don't intend to test that hypothesis.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!