-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
For example, if sdimage.tar.xz is present on the USB drive, but the SD card is not inserted, check this ahead of time.
Currently, it obviously eventually fails, but, in a non-obvious way. For example:
Starting image replication...
======= Writing sd filesystem ========
======= Writing emmc filesystem ========
tsimx9 production environment
tsimx9 login:
One or more operations failed!
==================================================
mklabel /dev/mmcblk1
==================================================
Check /tmp/logs for more information.
...
# cat /tmp/logs/sd-writefs
+ FS_FMT=ext4
+ FS_CMD=mkfs.ext4
+ PART_FMT=gpt
+ dd 'if=/dev/zero' 'of=/dev/mmcblk1' 'bs=512' 'count=1'
1+0 records in
1+0 records out
512 bytes copied, 0.0001015 s, 5.0 MB/s
+ parted -s -a optimal /dev/mmcblk1 mklabel gpt
Error: device is too small for GPT
+ err_exit 'mklabel /dev/mmcblk1'
+ echo 'mklabel /dev/mmcblk1'
+ exit
The failure is that mklabel had failed. This is because we "cleared" the partition table which actually left a 512 byte file of the same name in /dev/. All write scripts, such as tar, dd, U-Boot, etc., should first verify the target media is present, and err_exit if not with a more appropriate and obvious error message.
Metadata
Metadata
Assignees
Labels
No labels