Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux: search for more than 26 devices #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

keithbusch
Copy link

The devices sda through sdz are not enough to cover many storage servers. Match the device handle names that scsi generates after the first 26 devices, too. This gets to a total of 702 possible drives, which ought to be enough for a while.

The devices sda through sdz are not enough to cover many storage
servers. Match the device handle names that scsi generates after the
first 26 devices, too. This gets to a total of 702 possible drives,
which ought to be enough for a while.

Signed-off-by: Keith Busch <[email protected]>
@keithbusch
Copy link
Author

Is this project still maintained? I hope so since we're using it, but we might have to start migrating to a different solution else if not.

@Blacklands
Copy link

Blacklands commented Sep 23, 2024

As you can see from the commits (nothing on main, develop gets some rare non-descriptive commits I guess), the lack of comments by the developers on issues, the non-existence of recent releases, zero pull requests getting merged... it's not really being maintained, I would personally argue. You can look at forks, but I don't know if there's any active fork that more than a single private person is occasionally working on.

If you find a different solution, it would be nice to know what it is! I'm still looking for an alternative myself that can do what sedutil can do and is also open-source...

EDIT: It seems that some work is being done here again! :)

@keithbusch
Copy link
Author

Yeah, that's what it looks like. I think sg3utils is the closest project that is actively maintained, though I think it may take some work to port sedutil features to there.

@scottcmarks
Copy link

This is in the feature/pyrite branch, going into 1.49.7. It's used by driveScan and others in the updated code.
Just asks Linux which /dev items are root SCSI or NVMe devices.

std::vector<std::string> DtaLinux::generateDtaDriveDevRefs()
{
  std::vector<std::string> devrefs;

  DIR *dir = opendir("/dev");
  if (dir==NULL) {
    LOG(E) << "Can't read /dev ?!";
    return devrefs;
  }

  struct dirent *dirent;
  while (NULL != (dirent=readdir(dir))) {
    std::string devref=std::string("/dev/")+dirent->d_name;

    struct stat s;
    stat(devref.c_str(), &s);
    // LOG(E) << devref
    //        << " st_ino:" << HEXON(4) << s.st_ino
    //        << " st_dev:" << HEXON(4) << s.st_dev
    //        << " st_rdev:" << HEXON(4) << s.st_rdev
    //        << " st_rdev>>8:" << HEXON(4) << (s.st_rdev>>8)
    //        << " st_rdev&0xF:" << HEXON(4) << (s.st_rdev & 0x000F)
    //   ;
    const unsigned long device_type=s.st_rdev >> 8;
    const unsigned char device_part=s.st_rdev & 15;
    typedef enum _rdev_type {
      SCSI_DRIVE=8,
      NVME_DRIVE=259,
    } rdev_type;
    if (device_part==0 &&
        (device_type==rdev_type::SCSI_DRIVE ||
         device_type==rdev_type::NVME_DRIVE)) {
      // LOG(E) << devref << " accepted."
      //   ;
      devrefs.push_back(devref);
    }

  }

  closedir(dir);

  std::sort(devrefs.begin(),devrefs.end());

  return devrefs;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants