Flashing a custom image deleted contents of data SSD replacing it with the kernel partition... why?

I have been running OpenWrt on a x86_64 mini PC for ages. It has two SSDs. One has been for the OpenWrt image and another has been a data disk. I built r30642+87-e3637b202da7 just now and flashed it to the device and found upon rebooting that the image deleted my data SSD.

# lsblk -f
NAME          FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme1n1       vfat         kernel 1234-ABCD                                           
nvme0n1                                                                               
|-nvme0n1p1   ext4         rootfs ff313567-e9f1-5a5d-9895-3ba130b4a864                
|-nvme0n1p2   ext4         rootfs ff313567-e9f1-5a5d-9895-3ba130b4a864  493.6M    30% /
|-nvme0n1p3   ext4         spare  781aae1f-e108-4434-be8d-5d426b7f63d7                
`-nvme0n1p128                                                                         
                                                                 

In the above nvme1n1 is the data disk and it was partitioned to ext4.

What is wild is that the image created the kernel (boot partition) with the identical UUID as the rootfs partition but it is not valid. I cannot mount it. Further, it put the intended boot partition on my data disk (evident by the 1234-ABCD UUID) on the other SSD nuking the old partition table and data in the process.

This is NEVER happened before. I have backups but, I am obviously wondering why and how to avoid this.

This happened again when I flashed a new image. Same symptoms as before/complete destruction of filesystem on spare data SSD.

# lsblk -f
NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme1n1     vfat         kernel 1234-ABCD                                           
nvme0n1                                                                             
|-nvme0n1p1 vfat         kernel 1234-ABCD                             171.2M    11% /boot
|                                                                                   /boot
|-nvme0n1p2 ext4         rootfs ff313567-e9f1-5a5d-9895-3ba130b4a864  461.8M    35% /
`-nvme0n1p3 ext4         spare  781aae1f-e108-4434-be8d-5d426b7f63d7  424.8G     2% /mnt/spare

Maybe You are hitting this issue https://github.com/openwrt/openwrt/pull/18962.

2 Likes

Thanks for sharing that... SURE sounds like it.

I took a stab at fixing this in PR#20103. If anyone has some time please review and comment.