Skip to contentSkip to conversation

ioctl to get partitions infos

DISCUSSION Ludovic Drolez 2 participants 2 messages Apr 17, 2003

lore
Share & tools
lore
#0 lore raw

Hi !

As I need more than 'cat /proc/partitions', I wondered if there's an ioctl in 2.4 or 2.5 which will kindly return me all the information the kernel knows about partition (start sector, length, type) ? (pls, don't say that I need the parse the partition table myself ;-( )

Regards,

Signature · 3 lines
Ludovic DROLEZ                                       Free&ALter Soft
152, rue de Grigy - Technopole Metz 2000                  57070 METZ
tel : 03 87 75 55 21                            fax : 03 87 75 19 26
#1 lore raw
Quoted 4 lines · Ludovic Drolez

As I need more than 'cat /proc/partitions', I wondered if there's an ioctl in 2.4 or 2.5 which will kindly return me all the information the kernel knows about partition (start sector, length, type) ? (pls, don't say that I need the parse the partition table myself ;-( )

There are ioctls that will tell you start sector and length. HDIO_GETGEO gives you start
BLKGETSIZE gives you length

I do not know what you mean by type, but the kernel doesn't know it.

(A partition may be found from a DOS-type or BSD-type or Amiga-type or ... partition table. Each has its own ways of indicating a type of partition. A partition can also be created by ioctl where no partition table is involved. Then there is no type at all. No type is used by the kernel, roughly speaking.)

Andries