Removing and reinserting USB stick makes file 0 byte

Halvor Raknes

Member
Joined
Apr 19, 2021
Messages
139
Reaction score
15
Credits
1,081
I have been experiencing some instances where one of the files I have downloaded to the 32 GB USB stick are turned into a 0 byte file. I only now clearly identfied it happening. Even when I attempt to re-download, the same thing happens when the USB stick is removed and reinserted. Refreshing the file manager window and changing directories and returning confirms that the file is solid, but when the USB stick is removed and reinserted into the same or a different computer the file suddenly becomes 0 bytes. I have now even reformatted the USB stick and the same thing happens!

I try and run badblocks, but I get this error:
sudo badblocks -w -s -o error1.log /dev/sdb1 /dev/sdb1 is mounted; it's not safe to run badblocks!
 


That kinda sounds like a 'blackmarket' USB, where the stated storage amount is false. It's fairly common from shady dealers. It'll report the right amount in your file manager, but the storage amount is actually much less.

I don't know if any of this stuff is for Linux, I'm merely linking it so that you can see how common this is.

 
Are you using the "eject" button. Things don't get written to disk immediately all the time.
It may say it's done. But that doesn't mean it really is. Eject or "sync" forces the data to be written
to the disk before you unmount or eject it.
 
That kinda sounds like a 'blackmarket' USB, where the stated storage amount is false. It's fairly common from shady dealers. It'll report the right amount in your file manager, but the storage amount is actually much less.

Well, that shouldn't matter when there is only a 200 MB file there. I have used it previously to transfer several 4 GB files at once.
 
Are you using the "eject" button. Things don't get written to disk immediately all the time.
It may say it's done. But that doesn't mean it really is. Eject or "sync" forces the data to be written
to the disk before you unmount or eject it.
Sure, I know about things not geting written immediately when it says it's done, but as I stated above, I confirmed the file was there. And then it wasn't.
 
I have used it previously to transfer several 4 GB files at once.

The plot thickens... The reason I leaned towards the problem being a hardware error is that it happens multiple times, in multiple machines. I'm still leaning towards it being a hardware problem.

I suppose you've copied what you can off of it (if necessary) and then tried to format it?
 
The plot thickens... The reason I leaned towards the problem being a hardware error is that it happens multiple times, in multiple machines. I'm still leaning towards it being a hardware problem.

I suppose you've copied what you can off of it (if necessary) and then tried to format it?
I don't know that it happens in multiple machines. It happens in one desktop PC when I try and use the USB stick to move a file (which has been downloaded to that PC) to my laptop. In fact, after clearly verifying that the file is there (both by looking at it in the file manager and playing the video), if I remove it and reinsert it in the same PC it will have become 0 bytes.
 
Above you said, "on the same or different computer". So, that's multiple machines as far as I can tell.

I'd suggest we start with the basics (unless someone else here has ideas or has seen this before) and you copy anything you need off of the device and then format it with GParted or Gnome Disks (or whatever partitioning software is on your system).

Then try it again.

Also, is this a recently purchased USB thumbdrive? I've noticed some have a short lifespan as compared to others. I have some that I've probably had for a decade and others that survived maybe a half-dozen .iso writes to them.
 

Staff online

Members online


Top