1748182 Members
3542 Online
108759 Solutions
New Discussion

Re: mounted devices

 
mpradhan
Advisor

mounted devices

Hello,

I am looking for CTRL routine to enumerate ONLY mounted devices, along with their volume lables (basically extended information, like show devices/mounted).

I have seen sys$device_scan and some examples of it, but couldnt find how to find device status and volume label.

 

Thanks for the help,

Manoj

5 REPLIES 5
Steven Schweda
Honored Contributor

Re: mounted devices

> I have seen sys$device_scan and some examples of it, but couldnt find
> how to find device status and volume label.

   $DEVICE_SCAN (sys$device_scan()) has rather limited filtering
capabilities.  If you want to be more selective, then I believe that you
want to use $GETDVI (sys$getdvi()) to get more information about each
device, and do your own filtering.

    There's some (probably sub-optimal) code (which checks for mounted
and mounted foreign) here:
       http://antinode.info/ftp/qreadcd/qreadcd.c

(Could all have been done using one call with a longer item list?)

   For volume label:
       http://antinode.info/ftp/misc/vol_lab_ss.c


http://h71000.www7.hp.com/doc/84final/4527/4527pro_contents.html
http://h71000.www7.hp.com/doc/84final/4527/4527pro_051.html#get_dev_vol

Hoff
Honored Contributor

Re: mounted devices

The CRTL on OpenVMS has no concept of this sort of thing — this is available only via system service calls.

You're also potentially headed toward some trouble here, as disks can be mounted on some nodes in a cluster and not on others, and disks can be mounted more than once on the local system.   See DVI$_MOUNTCNT and DVI$_MOUNTCNT_CLUSTER, too.   Some application programs written in areas related to your question can be a little more subtle than might initially be realized.  Put another way, what are you up to here?   The OpenVMS version also helps, as some itemcodes — such as that latter one — can require V8.3-1H1 or later, if you don't luck into a backport somewhere.) 

Here's the basic logic in DCL (example, example, etc.   Also see the SYS$EXAMPLES:MSCPMOUNT.COM examples.)  This shows the calls and the itemcodes that can be used.

The volume name is available via DVI$_VOLNAM.

And for background, there are resources: C programming specific to working on OpenVMS or if you want system service examples.  Most system services are similar, so learning the argument passing for one will provide examples of many other calls — there's no longer any large catalog of service-specific examples posted at HPE and VSI hasn't gotten around to providing that.  But some of the VMS-isms such as string descriptors can look quite unexpected to anybody accustomed to passing null-terminated strings around in C as is more typical on most platforms.

 

 

mpradhan
Advisor

Re: mounted devices

I want to enumerate only mounted disks on a given node and get their volume lables. 

Steven Schweda
Honored Contributor

Re: mounted devices

> I want to enumerate only mounted disks on a given node and get their
> volume lables.

   Understood.  What's stopping you?

> I have seen sys$device_scan and some examples of it, but couldnt find
> how to find device status and volume label.

   And you now have examples of sys$device_scan() and sys$getdvi(),
which should be enough to do this job (as I understand it).  What else
do you need?

Hoff
Honored Contributor

Re: mounted devices


@mpradhan wrote:

I want to enumerate only mounted disks on a given node and get their volume lables. 


Which is essentially what was included in the original question.   Again, where this can get into trouble is with disks that may not be in the state the developer might have expected; disks mounted privately, disks mounted remotely, multiple mounts of the same device, different sorts of file systems, disks stuck in dismount, etc.

The background that was requested earlier is why you want to do this; to what end?   (Properly elucidating the what and the why is where more than a few software product documents and release notes tend to fail to pass muster, too.  But I digress.)

Given your other recent postings here, you're working on HPE or third-party add-on system backup software, and these tools involve rather more than just detecting the volume labels.  For these and other similar apps, the volume structures and volume states are of interest — ODS-2, ODS-5, ISO-9660, NFS, and whatever VSI is cooking up for their new file system, for instance — and the system may (or will) want to have some idea of locality of mount, for instance.  Trying to run a backup on a served volume tends to have poor performance compared with a local backup, for instance.   This in addition to managing the file locking — overriding that tends to get data that's somewhere between inconsistent and corrupt — and other related details that have been previously discussed.