Partitions are not populated in /dev properly
Hello,
I have a file.img file which was obtained by running dd if=/dev/sda of=file.img
on a non-alpine system (a RockyOS image). 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 (v3.19.1) 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.
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
I also tried running
for host in /sys/class/scsi_host/*; do
echo "- - -" > $host/scan
done
with no result
Also, in case this helps, the content of /proc/partitions
is:
major minor #blocks name
1 0 4096 ram0
1 1 4096 ram1
1 2 4096 ram2
1 3 4096 ram3
1 4 4096 ram4
1 5 4096 ram5
1 6 4096 ram6
1 7 4096 ram7
1 8 4096 ram8
1 9 4096 ram9
1 10 4096 ram10
1 11 4096 ram11
1 12 4096 ram12
1 13 4096 ram13
1 14 4096 ram14
1 15 4096 ram15
7 0 153612 loop0
8 0 8388608 sda
8 1 327680 sda1
8 2 7495680 sda2
11 0 1048575 sr0
while the content of /proc/mounts
is:
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,noexec,relatime,size=10240k,nr_inodes=498259,mode=755,inode64 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime,inode64 0 0
tmpfs / tmpfs rw,relatime,mode=755,inode64 0 0
tmpfs /run tmpfs rw,nosuid,nodev,size=803580k,nr_inodes=819200,mode=755,inode64 0 0
mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0
/dev/loop0 /.modloop squashfs ro,relatime,errors=continue 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
tracefs /sys/kernel/debug/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0
I don't know if this is the right repo - and I do apologize if it's not - let me know and I'll move/open this into a different repo.