On Tue, Aug 18, 2015 at 12:46 AM, Loic Dachary <loic@xxxxxxxxxxx> wrote: > Hi Ilya, > > For regular devices such as /dev/vdb2 or /dev/sda3, do you think it is safe to use /sys/dev/block/M:m/partition to figure out the partition number ? Or could it vary depending on the disk driver or the partition table layout ? Or the kernel version ? Yes, I think it is. "partition" was added specifically for finding out partition numbers after extended devt scheme was merged, because it made it impossible to use arithmetic on minor numbers. That happened around 2.6.27 - 2.6.28, so it's a more recent one compared to others, but I don't think you care about anything pre 2.6.32. (You could choose not to rely on "partition" and access() "start" for figuring out if the thing is a partition - it's been around forever, but then, the only way to figure out the partition index would be to parse the name, which you want to avoid.) Thanks, Ilya -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html