partitioningkernel-moduleramdisk

RAMDISK Partition not getting registered by the kernel


all! So I've been sleuthing over this problem for the past two days.

I have a ramdisk, and I tried partitioning it using both parted and fdisk. I also tried to register it using partprobe and kpartx.

lsblk is displaying the partition I made for cow_ram0 as cow_ram0p1. However, the /dev/cow_ram0p1 file doesn't exist.

Has anyone experienced this before? If so, how'd you solve it?

It doesn't even have to be ramdisk specific. Has anyone ever had the /dev/ file not appear upon partitioning?


Now, for some details (don't want to get downvoted to oblivion):

The ramdisk is called cow_ram0. So I tried this first:
fdisk /dev/cow_ram0
I hit n for new partition.
Then, I just hit enter twice to get the first sector number at 2048 and the last one at whatever the last sector is.
Then I hit w to write all these actions.

Then I called lsblk. I don't see a partition for the ramdisk.
So I call partprobe and then kpartx -u /dev/cow_ram0 (calling both because partprobe didn't work, and ayy... I am looking into an Issue, so this won't go to master... redundancy won't hurt).
Now the lsblk output actually contains cow_ram0p1.
So I try to mount it, and I get a /dev/cow_ram0p1 file doesn't exist error.
I repeat the process above with parted -a opt /dev/cow_ram0 -t ext4 primary 0% 100% instead of the fdisk stuff above. Same result. Has anyone experienced this before?


Solution

  • Ok. The problem was I had forgotten to set a flag(max_part) in the kernel module when inserting it. Hopefully you, the reader, made the same mistake.