Cannot wipe USB stick - filesystem is read only

I was given a USB stick with some sort of non-standard set up which I don't fully understand. Part of the drive was formatted as a separate partition containing 2 files. The rest of the drive I was able to use normally in Linux. Both Linux and Windows saw the USB as 2 devices - one volume for the 2 files and one for the rest.

This is annoying because I don't need those files and would like to recover the space. The more serious problem, though, is that the USB stick cannot be read by the photocopiers at work which means I cannot print directly from them using this USB stick. The photocopiers do not see any device as present at all.

I have tried deleting the read-only partition in both fdisk and gdisk. (I don't care if it screws up the partition table - I can always redo it once it lets me.) I have also tried using fdisk to just make a new partition table and the same with gdisk. In both cases, I cannot write the changes to disk.

I have also tried dd if=/dev/zero of=/dev/sdd, I have tried running fsck.vfat and I have tried various other incantations of dd using different bs sizes. I've also tried just wiping the first 512B as explained in the wiki for recovering a key used for Arch install. (Not the same, I know, but I figured why not?)

Does anybody have any suggestions? I can find similar sounding issues on the wiki and in the forums but the solution is usually something I've tried or think I've tried. I seem to be able to do anything to that partition and it still pops up. Even though I did most of this yesterday, it still mounts the second partition with the custom label I added to distinguish the two volumes easily.

Some info from udevil (again, obtained as root despite the dollar signs):

Re: Cannot wipe USB stick - filesystem is read only

While not able to contribute to a solution, I can sympathize with the problem. I had a flash drive with something similar. From what I was able to determine, it seemed to be "hardcoded" data block of the manufacturer's (mal|soft)ware.

I even once thought about taking the thing apart to see if I could physically remove the element storing that data while keeping the memory chip intact. But I was not that bored, and just buying a different flash drive was much easier.

Re: Cannot wipe USB stick - filesystem is read only

Thanks for the replies.

@mamamia88,Is there something special about gparted? I mean I've tried this with both fdisk and gdisk. I could also try with parted. Is gparted special in some way? I don't have it installed as I find the GUI confusing in comparison to the CLI tools.

@Trilby,I realise that USB sticks are cheap and this isn't even the only one I have. It is just bugging me that I have a perfectly good stick which is screwy in this way. I tend to forget this is the one which doesn't work in the photocopier which is partly why it is so annoying.

It is definitely not the hardware manufacturer's files on the disk. The files are actually study guides for lifelong learning students at an institution I do not work for. My line manager in the lifelong learning department at the institution I do work for gave me the USB stick as he wasn't using it. We were giving out similar sticks but with a normal partition so it was easy to wipe the learning guides. (I transferred those to disk since I might want to reference them - I do work at my own institution, after all - and then freed up the space for other stuff.)

It would be bizarre if the other institution is going so far as to have their learning guides hard-coded onto the sticks, wouldn't it? I mean, I realise that they don't want students to delete them accidentally or whatever but surely that sort of thing would make the sticks much more expensive?

Re: Cannot wipe USB stick - filesystem is read only

cfr wrote:

It would be bizarre if the other institution is going so far as to have their learning guides hard-coded onto the sticks, wouldn't it? I mean, I realise that they don't want students to delete them accidentally or whatever but surely that sort of thing would make the sticks much more expensive?

Yes, very. If you had mentioned the content previously I missed it - given that it isn't manufacturer content, there should be a way to remove it from just software. But the dd write is the most aggressive method I'd come up with.

Re: Cannot wipe USB stick - filesystem is read only

Re: Cannot wipe USB stick - filesystem is read only

cfr wrote:

Thanks for the replies.

@mamamia88,Is there something special about gparted? I mean I've tried this with both fdisk and gdisk. I could also try with parted. Is gparted special in some way? I don't have it installed as I find the GUI confusing in comparison to the CLI tools.

@Trilby,I realise that USB sticks are cheap and this isn't even the only one I have. It is just bugging me that I have a perfectly good stick which is screwy in this way. I tend to forget this is the one which doesn't work in the photocopier which is partly why it is so annoying.

It is definitely not the hardware manufacturer's files on the disk. The files are actually study guides for lifelong learning students at an institution I do not work for. My line manager in the lifelong learning department at the institution I do work for gave me the USB stick as he wasn't using it. We were giving out similar sticks but with a normal partition so it was easy to wipe the learning guides. (I transferred those to disk since I might want to reference them - I do work at my own institution, after all - and then freed up the space for other stuff.)

It would be bizarre if the other institution is going so far as to have their learning guides hard-coded onto the sticks, wouldn't it? I mean, I realise that they don't want students to delete them accidentally or whatever but surely that sort of thing would make the sticks much more expensive?

nothing special really just a front end for parted. it is rather easy though. just select your drive and then under devicei believe is the opttion for creating new partiton table. worth a try imo. i mean isnt that the point of pacman? takes a few seconds to try

Re: Cannot wipe USB stick - filesystem is read only

Trilby wrote:

cfr wrote:

It would be bizarre if the other institution is going so far as to have their learning guides hard-coded onto the sticks, wouldn't it? I mean, I realise that they don't want students to delete them accidentally or whatever but surely that sort of thing would make the sticks much more expensive?

Yes, very. If you had mentioned the content previously I missed it - given that it isn't manufacturer content, there should be a way to remove it from just software. But the dd write is the most aggressive method I'd come up with.

Yes, sorry. I didn't realise manufacturers did that so it didn't occur to me when initially posting that the specific content would be relevant. I realised after I read your post that it was relevant after all. I apologise for not realising to make it clear initially.

lucke wrote:

What fs does the first partition mount as? (df -T)

I've found this. U3 and ceedo might be also the keywords to google for.

Wow. I suppose I should be glad the damn thing doesn't autorun a slide show telling me how to find the other institution's library every time I plug it in. (For the record: it doesn't do that even in Windows.)

It really sounds similar - along with the claims about mismatching numbers of blocks and things.

I'm pretty stunned they would go to this much trouble, though. That is, I'd expect that such sticks still cost more than standard sticks. I was just reading my (other - non-lifelong learning) department's handbook today and noted that my department is "unable to provide USB sticks" even to members of its own staff, never mind specially tweaked ones to its students!

Re: Cannot wipe USB stick - filesystem is read only

its not one of those with preinstalled crapware that opens a popup to helps computer illiterate people use it when they plug it into a windows machine is it? i remember back in the day i had one of those and it was annoying as heck but the manufacurer provided a removal tool

Re: Cannot wipe USB stick - filesystem is read only

For whatever it is worth, I think my efforts have rendered the USB stick entirely unusable. I seem to have managed to destroy the partition I could write files to but not the other one. So I'm left with a read-only 512M USB key with a read-only 4.5M partition containing 2 files which total 58% of that 4.5M. Of course, I can't change the partition table or add a further partition or create a file system because, guess what? Everything is now read-only!

Well, it is from a lifelong learning department and I will say that the experience is proving educational although probably not in quite the way they intended. I wonder if they teach computer science? EDIT: intentionally, I mean.

Re: Cannot wipe USB stick - filesystem is read only

mamamia88 wrote:

its not one of those with preinstalled crapware that opens a popup to helps computer illiterate people use it when they plug it into a windows machine is it? i remember back in the day i had one of those and it was annoying as heck but the manufacurer provided a removal tool

I don't know. Windows 7 opens a helpful popup to help you use the stick no matter which of my USB sticks I plug into them. And the others are not in any way strange. Several of them now boot Arch, for example, and I had no problem wiping them, formatting them, dding them etc. Nothing additionally popup like happens with this one. The only oddity is that it appears as two devices, doesn't appear at all in the photocopier, and won't let you touch the 4.5M partition. Apparently it will let you destroy the rest of it beyond repair but presumably as long as the learning guides are still there, everything should be OK.

I'm annoyed with myself for destroying it. I never realised that it was possible to do that. I just figured what I tried might not work. I didn't think I'd make things worse.

Oh, and I have no idea who the manufacturer of the stick is. The branding is institutional but I doubt they are producing their own USB sticks even to safeguard their learning guides.

EDIT: I've opened it up but can't read the inscription. Will have another go later (in daylight). I'm fascinated now.

Re: Cannot wipe USB stick - filesystem is read only

Well I tried to decipher the description with the help of natural light, electric light and a magnifying glass several times. Either I'm not deciphering it correctly or there's nothing to be found googling for this particular stick as I haven't had any luck finding a useful Russian site hosting a useful configuration utility. (Doubt I could get it working anyway but still.)

So somehow I've destroyed the key's usability completely and now have no way to restore it. It has been interesting enough to almost be worth it, mind you...

Re: Cannot wipe USB stick - filesystem is read only

Hmm... Apparently the disk is now only 4.5M (as well as being read-only). It should be 512M!

I'm really curious about this. Despite all I've done to it, the original learning guides are still sitting in their protected partition ready for use even though the rest of the USB stick is apparently non-existent as far as the OS is concerned. (For all I know, the rest of the flash memory really *is* non-existent - I have no idea at all.)

Re: Cannot wipe USB stick - filesystem is read only

That site has both the application that tells what chipset your USB stick uses and those programs for working with particular chipsets. Probably both would be safest to run under Windows (not wine) and especially the latter - it seemed as if you had access to that OS.

Re: Cannot wipe USB stick - filesystem is read only

Try zeroing the actual partition first.

dd if=/dev/zero of=/dev/sdd1

I just had a ssd card give me all the same errors and failures to delete, create and format the ssd card. Once the partition itself was filled with zeros, fdisk and/or gdisk was able to create a new partition which formated without issues and is now usable again. Hopefully it will work for you as well.

Knowledge is a beam of light in which humans can only see the reflection.

Re: Cannot wipe USB stick - filesystem is read only

All you want should be doable with Arch, but,have you tried 'Hiren’s BootCD'I ask because it saved me more than once in the past, in cases like this.

There are numerous progs for disk, like formating & mbr-tools.There's a lot more on it like Xp-PE, a win-xp pre-installed (live-cd) environment, DOS tools & much more. (which you'll probably never use;)

Just give it a try, you can't break anything anymore,) maybe you will also manage to make your disk usable again with these tools!

Re: Cannot wipe USB stick - filesystem is read only

lucke wrote:

That site has both the application that tells what chipset your USB stick uses and those programs for working with particular chipsets. Probably both would be safest to run under Windows (not wine) and especially the latter - it seemed as if you had access to that OS.

I have access to networked Windows machines at work but I cannot install software on them. In fact, they will not allow me to format ordinary, unproblematic USB keys which I own. So I can tell you what it looks like in Windows but I can't use a Windows programme unless it happens to be installed and it will allow me to use it on the USB stick. Neither of those are very likely. My own desktop at work runs Fedora. That I have complete control over.

The only machines I can install software on or really work with the key on are running some form of Linux. (Fedora or Arch at the moment.)

Interestingly, *both* partitions still showed up when the key was inserted into a Windows 7 machine and they could be mounted. Windows even claimed they were healthy. However, there is something very corrupt about the partition map. The IT guy who looked at it said he wouldn't use it as something could just disappear since the map is corrupt. Nothing they tried could correct this or delete the read-only stuff.

I later managed to reformat the larger partition in Fedora and Fedora now sees it as existing again. I made the file system etc. But the partition map remains corrupt so I certainly wouldn't trust it with actual files. I get errors about file descriptors, mismatches etc. etc.

Re: Cannot wipe USB stick - filesystem is read only

Same things happened to me right now... I wanted to format my USB stick for USB-ZIP compatibility to be able to boot on an old PC. I used an utility from the syslinux package, called "mkdiskimage". This create a ZIP drive-like disk geometry on the USB stick, modifying the cylinder, head, and sector numbers. Now the USB stick still doesn't boot, but additionally I am unable to revert it from this state to the original. I tried to fill it with zeros (dd if=/dev/zero of=/dev/sdc) but only the first 14 MB was writeable from the 512 MB. Fdisk also doesn't work, when I delete the partition and want write the changes to the disk, it says it is read only. Now I must use some windows utility to make it work again.

Re: Cannot wipe USB stick - filesystem is read only

That sounds like a different issue. Especially if it is fixable on Windows, which mine definitely wasn't. Moreover, mine wasn't the result of my using a utility but more a result of how the thing was manufactured/created in the first place.