Occasional Contributor


I need to implement getting some of the device(sg/sd/ide/cciss) information in 2 methods. One using passthrough and an other using OS given info using the ioctls. In this regard I need the following info,

1. How do I issue a passthrough to a IDE/SATA device?

2. What ioctls can be used to get the WWID, serial no, capacity of devices not using the passthrough.
Honored Contributor

Re: Ioctls

In Linux 2.6 kernel series, the current recommended way to get passthrough access for *any* SCSI-like device (including IDE ATAPI) is to use the SG_IO ioctl.

For more information, see:

When using a passthrough, you must be able to use & understand the "raw" protocol used by the device, so it would be necessary to read the relevant SCSI and IDE ATAPI standards documents too.

With hardware RAID devices it's probably RAID controller-specific. Besides, when a hardware RAID is involved, something that looks like a single disk might actually be a collection of several physical disks - so a "serial number" of such a disk is likely to be generated by the RAID controller, and not necessarily related to the real serial number of any piece of hardware.

If the device is not a FibreChannel device or a modern SCSI device, the WWID may simply not exist.

The HDIO_ ioctls might be useful. For more documentation, get a copy of Linux kernel sources, then read linux-/Documentation/ioctl/hdio.txt file in the source package.