On Sat, 9/28/2024 1:42 PM, Ed Cryer wrote:
Mr. Man-wai Chang wrote:
On 27/9/2024 3:37 am, Ed Cryer wrote:
I needed a USB stick; I have a drawer full. I got one out and plugged it >>> in. It didn't appear in My Computer nor in "Safely Remove ..." in the
systray.
It did appear under Disk Management, but I couldn't format it. I'm not
too sure what was on it, but probably some bootable OS (Linux?). It had
an EFI partition.
So I used Diskpart, Clean; which worked.
Smelled like partition table problem. You sure that the drive was okay before this?
An EFI partition protects Window's necessary data; it will never allow you to format it.
Ed
dd.exe --list
rawwrite dd for windows version 0.6beta3.
Written by John Newbigin <
[email protected]>
This program is covered by terms of the GPL Version 2.
NT Block Device Objects
\\?\Device\Harddisk0\Partition0
link to \\?\Device\Harddisk0\DR0
Fixed hard disk media. Block size = 512
size is 4000787030016 bytes <=== whole disk is write-able (could wipe out C: very messy...)
\\?\Device\Harddisk0\Partition1
link to \\?\Device\HarddiskVolume1 <=== no size listed for ESP (EFI) partition, therefore cannot write
\\?\Device\Harddisk0\Partition2
link to \\?\Device\HarddiskVolume2
Fixed hard disk media. Block size = 512
size is 16777216 bytes
\\?\Device\Harddisk0\Partition3
link to \\?\Device\HarddiskVolume3 <=== No size for C: , not write-able as a partition (by dd.exe at least)
\\?\Device\Harddisk0\Partition4
link to \\?\Device\HarddiskVolume4
Fixed hard disk media. Block size = 512
size is 680525824 bytes <=== Recovery partition ("hidden") can be over-written (can't Delete from DM)
\\?\Device\Harddisk0\Partition5
link to \\?\Device\HarddiskVolume5
Fixed hard disk media. Block size = 512
size is 138510690816 bytes <=== Win10 H: partition, write-able, but could also Delete from Disk Management
\\?\Device\Harddisk0\Partition6
link to \\?\Device\HarddiskVolume6
Fixed hard disk media. Block size = 512
size is 1074790400 bytes
\\?\Device\Harddisk0\Partition7
link to \\?\Device\HarddiskVolume7
Fixed hard disk media. Block size = 512
size is 732331769856 bytes
Virtual input devices
/dev/zero (null data)
/dev/random (pseudo-random data)
- (standard input)
Virtual output devices
- (standard output)
/dev/null (discard the data)
*******
So yes, the road is a bit bumpy. I can assign a letter K to
the ESP, but, I can't list the files. Assigning a letter in
this case maybe would allow "chkdsk K: " ?
Testdisk can get in there, so I can see the files that way.
nfi.exe could list the files, but of course the partition is FAT32,
so that's not going to work. The nfi.exe is for NTFS.
The thing is, the EFI is protected via its GPT declaration of partition
type. And it's not just a "basic data partition". If you could change that, then
the properties of it would change. Notice I am not testing this for you,
using my boot drive as "bait".
DISKPART> detail partition
Partition 1
Type : c12a7328-f81f-11d2-ba4b-00a0c93ec93b <=== this protects it
Hidden : Yes
Required: No
Attrib : 0000000000000000
Offset in Bytes: 1048576
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -------- * Volume 3 K FAT32 Partition 100 MB Healthy System
If we Google that identifier, we get:
https://en.wikipedia.org/wiki/GUID_Partition_Table
The first 16 bytes of each entry designate the partition type's globally unique identifier (GUID).
For example, the GUID for an EFI system partition is C12A7328-F81F-11D2-BA4B-00A0C93EC93B.
The second 16 bytes are a GUID unique to the partition <=== like a BLKID
*******
First, this is my one and only hard drive. I have assigned K: to the
partition, but that's useless (except to say I'm on the correct partition).
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 C W11HOME NTFS Partition 118 GB Healthy Boot
Volume 1 H WIN10AMD NTFS Partition 128 GB Healthy
Volume 2 S SHARED NTFS Partition 682 GB Healthy
* Volume 3 K FAT32 Partition 100 MB Healthy System <=== ESP (efi) partition
Volume 4 NTFS Partition 649 MB Healthy Hidden
Volume 5 NTFS Partition 1025 MB Healthy Hidden
DISKPART> detail partition
Partition 1
Type : c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Hidden : Yes
Required: No
Attrib : 0000000000000000
Offset in Bytes: 1048576
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -------- * Volume 3 K FAT32 Partition 100 MB Healthy System
https://en.wikipedia.org/wiki/Microsoft_basic_data_partition
(So it is not protected by an attribute, only the Type field protects it)
(Note, how you start with a Basic Data Partition, then format it to FAT32, in the article)
https://www.diskpart.com/articles/change-partition-type-id-8523.html
Solution 2: Set partition type ID via Diskpart <=== The example is for an MBR disk drive...
diskpart
list volume
select volume 3
set id=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 <=== this then, would leave it exposed (IN THEORY)
exit
In theory then, you could format it at this point.
And maybe change it back to the original GUID (but of course that would
not make sense).
As a Basic Data Partition, you should be able to delete the partition.
Or delete the partition using a "force" ?
There are plenty of experiments you can try on your USB stick.
You don't even have to go to Linux yet :-)
Selecting the thing in diskpart.exe and doing a "Clean" on it, is faster.
But if you want to pick off the partitions one by one, like a sharpshooter,
I bet you can. The downside of doing that, is the stick is still GPT, and
maybe you want it "uncommitted" for whatever your next steps are. The
"clean" of the thing, should make it usable for any purpose.
Paul
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)