Operating System - HP-UX
1833758 Members
2501 Online
110063 Solutions
New Discussion

Is the filesystem a CD-Rom?

 
Sylvain CROUET
Respected Contributor

Is the filesystem a CD-Rom?

Hi.

I would like to know if a mounted filesystem is a CD-ROM or not, for HP-UX, Sun Solaris and AIX.
'diskinfo' seems to be fine for HP-UX but it takes time and do not exists on Solaris.
9 REPLIES 9
Simon Hargrave
Honored Contributor

Re: Is the filesystem a CD-Rom?

I presume you want to do this programatically?

diskinfo shouldn't take time. But you can use ioscan to determine if a particular device file is a CD-ROM device, eg: -

% ioscan -fnk /dev/dsk/c1t2d0
Class I H/W Path Driver S/W State H/W Type Description
===================================================================
disk 5 16/5.2.0 sdisk CLAIMED DEVICE TOSHIBA CD-ROM XM-5401TA
/dev/dsk/c1t2d0 /dev/rdsk/c1t2d0


The -k option means it's quick as it doesn't actually rescan, just reads the kernel.

Another (crude) option is to use the "mount" command to see if the filesystem is mounted "ro" (read only). This isn't foolproof though as normal filesystems can also be read-only.
Jeff_Traigle
Honored Contributor

Re: Is the filesystem a CD-Rom?

Might be other ways, but the one that comes to mind immediately is "mount -v".
--
Jeff Traigle
Robert-Jan Goossens
Honored Contributor

Re: Is the filesystem a CD-Rom?

http://www.unixguide.net/unixguide.pdf

if you have volmgt volume management running on your solaris box, cdrom's are auto mounted

Regards,
Robert-Jan
Helen French
Honored Contributor

Re: Is the filesystem a CD-Rom?

Try 'fstyp -v' command if thats what you are looking for. man fstyp(1M) for details.
Life is a promise, fulfill it!
doug mielke
Respected Contributor

Re: Is the filesystem a CD-Rom?

another possibility is to do a bdf (df on other systems) and grep for '100%'

While there is a small chance that other filesystems may be 100% full, a CD is always full.
Muthukumar_5
Honored Contributor

Re: Is the filesystem a CD-Rom?

You can all mounted file systems as,

# for fs in `bdf | awk '{ if ($1!="Filesystem") print $1 }'`
> do
> /usr/sbin/fstyp $fs
> done

It will give every file system informations, with that you can get cdrom whether mounted / or not.

HTH.
Easy to suggest when don't know about the problem!
Sylvain CROUET
Respected Contributor

Re: Is the filesystem a CD-Rom?

In fact the fstyp command is the good one, but I did not know before reading the unixguide.pdf that there was a different fs type for CD-Rom, nor the corresponding type.

Sorry for not assigning enough points to Shiju and Muthukumar.
Sylvain CROUET
Respected Contributor

Re: Is the filesystem a CD-Rom?

I do not find the fstyp command for AIX. What is the corresponding command for this OS?
Charles G.
Honored Contributor

Re: Is the filesystem a CD-Rom?

Sylvain,

On AIX, you can use mount, the command will list all mounted filesystems and their type in the vfs column, CDs are cdrfs type :

# mount
node mounted mounted over vfs date options
-------- --------------- --------------- ------ ------------ ---------------
/dev/hd4 / jfs2 Sep 22 17:46 rw,log=/dev/hd8
/dev/hd2 /usr jfs2 Sep 22 17:46 rw,log=/dev/hd8
/dev/hd9var /var jfs2 Sep 22 17:46 rw,log=/dev/hd8
/dev/hd3 /tmp jfs2 Sep 22 17:46 rw,log=/dev/hd8
/dev/hd1 /home jfs2 Sep 22 17:48 rw,log=/dev/hd8
/proc /proc procfs Sep 22 17:48 rw
/dev/hd10opt /opt jfs2 Sep 22 17:48 rw,log=/dev/hd8
/dev/cd0 /cdrom cdrfs Oct 21 11:07 ro