/dev/sda is present but /dev/sda1 and /dev/sda2 are missing

I have a file.img file which was obtained by running dd if=/dev/sda of=file.img. This was done on a device with two partitions, /dev/sda1 and /dev/sda2.
In order to flash a new device with the same image, I'm booting an Alpine Linux using network boot, copy the file.img from the network and run the dd if=file.img of=/dev/sda. This is competed successfully and if I reboot, the device boots up properly.

The issue is that I want to add some files to the new device. Naturally, I thought I'll just mount the /dev/sda2 (that's the device I want to add stuff to) and add stuff there. Well, not that simple: /dev/sda2 is missing - sometimes.
After the dd command runs, sometimes - without a pattern observed - the partitions are missing. Checking the disk using fdisk -l /dev/sda shows both partitions there.

Running partprobe /dev/sda; dmesg always shows (dmesg command outputs this) sda: sda1 sda2 so the partitions are there and they're being recognized. Still, they don't appear under /dev/.

The funny part is that running partprobe /dev/sda sometimes fixes the issue, other times it doesn't.

With all this madness, rebooting the device will ALWAYS boot correctly.

If anyone has any idea what I could try, I'd greatly appreciate the ideas.

Thank you.

P.S.:
I also tried to run partx -uv /dev/sda. That tells me:

But the partitions still can't be found under /dev/sdaX

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论