4GB USB flash drive reports size as 8MB - parted fdisk df dd - can't re-create linux installer / burn image with dd

spaz

New Member
Joined
Jun 27, 2024
Messages
2
Reaction score
1
Credits
39
Hi all.

Any help on the following greatly appreciated.

I have a 4GB USB 2.0 drive which is reporting the wrong size (8MB) in lsblk, df, fdisk.
I had previously been using it as an installer for my distro (which was outdated by 2 versions).

Yesterday, I tried to burn using dd (like I always do) a newer version of the distro to this USB.

Several times it finished too quickly, and booting into the USB, the old distro installer was still there.

Tried a few times things such as

Code:
sudo dd if=/home/<path-to-image>  of=/dev/<target-disk> status=progress
and
Code:
    sudo dd if=/home/<path-to-image>  of=/dev/<target-disk> bs=1024 status=progress
and
Code:
    sudo dd if=/home/<path-to-image>  of=/dev/<target-disk> bs=2048 status=progress


I tried parted:
mklabel (msdos), mkpart (p), followed by mkfs.ext4.

Then dd again.


Somewhere through this process,
this flash drive has lost its drive information, and
all command line disk reporting programs show the drive as being only 8MB.

Doing mkpart primary seemed to create 4MB partitions.
Running again seemed to create a second partition same size.

Running mklabel and repeating gives same results.


With mkpart, I was trying to get it to align properly (usually with the minimal alignment option specified when starting parted).
I tried
mkpart
start 512b end 100%
start 1024b end 100%
start 1 end 100%

Repeated a few times with minor variations for sanity checks.

I also tried gparted "attempt data rescue",
and several other suggestions found in various forums.

Reading the parted manual section on flash drives again,
I realize I probably made a mistake and bungled the block size allocations and a couple of other parameters,
and I should have followed the guide for cheap USB Flash drives in the manual
(I haven't done this in a long time, and was in a bit of a rush)

Namely I should have followed these sections in the parted manual

https://www.gnu.org/software/parted/manual/parted.html

2.4.6 mkpart

...
Now, we will show how to partition a low-end flash device (“low-end”, as of 2011/2012). For such devices, you should use 4MiB-aligned partitions. This command creates a tiny place-holder partition at the beginning, and then uses all remaining space to create the partition you’ll actually use:

$ parted -s /dev/sdX -- mklabel msdos \
mkpart primary fat32 64s 4MiB \
mkpart primary fat32 4MiB -1s

Note the use of ‘--’, to prevent the following ‘-1s’ last-sector indicator from being interpreted as an invalid command-line option. The above creates two empty partitions. The first is unaligned and tiny, with length less than 4MiB. The second partition starts precisely at the 4MiB mark and extends to the end of the device.

The next step is typically to create a file system in the second partition:


$ mkfs.vfat /dev/sdX2


Footnotes

(2)
Cheap flash drives will be with us for a long time to come, and, for them, 1MiB alignment is not enough. Use at least 4MiB-aligned partitions. For details, see Arnd Bergman’s article, http://lwn.net/Articles/428584/ and its many comments.


I tried the above hoping it would restore the USB to reporting correctly.

I feel this USB must be fine,
it has just lost some kind of essential information.

Any suggestions for how I can fix this?
I probably have other old USBs floating around here which report similar things,
which I feel may be salvageable with the correct info.
 
Last edited:


Hummm... That maybe too much caution but i personally wouldn't want to risk inserting that thing in any flash reader i may still value.
 
Sounds like time to ditch it, USB's do not have an indefinite life, depending on the quality and the amount of read/write use it's had, we have many examples of members having problems with either old or cheap pen-drives, [it may be ok for storage]
 
@spaz wrote:
Code:
I feel this USB must be fine

If only feelings could have such power as to make things work and be fine :)

If you followed the instructions from the parted manual validly and were unsuccessful, and you were also unsuccessful with gparted and dd, then with three strikes like that suspicion falls upon the state of the usb.

To test the current state of the usb, you could use other tools to format the usb like fdisk, or a GUI formatter like the gnome disk utility.

The last thing to try is to use a tool like shred to write over the whole usb, or fill the usb with zeros using the dd command to clear it of any code that might be obstructing it's proper use. Then try to format it again. If those approaches fail, the message of its broken state should become relatively unmistakable.
 
When this happens...the only thing to do is...
1719469826960.jpeg

1719469855265.gif
 
Hi Egzoset.
Surely a simple passive flash drive does not pose any risk to a flash reader?
They don't generate volts or amps, they are bus powered by the reader - which itself would probably have some small amount of overvoltage protection.
What risk do you think a possibly dead USB flash drive could pose?

################

Hi Brickwizard!!
Ah, the unwanted facts.
I do have an unfortunate bin-aversion.
Dislike chucking anything electronic if I have a hunch there is life in it.

In fact, I would go out of my way to find some kind of ewaste for such things,
tree-hugging dirty hippie that I am.

Yeah, I know flash drives don't have an indefinite life,
but the fact that it was working just fine before attempting to re-burn a new installer image,
and even when reporting 8MB, I could STILL boot into the previous live Linux distro/installer makes me think there is just something simple that needs to be done to make it play nice,
and that the drive is just a bit corrupted, but perhaps can be uncorrupted.

Yes, I also suppose
"it may be ok for storage"

But unfortunately I can't seem to create proper partition any larger than 8MB that uses the whole drive.
I could try mounting that 8MB, and see if I can fit larger files on it.
Maybe I'll try that tomorrow, but all signs seem to point to "No".

USB 2.0 flash drives are becoming harder to come across,
and not all old computers like to see USB3.0 USB 3.0 drives as linux live installer disks.
Often USB 3.0 flash drives don't play nice for this purpose.

#########
@ osprey
I feel this USB must be fine

If only feelings could have such power as to make things work and be fine :)

Yeah, yeah, wise-guy :)

The "magical feeling" is based partly on some of the reasoning in my reply to Brickwizard above.

Yes, I acknowledge the drive may just be stuffed / a bin-job,
but there are just a few factors that make me think something is just a bit corrupted on the drive and could potentially be uncorrupted.

If you followed the instructions from the parted manual validly and were unsuccessful, and you were also unsuccessful with gparted and dd, then with three strikes like that suspicion falls upon the state of the usb.

To test the current state of the usb, you could use other tools to format the usb like fdisk, or a GUI formatter like the gnome disk utility.

The last thing to try is to use a tool like shred to write over the whole usb, or fill the usb with zeros using the dd command to clear it of any code that might be obstructing it's proper use. Then try to format it again. If those approaches fail, the message of its broken state should become relatively unmistakable.

That's all excellent constructive information / sanity checks!
Thanks very much.
I'll try those things.

I actually don't use fdisk often, although I did today.
I should try again with that, cfdisk, fsdisk, gnome disk utility, and maybe just do a general search around for various disk / flash disk utilities.

...and I will definitely try shred!
(Why didn't I think of that? 0__o )

I'll try and find time to have a play-around and if anything comes of it,
I'll report back.
 
@spaz

What probably happens is that the new partition table is not immediately recognized by the kernel.

When using fdisk what you need is to delete partition table and write changes to disk, after this step the fdisk will tell you that kernel needs to reload fstab, at this point simply reboot system.

Then run again fdisk and create a new partition table and write changes to disk and again reboot system again.
After second reboot create a new partition and this should work, if not your USB is dead.
 
Hummm... That maybe too much caution but i personally wouldn't want to risk inserting that thing in any flash reader i may still value.

What risk do you think a possibly dead USB flash drive could pose?

Does data corruption ring a bell? Additionally, i vaguely remember reading about "fake" (fraudulent/counterfit) units misrepresenting their total capacity, causing read & write speed issues. That was a decade ago, i think...

;)
 
Hi Egzoset.
Surely a simple passive flash drive does not pose any risk to a flash reader?
They don't generate volts or amps, they are bus powered by the reader - which itself would probably have some small amount of overvoltage protection.
What risk do you think a possibly dead USB flash drive could pose?
This is not entirely accurate. There is a device that looks like a USB flash drive that has been weaponized to destroy USB ports. It saves up the current from the port itself and delivers spikes of voltage to the port, over and over again, until it destroys the port and often the whole bus. This can be very expensive to fix. Why people make such things is beyond me. Some people are just sinister.

Amazon sells cheap 32 GB USB flash drives, for maybe US$5 a piece if you buy a pack of four or five. It looks to me like it's time to replace your "problem."

Signed,

Matthew Campbell
 
@spaz :-

I'm assuming this is quite an elderly flash drive? I would guess it is, since I can't remember the last time I saw, or indeed purchased one that small. Must be nearly 10 years ago, at least; the smallest available these days are at least 8GB, if not 16GB.

SanDisk had an entire class-action lawsuit levelled at them around a decade back. Millions of their 8GB Cruzer 'Blades' began going into 'read-only' mode. Their forums were awash with complaints; there was a long-running thread dedicated to this one issue, and the last time I looked, it had been running for something like 4 1/2 yrs & was up to almost 6000 posts....

The trouble was eventually tracked back to a shipment of dodgy controller chips from Hynix. Last I heard, the two of 'em were locked in a long-lasting court case, Hynix denying all responsibility and SanDisk refusing to back down! I don't know what the outcome was, except that anyone who subsequently made a complaint was automatically offered a free replacement drive....

I agree with you about older 'puters and USB 3.0 drives. Old boxes won't boot from USB 3.0 drives, even though they'll physically plug-in and work fine for storage.....because the USB 2.0 controller hubs are NOT set-up to recognise the boot flag on anything other than USB 2.0 drives; indeed, they don't even know what the USB 3.0 standard is, or does. The problems don't stop there, either, because the firmware on later USB 2.0 drives reports them as USB-HDDs.......and the BIOS on many older machines doesn't understand that.


Mike. ;)
 
Hummm... Actually i wish i could provide a reference about some horror story i once read relatively some milder version of a "weaponized" USB flash drive, involving a malfunction loop after reaching the last real record, e.g. before reaching the bogus target which didn't exist. In case of a doubt i might find appropriate to check such device using H2testw, CapacityTester, ValiDrive or else, except i'd still prefer not to risk my internal SD card reader (no longer present on many new products anyway)... Nonetheless data storage reliability remains a major concern as this defeats the drive's purpose to begin with.

In the case of vintage USB booting there happens to be a utility called 'Plop Boot Manager' and version 5.0.15 dates back to March 15, 2013 (ref.: www . plop . at), as i recall it was even incorporated into the Slax and/or Porteus boot menu(s) for that exact added convenience; i myself used to keep a bootable CD equipped with it so i could play with USB bootable drives via USB2, not USB3 as the 3 extension cards i tried kept making smoke - i mean literally! Because my PC's BiOS was quite old back then...

:oops:
 


Latest posts

Top