From a30ec33b98be7a8110103000a856f13b15a60d9c Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Thu, 8 Jan 2026 13:40:31 -0500 Subject: [PATCH] Fix SD card flashing progress display - Remove pv (showed read progress, not write progress) - Use dd status=progress for actual write progress - Reduce block size to 1M (better for slow SD cards) - Remove conv=fsync (sync at end instead, faster) Co-Authored-By: Claude Opus 4.5 --- rpi/flash-image.sh | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/rpi/flash-image.sh b/rpi/flash-image.sh index 743f9ac..c2ddf5f 100755 --- a/rpi/flash-image.sh +++ b/rpi/flash-image.sh @@ -278,29 +278,16 @@ echo "" echo -e "${GREEN}Flashing image to $SELECTED...${NC}" echo "" -# Flash with dd (optionally with pv for progress) -if [ "$HAS_PV" = true ]; then - echo -e "${YELLOW}Flashing with progress...${NC}" - if [ "$COMPRESSED" = true ]; then - case "$COMP_TYPE" in - xz) pv "$IMAGE" | xzcat | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null ;; - zst) pv "$IMAGE" | zstdcat | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null ;; - gz) pv "$IMAGE" | zcat | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null ;; - esac - else - pv "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null - fi +# Flash with dd (status=progress shows actual write progress) +echo -e "${YELLOW}Flashing (this may take several minutes for SD cards)...${NC}" +if [ "$COMPRESSED" = true ]; then + case "$COMP_TYPE" in + xz) xzcat "$IMAGE" | sudo dd of="$SELECTED" bs=1M status=progress ;; + zst) zstdcat "$IMAGE" | sudo dd of="$SELECTED" bs=1M status=progress ;; + gz) zcat "$IMAGE" | sudo dd of="$SELECTED" bs=1M status=progress ;; + esac else - echo -e "${YELLOW}Flashing (install pv for progress bar)...${NC}" - if [ "$COMPRESSED" = true ]; then - case "$COMP_TYPE" in - xz) xzcat "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync status=progress ;; - zst) zstdcat "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync status=progress ;; - gz) zcat "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync status=progress ;; - esac - else - sudo dd if="$IMAGE" of="$SELECTED" bs=4M conv=fsync status=progress - fi + sudo dd if="$IMAGE" of="$SELECTED" bs=1M status=progress fi echo ""