So as far as my system is concerned /dev/disk3s1 only exists when it
is mounted. This may be sufficient for the task that the OP had. Now I
will concede that it might not work how you might expect for other
devices. File.exists?("/dev/disk0s1") which is not in the df -h list
does return true as it is part of /dev/disk0s2. But the the OP didn’t
want to know if “/var/www/html” was mounted (or that the mount point
existed) just that “/dev/cciss/c0d1p1” was mounted, the example that
the OP gives would be true if “/dev/cciss/c0d1p1” was mounted to any
mount point not just “/var/www/html”.
As I’ve said File.exists?() might be a sufficient solution for the OP.
So as far as my system is concerned /dev/disk3s1 only exists when it
is mounted.
While the drive is inserted, type “umount /dev/disk3s1” and you will be
in a position where the disk exists but is not mounted. Ejecting via a
GUI filemanager is probably the same.
But the the OP didn’t
want to know if “/var/www/html” was mounted (or that the mount point
existed) just that “/dev/cciss/c0d1p1” was mounted, the example that
the OP gives would be true if “/dev/cciss/c0d1p1” was mounted to any
mount point not just “/var/www/html”.
Correct - which you can’t tell by looking at whether /dev/cciss/c0d1p1
exists.
But as you say, only the OP knows what solution they actually need.
Regards,
Brian.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.