1

I have a number of hard disks that use a proprietary partitioning system. The disks don't contain partition tables themselves, but each have a known number of partitions at fixed positions with fixed lengths. The last partition always extends until the end of the disk.

My Linux machine currently recognises the disk as /dev/sdb, but since this partitioning scheme is proprietary the individual partitions aren't recognised. I want to write a kernel driver to add support for these disks and their partition scheme, so that devices /dev/sdb1, /dev/sdb2 etc appear. Each disk has a header in a known fixed sector outside of the partitions which can be used to identify that the disk is one with this proprietary system, I want the driver to have a probe function that can detect when an applicable disk is attached and handle it just the same as a disk with an msdos or gpt partition table would be by the system.

Is this possible to handle in a kernel driver, or does it require patches to the kernel itself? If so, how does a driver like this work?

4
  • I know that this could be done on a disk-by-disk basis using loop devices, but this question is specifically about doing this through kernel drivers so these kinds of disks are supported in the same way any other partition table would be. Commented Aug 28, 2023 at 22:24
  • 1
    Download and inspect the source for other filesystem modules. They'll show you what to do. Also, learn about udev to handle recognizing the weird disks and invoking your module to provide the partition table. man -k udev Commented Aug 28, 2023 at 23:22
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Aug 30, 2023 at 17:58
  • 1
    @waltinator Filesystem modules don't handle partitioning. The various partition table detection functions are defined in <Linux kernel source>/block/partition/*.c files. These cannot be built as modules, partly because the detection functions are designed to run in a specific order to avoid false detections (e.g. GPT is detected before MBR to avoid misdetection of protective MBR as a real partition on GPT-partitioned disks). Commented Sep 1, 2023 at 5:48

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.