0

There is a path to the file, I make a write disk cache request via ioctl - ioctl(fd, SG_IO, &ioHdr).

printk: sending ioctl 2285 to a partition!? how to find out which block device a partition belongs to ? I want to replace partition path with path to disk.

1 Answer 1

0

In general, who says a partition belongs to a single block device? Often, it's something stretched across multiple disks using some sort of device manager, e.g. mdraid, lvm.

Anyways, if it is on a single block device:

You read /sys/block/nvme0n1/dev; this will give you a major:minor kind of information. Your "mother device" is then major:0; you can thus read /sys/dev/block/${major}:0/device to get the "canonical name" of the device.

If (and that's a strong if!) there's an entry in /dev, it's the one with the major,minor as ${major},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.