- JohnLPoole
- Posts: 9
- Joined: Mon Jan 24, 2022 3:41 am
San Disk 128 GB w/VFAT Not Working on Pi Zero 2 W
I have a SanDisk 128GB SDHC
where I have installed Gentoo Linux
I have been building my Gentoo instances on a Raspberry Pi 4B (8 MB) and will deploy my image to several Raspberry Pi Zero 2 W for a project involving multiple Pi Zeros gathering data in our neighborhood. I have been successfully using this paradigm of building out the image on a more powerful Raspberry Pi and then deploying on the Pi Zero 2 W before until I started running into frozen SD HC cards when I "upgraded" to the then-top-of-the line SanDisk 64 GB in October, 2023, and then all heck broke loose: the Gentoo image I was using was utilizing the btrfs file system and there was a design flaw/bug with SanDisks's 64 GB card so that using btrsf caused the card to become frozen and useable. After several months, Western Digital finally sent me 128 GB SD (I had requested the older and proven 32 GB versions with a refund of the difference in price, but they refused to do so).
So, I started building out a new Gentoo Linux based on a kernel greater than 6.2. When I popped the SD card into a Pi Zero 2 W, no lights -- nothing. Yet, the card works fine on a 4B. I had read that the initial book partition must be VFAT 32 or 64 and that the latest "x" version could not be read by the Pi Zero.
I had followed the Gentoo Linux page at https://wiki.gentoo.org/wiki/Raspberry_Pi_Install_Guide entitled "Raspberry Pi Install Guide" which unofficially has been referenced as the "universal Raspberry Pi Install Guide". (Be careful, as there are several versions of Raspberry Pi intsllations on Gentoo's site that are not cross-referenced and created by different users at different times.) I was certain I had selected VFAT for the 1st partition. Here are outputs from various tools confirming, I think, that I have selected a file system compatible with the Raspberry Pi Zero 2 W. Yet, the disk appears to be unreadable by the Pi Zero and I'm wondering what else I can do to determine why the SD can be read on a 4B, but not on a Pi Zero 2 W.
Does anyone have a suggestion on determining why this is happening? I do have a back-up plan to migrate my build to an older proven 32 GB San Disk which I am confident will not present the problem I am currently encountering. What with the nightmare I ran into with the 64GB SD card and btrfs, I'm becoming more apprehensive about trying different models of SD Cards. I'm also using the ext4 file system and not btrfs.
- lightroom_2024年02月14日_15-16-07.jpg
- lightroom_2024年02月14日_15-16-07.jpg (34.03 KiB) Viewed 12248 times
Code: Select all
pigentest1 /home/jlpoole # uname -a
Linux pigentest1 6.6.14-v8+ #1727 SMP PREEMPT Wed Jan 31 12:22:26 GMT 2024 aarch64 GNU/Linux
pigentest1 /home/jlpoole #So, I started building out a new Gentoo Linux based on a kernel greater than 6.2. When I popped the SD card into a Pi Zero 2 W, no lights -- nothing. Yet, the card works fine on a 4B. I had read that the initial book partition must be VFAT 32 or 64 and that the latest "x" version could not be read by the Pi Zero.
I had followed the Gentoo Linux page at https://wiki.gentoo.org/wiki/Raspberry_Pi_Install_Guide entitled "Raspberry Pi Install Guide" which unofficially has been referenced as the "universal Raspberry Pi Install Guide". (Be careful, as there are several versions of Raspberry Pi intsllations on Gentoo's site that are not cross-referenced and created by different users at different times.) I was certain I had selected VFAT for the 1st partition. Here are outputs from various tools confirming, I think, that I have selected a file system compatible with the Raspberry Pi Zero 2 W. Yet, the disk appears to be unreadable by the Pi Zero and I'm wondering what else I can do to determine why the SD can be read on a 4B, but not on a Pi Zero 2 W.
Code: Select all
pigentest1 /home/jlpoole # lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
mmcblk0
+-mmcblk0p1 vfat FAT16 9BBF-0046
+-mmcblk0p2 swap 1 8c750e61-e954-412b-af3c-aad72f12c3ca [SWAP]
+-mmcblk0p3 ext4 1.0 6ee167e0-a0d8-423d-9eb6-d2aac07b1908 45.5G 2% /home
+-mmcblk0p4 ext4 1.0 12493e7c-a74c-4f24-8418-8d1273605526 49.9G 11% /
pigentest1 /home/jlpoole # date
Wed Feb 14 14:58:10 PST 2024
pigentest1 /home/jlpoole # ls /dev
autofs gpiochip1 loop7 ppp ram7 tty13 tty28 tty42 tty57 vc-mem vcsa vcsu10 video11
block gpiomem mapper ptmx ram8 tty14 tty29 tty43 tty58 vchiq vcsa1 vcsu11 video12
btrfs-control hidraw0 media0 pts ram9 tty15 tty3 tty44 tty59 vcio vcsa10 vcsu12 video13
bus hidraw1 media1 ram0 random tty16 tty30 tty45 tty6 vcs vcsa11 vcsu2 video14
cachefiles hwrng media2 ram1 rfkill tty17 tty31 tty46 tty60 vcs1 vcsa12 vcsu3 video15
char input media3 ram10 shm tty18 tty32 tty47 tty61 vcs10 vcsa2 vcsu4 video16
console kmsg mem ram11 snd tty19 tty33 tty48 tty62 vcs11 vcsa3 vcsu5 video18
cpu_dma_latency kvm mmcblk0 ram12 stderr tty2 tty34 tty49 tty63 vcs12 vcsa4 vcsu6 video19
cuse loop-control mmcblk0p1 ram13 stdin tty20 tty35 tty5 tty7 vcs2 vcsa5 vcsu7 video20
disk loop0 mmcblk0p2 ram14 stdout tty21 tty36 tty50 tty8 vcs3 vcsa6 vcsu8 video21
dma_heap loop1 mmcblk0p3 ram15 tty tty22 tty37 tty51 tty9 vcs4 vcsa7 vcsu9 video22
fb0 loop2 mmcblk0p4 ram2 tty0 tty23 tty38 tty52 ttyprintk vcs5 vcsa8 vga_arbiter video23
fd loop3 mqueue ram3 tty1 tty24 tty39 tty53 uhid vcs6 vcsa9 vhci video31
full loop4 net ram4 tty10 tty25 tty4 tty54 uinput vcs7 vcsm-cma vhost-net watchdog
fuse loop5 null ram5 tty11 tty26 tty40 tty55 urandom vcs8 vcsu vhost-vsock watchdog0
gpiochip0 loop6 port ram6 tty12 tty27 tty41 tty56 v4l vcs9 vcsu1 video10 zero
pigentest1 /home/jlpoole # blkid /dev/mmcblk0p1
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="9BBF-0046" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="0c4ac739-11c1-0947-ab3f-d8eab8b5390b"
pigentest1 /home/jlpoole # file -sL /dev/mmcblk0p1
/dev/mmcblk0p1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 8, reserved sectors 8, root entries 512, Media descriptor 0xf8, sectors/FAT 256, sectors/track 63, heads 255, hidden sectors 2048, sectors 524286 (volumes > 32 MB), serial number 0x9bbf0046, unlabeled, FAT (16 bit)
pigentest1 /home/jlpoole #Retired software developer 24 years at world's largest database company. Gentoo Linux, Perl, & single-board computers ("SBC") including Raspberry Pi.
- JohnLPoole
- Posts: 9
- Joined: Mon Jan 24, 2022 3:41 am
Re: San Disk 128 GB w/VFAT Not Working on Pi Zero 2 W
I copied over my three partitions: 1) boot, 2) home, and 3) / to a 32GB SansDisk that has worked with other images (generated by the GenPi64 project) and the new card has the same problems: on a Rpi4, it works, on a Pi Zero 2 W, it does not. One thing I noticed is during the creation of my partitions, I received a warning:
The device contains "dos" signature and it will be removed by the write command.
Does the "dos" signature play a role in the readability of an SD HC card?
The device contains "dos" signature and it will be removed by the write command.
- 2024年02月14日_16-59.png
- 2024年02月14日_16-59.png (151.67 KiB) Viewed 12246 times
Retired software developer 24 years at world's largest database company. Gentoo Linux, Perl, & single-board computers ("SBC") including Raspberry Pi.
- JohnLPoole
- Posts: 9
- Joined: Mon Jan 24, 2022 3:41 am
Re: San Disk 128 GB w/VFAT Not Working on Pi Zero 2 W
Interim Update: I determined the problem: It's about how you configure the partitions and you have to make the boot partition "bootable". The Gentoo Guide I referred to will not work for cards destined for a Pi Zero 2 W. I'll reply in the next day or two with a comprehensive explanation that I think will be helpful for those building for Raspberry Pi 4B and Pi Zero 2 W.
Retired software developer 24 years at world's largest database company. Gentoo Linux, Perl, & single-board computers ("SBC") including Raspberry Pi.
- JohnLPoole
- Posts: 9
- Joined: Mon Jan 24, 2022 3:41 am
Re: San Disk 128 GB w/VFAT Not Working on Pi Zero 2 W
I had indicated I would update this topic with an analysis. Unfortunately, I'm finding the documentation and variety of platforms to be overwhelming to be able to accurately analyze why the differences and where the differences are documented. I used Linux's "script" to preserve the builds of the SD HC, one using procedures outlined in the Gentoo Wiki referenced above, and the other using a very helpful guide. I will provide the session of both so anyone interested can compare. I can only say at this time that using a partition method of designating partition 1 as the "boot" partition seemed to make the difference. I have run into a kernel panic issue -- there is no kernel panic when I run the card on a Rpi4B, but when I try the Pi Zero 2 W, I get postings and then a panic. It looks like it may be an overloading of processes overwhelming the kernel on the Pi Zero 2 W. Again, I'm using a kernel 6.6 or 6.7. I'm awaiting a delivery of a USB assembly that will allow me to capture the postings for posterity.
Retired software developer 24 years at world's largest database company. Gentoo Linux, Perl, & single-board computers ("SBC") including Raspberry Pi.
- JohnLPoole
- Posts: 9
- Joined: Mon Jan 24, 2022 3:41 am
Re: San Disk 128 GB w/VFAT Not Working on Pi Zero 2 W
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: Select all
ryzwork /home/jlpoole # gdisk /dev/sdd
GPT fdisk (gdisk) version 1.0.9
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
Code: Select all
ryzwork /home/jlpoole # gdisk /dev/sde
GPT 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: Select all
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 extended
0c 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 b
11 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 protective
17 Hidden HPFS/NTF 65 Novell Netware b8 BSDI swap fb VMware VMFS
18 AST SmartSleep 70 DiskSecure Mult bb Boot Wizard hid fc VMware VMKCORE
1b Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fd Linux raid auto
1c 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 - 85Code: Select all
Device Start End Sectors Size Type
/dev/sde1 2048 526335 524288 256M Microsoft basic dataCode: Select all
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: Select all
ryzwork /home/jlpoole # parted /dev/sde
GNU Parted 3.6
Using /dev/sde
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos
Warning: The existing disk label on /dev/sde will be destroyed and all data on
this 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: Select all
Command (m for help): p
Disk /dev/sde: 29.72 GiB, 31914983424 bytes, 62333952 sectors
Disk model: MassStorageClass
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: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sde1 8192 62333951 62325760 29.7G c W95 FAT32 (LBA)
Command (m for help): g
Created 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?
Retired software developer 24 years at world's largest database company. Gentoo Linux, Perl, & single-board computers ("SBC") including Raspberry Pi.
Re: San Disk 128 GB w/VFAT Not Working on Pi Zero 2 W
Use Hybrid MBR and make sure hex: 0c is the first partition, boot flag is unnecessary.JohnLPoole wrote: ↑Thu Mar 28, 2024 5:57 pmMaybe 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?
See discussion here.
See more about Hybrid MBR.
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion