Sample Header Ad - 728x90

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

0 votes
1 answer
1022 views
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:
partition: none  disk: /dev/sda, lower: 0, upper: 0
/dev/sda: partition table type 'dos' detected
/dev/sda: partition #1 added
/dev/sda: partition #2 added
But the partitions still can't be found under /dev/sdaX
Asked by Silviu Bajenaru Marcu (1 rep)
Apr 5, 2024, 12:20 PM
Last activity: Apr 6, 2024, 06:02 AM