Author Topic: How to obtain number of disk drives (not partitions) attached to system?  (Read 1244 times)

Pete

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 36
  • Posts: 851
    • View Profile
Hi All

I had a look at using DosPhysicalDisk but that seems to return almost the number of partitions available rather than disks.


Regards

Pete

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 35
  • Posts: 1029
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #1 on: November 04, 2019, 08:29:05 pm »
Hi Pete,

In what form do you want that information?

If you want to know how many disks then the first page of Sysinfo/2 will tell you.  I don't think that RMVIEW gives the actual disks with the /HW switch.

Pete

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 36
  • Posts: 851
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #2 on: November 04, 2019, 09:12:13 pm »
Hi ivan

I was looking to do this with some code.

On thinking a little more about the problem I realised I could simply check what the loaded driver shows. As I am only interested in PATA/SATA drives I can simply run

Copy IBM1S506$ PATA.txt

and

Copy OS2AHCI$ SATA.txt

Then parse the resulting files to find out what, if any, disks are controlled by the driver.


Still interested in knowing if there is a c/c++/pascal function that returns the number of disks attached rather than almost the number of partitions available to the system.


Regards

Pete

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 35
  • Posts: 1029
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #3 on: November 04, 2019, 09:57:59 pm »
Hi Pete,

The following is from the Sysinfo/2 readme;

                         Alexey Smirnov SysInfo/2 - Beta 0.8.26
                        -------------------------------------

NAME
        SysInfo.exe  -  OS/2 PM System Information utility, a ground-up clone of
        the Symantec NU for Win 95/NT SysInfo concept.

SYNOPSIS
        SysInfo/2 is a useful PM tool for any person who wants to know
        more about their machine and understand how OS/2 uses the
        hardware resources of their PC.  It is doesn't contain *any*
        Symantec code (except of some grabbed pictures ;-), In the future, I
        will replace these with my own)

DESCRIPTION
        Because the original system information and analyse tools
        provided by IBM and other manufacturers are less informative, I
        wanted to fill this "outer space" by writing my own PM tool in
        accordance with a modern view on the requirements.

        SysInfo/2 was written using SpeedSoft Sibyl compiler
        (evaluation copy ;-)). To collect information about running
        processes and memory utilization IBM Theseus API was used.

        List of features:
         1st page - total information material:
                - CPU & FPU type and quantity,
                - BIOS information,
                - Memory amount and utilization,
                - System Bus information,
                - HDD information,
                - Floppy info,
                - Video subsystem info,
                - MMOS2 (Multimedia) info,
                - LPT and Com port info,
                - OS/2 version,
                - Fixpack level,
                - DOS, WinOS/2, Win32s support.
---------------------------------------------------------------------

Since it is written in SpeedSoft Sibyl you might be able to find something that will do what you want.

roberto

  • Sr. Member
  • ****
  • Thank You
  • -Given: 16
  • -Receive: 10
  • Posts: 475
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #4 on: November 04, 2019, 10:48:13 pm »
Hello Pete
Maybe it will serve you
LVM /QUERY

Saludos

Laurence Pithie

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #5 on: November 05, 2019, 04:01:48 am »
The LVM toolkit has the  Get_Drive_Control_Data function which does what you want.
http://www.altsan.org/os2/toolkits/lvm/lvmref/LVMREF.html
The number of drives is returned in the Count field.

Pete

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 36
  • Posts: 851
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #6 on: November 07, 2019, 08:35:33 pm »
Hi All

Thanks for the suggestions.

In the end I went with querying the IBM1S506$ and OS2AHCI$ files as it seems to be the only way to ascertain how many of what type of ?ATA disks are attached and to which ports.


Regards

Pete


Andreas Schnellbacher

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 24
  • Posts: 440
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #7 on: November 08, 2019, 11:46:19 pm »
Interesting. The log is named here ibms506$, without the '1'.

Pete

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 36
  • Posts: 851
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #8 on: November 09, 2019, 02:21:36 am »
Hi Andreas

Yes, Sorry, my typo...


Regards

Pete

Remy

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 12
  • Posts: 193
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #9 on: November 09, 2019, 08:19:16 pm »
Under rexx, you have rxlvm
RxLvmGetDisks   Gets a list of all physical disk drives recognized by the system

Pete

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 36
  • Posts: 851
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #10 on: November 09, 2019, 08:41:48 pm »
Hi Remy

Does RxLvmGetDisks also return the type of disks - PATA or SATA - and port numbers in use?


Regards

Pete



Remy

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 12
  • Posts: 193
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #11 on: November 10, 2019, 01:48:47 pm »
Hi Remy

Does RxLvmGetDisks also return the type of disks - PATA or SATA - and port numbers in use?


Regards

Pete


Hi Pete

rxlvm inf extrat:

Parameters

stem
The name of the stem variable in which the list of disks will be stored. After RxLvmGetDisks returns successfully, stem.0 will contain an integer n, indicating the number of disks found; and stem.1 through stem.n will each contain data describing a single disk, in the format:

handle number size unuseable corrupt removeable serial name

The meanings of the various fields are:   

handle The disk's handle (a unique 8-digit hexadecimal string).   

number The number assigned to the disk drive by LVM. This is a positive integer, where 1 represents the first disk.   

size The total size of the disk, in megabytes (1 megabyte = 1,048,576 bytes).   

unuseable A flag indicating whether the disk drive is reported "unuseable" (i.e. inaccessible) by LVM. This is one of the following values:

0 The disk drive is useable
1 The disk drive is currently being reported as unuseable   

corrupt A flag indicating whether the disk drive has a corrupted partition table (as reported by LVM). This is one of the following values:

0 The partition table is correct
1 The partition table is being reported as corrupt   

removeable This flag indicates whether or not the disk drive is a removeable media device. This is one of the following values:

0 Normal disk drive
1 Partitionable removeable media device
2 "Big floppy" type removeable media (e.g. LS-120 super-diskette)   

serial The serial number reported by the disk drive. This is an integer value.   

name The disk's name. This is a string of up to 20 characters, and may contain spaces and punctuation marks.
 

Returns

RxLvmGetDisks returns 1, or an LVM error message.   


Example

  qd = RxLvmGetDisks("disks.")
  IF LEFT( qd, 6 ) == 'ERROR:' THEN DO
      PARSE VAR qd 'ERROR: ' lvm_error
      SAY 'LVM.DLL returned error code' lvm_error
      RETURN lvm_error
  END
  SAY disks.0 'disks found:'
  DO i = 1 TO disks.0
      SAY '   ' disks.i
  END


The following is a sample of output from the example above:

  3 volumes found:
      FC047717 1 156327 0 0 0 890692272 [ D1 ]
      FC047767 2 156327 0 0 0 700276006 [ D2 ]
      FC0477B7 3 0 1 0 1 0 [ D3 ]


The RxLvmGetVolumes( stem ) provides the device type (for the volume and not disk)
device The type of device on which the volume resides. This is one of the following values:

HDD Hard disk drive
PRM Partitionable removeable media
CD CD/DVD drive (not controlled by LVM)
LAN LAN drive (not controlled by LVM)
? Unknown device type (not controlled by LVM)   

Regards
Rémy

Alex Taylor

  • Sr. Member
  • ****
  • Thank You
  • -Given: 10
  • -Receive: 17
  • Posts: 274
    • View Profile
Re: How to obtain number of disk drives (not partitions) attached to system?
« Reply #12 on: November 10, 2019, 04:46:13 pm »
Does RxLvmGetDisks also return the type of disks - PATA or SATA - and port numbers in use?

No.  That is not information the LVM engine provides (or cares about), as it takes place at a lower level in the OS.  The only distinctions LVM cares about are partitionable DASD, removable DASD, or non-LVM-managed device.