Re: how2 format a flash drive
Hi,
David Wright wrote:
> Of course, we're not told what "normal" means,
I guess it's a single partition with FAT.
Around 2010 i got three USB sticks and kept their compressed original
content. For examination of their MBR partition tables it is enough to
cut off their heads:
$ gunzip <usb_2gb_original.gz | dd bs=512 count=1 of=x.img
...
$ /sbin/fdisk -l x.img
...
Device Boot Start End Sectors Size Id Type
x.img1 * 32 3915775 3915744 1.9G 6 FAT16
The other two have
Device Boot Start End Sectors Size Id Type
x.img1 38 7839719 7839682 3.8G b W95 FAT32
Device Boot Start End Sectors Size Id Type
x.img1 * 63 15794175 15794113 7.5G b W95 FAT32
The types do not necessarily tell the actual filesystem type.
But since that was the initial partitioning, i trust them and do not
uncompress the whole images in order to inspect them.
> what was tried, nor how normality was tested.
Yeah. More tangible info would help with helping.
> It's possible that they need to
> use, say, mkdosfs to get back to the state in which USB sticks
> are typically bought, so it can be plugged into other devices.
Since at least a decade, "man mkdosfs" describes "mkfs.fat".
But before creating a new filesystem, it is necessary to create a
suitable partition for hosting it.
An USB stick with the netinst ISO shows two partitions:
$ /sbin/fdisk -l debian-12.2.0-amd64-netinst.iso
Disk debian-12.2.0-amd64-netinst.iso: 628 MiB, 658505728 bytes, 1286144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x52bf7ba9
Device Boot Start End Sectors Size Id Type
debian-12.2.0-amd64-netinst.iso1 * 0 1286143 1286144 628M 0 Empty
debian-12.2.0-amd64-netinst.iso2 4476 23451 18976 9.3M ef EFI (FAT-12
Partition editors might react unfriendly on the "Empty" partition which
surrounds the EFI partition. The latter has a FAT filesystem which is
completely filled up:
$ sudo mount offset=2291712 /mnt/fat
$ df /mnt/fat
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 9450 9446 4 100% /mnt/fat
The files in this FAT are the initial boot stages for amd64 and i386:
$ find /mnt/fat -type f
/mnt/fat/efi/boot/bootx64.efi
/mnt/fat/efi/boot/grubx64.efi
/mnt/fat/efi/boot/bootia32.efi
/mnt/fat/efi/boot/grubia32.efi
/mnt/fat/efi/debian/grub.cfg
Their only purpose is to convince Secure Boot that the GRUB software is
acceptable and to find the ISO filesystem where the rest of GRUB's
equipment is stored.
So both partitions are of no use for the general purpose USB stick
and can be deleted.
Have a nice day :)
Thomas
Reply to: