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
and
and
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
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.
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
Code:
sudo dd if=/home/<path-to-image> of=/dev/<target-disk> bs=1024 status=progress
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: