The crux of the problem: which partition scheme you select determines whether the SD HC card will be bootable by a Raspberry Pi Zero 2 W. You cannot assume that because the card is bootable in a Raspberry Pi 4B, that it will also boot in the Raspberry Pi 2 W.
Background
There are at least two partition schemes:
SD HC card, /dev/sdd, has its partition 1 type set to "MBR only". /dev/sdd boots in a Raspberry Pi Zero 2 W. You can determine this with the tool gdisk [Interactive GUID partition table (GPT) manipulator]:
Contrast with a GUID Partition table on SD HC, /dev/sde, which will not boot on a Raspberry Pi Zero 2 W:
What you need to do to make your card bootable by a Raspberry Pi Zero 2 W is specify the partition scheme as MSDOS.
If you find yourself with an SD HC card having a GUID Partition Table, then you'll need to copy over the content of all partitions to a holding area and then designate the partition scheme as "MBR only" and rebuild your partitions on the card.
Another important factor to keep in mind is that fdisk's file "types" is contextually dependent upon the card being evaluated. You will not get the same menu of file types for an "MBR" vs. "GUID Partition Table". This can be confounding as you may encounter an example where the file types available by fdisk may look like this:
But when you go to set the file types on the card you're currently working on, the selection menus is quite larger and different and does not include the category "W95 FAT32 (LBA) [type code: 0c"]. Moreover, if you are working on a card that has a GUID Partition table, if you may see this type of entry for Partition 1:
and think that all you need to do is change the "type" to "c" in fdisk. If you try that, you'll get this response and there will be no change:
And you are hoping fdisk would inform you that the type has been changed to "W95 FAT32 (LBA)". You may incorrectly assume that a type "c" or "0c", is the same no matter what kind of card fdisk is analyzing. Beware: that is not the case. Type "c" is dependent upon what the "label" of the partition is.
If the card fdisk is analyzing has a GUID Partition Table, you will not be able to select type "c" which you hope will be "W95 FAT32 (LBA)", but remains as "Microsoft basic data".
Partitioning A Disk for Pi Zero 2 W
The critical configuration you need to make is that your label "msdos" and do not create a GUID Partition. Doing so means you wipe out any existing data and start building the partitions anew. Using the tool parted ("a partition manipulation program"), I specify the label as "msdos" and that's all you have to do with parted; one step -- very simple, yet fundamental. It's like choosing which country you're going to visit, and implicitly, which language you will have available to you.
Then, I can proceed with fdisk to create partitions, and most importantly, to specify the type "c" for partition 1 which will identify the partition as "W95 FAT32 (LBA)" instead of type "Microsoft basic data" which is insufficient for the Pi Zero 2 W to boot with.
Note: when you place a card in the Pi Zero 2 W and then plug the unit's transformer into mains power, a green light will appear if the Pi Zero is able to boot. Otherwise, no green (or red) light appears-- just darkness. So, the green light is an indicator of whether your card is correctly formatted for booting. Finally, remember the Raspberry Pi 4B does not distinguish between the two types of partitioning; it dutifully boots in either case which can make you think your card is fine, until you try using the card on an Rpi Zero 2W.
Where I erred or got into trouble
I brought onto myself the problem when I first modified a fresh new card from SanDisk by creating a new GPT disklabel :
The act of using the "g" command thereafter prevented me from having a partition 1 labeled as "W95 FAT32 (LBA)". I was unaware that by electing to have a GPT disk label, I was making an election which would not allow me to have partition 1 labeled as "W95 FAT32 (LBA)" and I labored under the belief that I could just set the "boot" attribute fix the problem. Not so. It just seemed to me that having GUIDs is a good thing, but in this case, you forgo the ability to configure you partition 1 so that a Raspberry Pi Zero 2 W will boot.
Maybe someone has a different approach that allows a GUID Partition Table and a bootable partition 1 which a Raspberry Pi Zero 2 W can see?
Background
There are at least two partition schemes:
- master boot record (MBR) - introduced in 1983 by Microsoft for PC DOS. Source Support added in 1996 for logical block addressing (LBA).
- GUID Partition Table - supersedes MBR Source
SD HC card, /dev/sdd, has its partition 1 type set to "MBR only". /dev/sdd boots in a Raspberry Pi Zero 2 W. You can determine this with the tool gdisk [Interactive GUID partition table (GPT) manipulator]:
Code:
ryzwork /home/jlpoole # gdisk /dev/sddGPT fdisk (gdisk) version 1.0.9 Partition table scan: MBR: MBR only BSD: not present APM: not present GPT: not present
Code:
ryzwork /home/jlpoole # gdisk /dev/sdeGPT fdisk (gdisk) version 1.0.9 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT.
If you find yourself with an SD HC card having a GUID Partition Table, then you'll need to copy over the content of all partitions to a holding area and then designate the partition scheme as "MBR only" and rebuild your partitions on the card.
Another important factor to keep in mind is that fdisk's file "types" is contextually dependent upon the card being evaluated. You will not get the same menu of file types for an "MBR" vs. "GUID Partition Table". This can be confounding as you may encounter an example where the file types available by fdisk may look like this:
Code:
ex code or alias (type L to list all): L 00 Empty 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-01 FAT12 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-02 XENIX root 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT-03 XENIX usr 40 Venix 80286 85 Linux extended c7 Syrinx 04 FAT16 <32M 41 PPC PReP Boot 86 NTFS volume set da Non-FS data 05 Extended 42 SFS 87 NTFS volume set db CP/M / CTOS / .06 FAT16 4d QNX4.x 88 Linux plaintext de Dell Utility 07 HPFS/NTFS/exFAT 4e QNX4.x 2nd part 8e Linux LVM df BootIt 08 AIX 4f QNX4.x 3rd part 93 Amoeba e1 DOS access 09 AIX bootable 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O 0a OS/2 Boot Manag 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor 0b W95 FAT32 52 CP/M a0 IBM Thinkpad hi ea Linux extended0c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs 0e W95 FAT16 (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT 0f W95 Ext'd (LBA) 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/10 OPUS 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b11 Hidden FAT12 5c Priam Edisk a9 NetBSD f1 SpeedStor 12 Compaq diagnost 61 SpeedStor ab Darwin boot f4 SpeedStor 14 Hidden FAT16 <3 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary 16 Hidden FAT16 64 Novell Netware b7 BSDI fs f8 EBBR protective17 Hidden HPFS/NTF 65 Novell Netware b8 BSDI swap fb VMware VMFS 18 AST SmartSleep 70 DiskSecure Mult bb Boot Wizard hid fc VMware VMKCORE1b Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fd Linux raid auto1c Hidden W95 FAT3 80 Old Minix be Solaris boot fe LANstep 1e Hidden W95 FAT1 81 Minix / old Lin bf Solaris ff BBT 24 NEC DOS Aliases: linux - 83 swap - 82 extended - 05 uefi - EF raid - FD lvm - 8E linuxex - 85
Code:
Device Start End Sectors Size Type/dev/sde1 2048 526335 524288 256M Microsoft basic data
Code:
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
If the card fdisk is analyzing has a GUID Partition Table, you will not be able to select type "c" which you hope will be "W95 FAT32 (LBA)", but remains as "Microsoft basic data".
Partitioning A Disk for Pi Zero 2 W
The critical configuration you need to make is that your label "msdos" and do not create a GUID Partition. Doing so means you wipe out any existing data and start building the partitions anew. Using the tool parted ("a partition manipulation program"), I specify the label as "msdos" and that's all you have to do with parted; one step -- very simple, yet fundamental. It's like choosing which country you're going to visit, and implicitly, which language you will have available to you.
Code:
ryzwork /home/jlpoole # parted /dev/sdeGNU Parted 3.6Using /dev/sdeWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) mklabel msdosWarning: The existing disk label on /dev/sde will be destroyed and all data onthis disk will be lost. Do you want to continue?Yes/No? yes (parted) quit Information: You may need to update /etc/fstab.ryzwork /home/jlpoole #
Then, I can proceed with fdisk to create partitions, and most importantly, to specify the type "c" for partition 1 which will identify the partition as "W95 FAT32 (LBA)" instead of type "Microsoft basic data" which is insufficient for the Pi Zero 2 W to boot with.
Note: when you place a card in the Pi Zero 2 W and then plug the unit's transformer into mains power, a green light will appear if the Pi Zero is able to boot. Otherwise, no green (or red) light appears-- just darkness. So, the green light is an indicator of whether your card is correctly formatted for booting. Finally, remember the Raspberry Pi 4B does not distinguish between the two types of partitioning; it dutifully boots in either case which can make you think your card is fine, until you try using the card on an Rpi Zero 2W.
Where I erred or got into trouble
I brought onto myself the problem when I first modified a fresh new card from SanDisk by creating a new GPT disklabel :
Code:
Command (m for help): pDisk /dev/sde: 29.72 GiB, 31914983424 bytes, 62333952 sectorsDisk model: MassStorageClassUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type/dev/sde1 8192 62333951 62325760 29.7G c W95 FAT32 (LBA) Command (m for help): gCreated a new GPT disklabel (GUID: 8A501E89-F826-6E4F-8AB0-2C871F337A4F).The device contains 'dos' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Maybe someone has a different approach that allows a GUID Partition Table and a bootable partition 1 which a Raspberry Pi Zero 2 W can see?
Statistics: Posted by JohnLPoole — Thu Mar 28, 2024 5:57 pm