Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: Check that a ramdisk is mounted

by jcb (Parson)
on May 18, 2021 at 01:19 UTC ( [id://11132704] : note . print w/replies, xml ) Need Help??

in reply to Re: Check that a ramdisk is mounted
in thread Check that a ramdisk is mounted

Rather than trying to guess what device numbers mean what (which will vary between systems and even versions of the "same" system, especially with modern Linux kernels where /dev is assumed to be a RAM filesystem populated at boot), the better way to determine what is on a mountpoint is to examine the output returned by qx/mount/. This will allow you to easily determine if a mountpoint is a RAM filesystem, but there is no one reliable way to determine if a physical block device is actually a RAM disk, especially a hardware device, which may even be relatively non-volatile with battery-backed storage or an SSD that can retain data with no power at all.

I suspect that our questioner is concerned with ensuring that a RAM filesystem has been mounted before some daemon begins its work. In this case, there is a bit of an XY problem here: the real concern is that a filesystem has been mounted on the designated directory, since other configuration ensures that that filesystem will be the intended RAM filesystem.