Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Linux supports a set of different disk label or partition table formats. For example, Sun Disk Labels and MS-DOS partition tables are both disk labels that contain (largely) the same information (partitioning) in different formats. Please note, I'm not referring to filesystems like ext{2,3,4} but disklabels like the msdos, GPT, Sun Disk Label, etc.

I'd like to add support for a disk label format that's not currently in the kernel, but it looks like (from browsing fs/partitions/) that these are built into the kernel itself, and can't be compiled as modules.

Is there any sort of kernel API I could use to add support for different disk labels?

Will I have to resort to losetup instead?

share|improve this question
up vote 3 down vote accepted

kpartx uses the device mapper tools to create devices over the underlying media; you should be able to implement your partition parser in userspace and create DM mappings that expose parts of the underlying system to the kernel as block devices.

That absolves you of all the complexity of in-kernel work, and should still support booting through an initramfs, if required.

share|improve this answer
Thanks! kpartx (and in fact dmsetup) will do the trick nicely, and most importantly without the need to reboot. – Alexios Feb 19 '12 at 8:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.