On 3/31/2010 10:50 AM, Karel Zak wrote: > IMHO the best way is to read /sys/block/<disk> or /etc/partitions > and call the ioctl for existing partitions only. > > The other (simple) way is to read /sys/block/<disk>/range where > kernel exports the maximal number of partitions for the disk. The header that defines the BLKPG ioctl indicates that there are supposed to be additional options besides add and delete. One of these options was supposed to be a way to enumerate the partitions on the disk. It seems this would be much better than poking around in /sys, but unfortunately it looks like none of the other commands were implemented in the kernel. Another BLKPG command was supposed to let you read the start and length of a given partition but since this was not implemented I had to patch parted to open the partition device itself and issue a HDIO_GETGEO ioctl to that instead. -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html