how to find the filesystem type of source of mount  point

Bvm 18
Bvm 18 used Ask the Experts™
on
Hi,

  aws efs mounted (nfs 4) on rhel 7.4.  On my machine, I have ~10 mounts. How do I find whether it is efs mounted from us-east-1 or other mounts?  Is there any function or systemcall to find out from c or c++? Already tried with statvfs and statfs calls.

Thanks,
Bvm
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Just run this command + parse the output.

mount

Open in new window


This will show you all mount points + mount point details.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Post your mount command output for more assistance.

Author

Commented:
xxxxxx.efs.us-east-1.amazonaws.com:/ on /mnt/efs-my-test-mount-point type nfs4 (rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=xxx.xx.x.x,local_lock=none,addr=yyy.yy.y.yy)

Open in new window

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

David FavorFractional CTO
Distinguished Expert 2018

Commented:
1) How do I find whether it is efs mounted from us-east-1 or other mounts?

mount | grep us-east-1

Open in new window


2) Is there any function or system call to find out from c or c++?

Better to use output from the mount command. If you think you must use C or C++, then look at source code of mount command for clues about how to accomplish this.

3) Already tried with statvfs and statfs calls.

Refer docs about whether stat or statvfs or statfs will provide info you're looking for... and... using the mount command will be far easier than trying to dig into system calls for this.

Author

Commented:
This is very specific to efs. In case, google cloud or any other cloud? it would be failed.

Looking for generic c++ api to find the file system type for third parties/ scalable storages.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
There is no generic C++ API for this. You'll call system level primitives for this information.

You'll have to go through docs to see which system call provides exact info you require... or... you can just run the mount command + parse mount output, which will likely be easier.

Doing all the internal math done by the mount command...

If I were going to do this, I'd just look at the mount command source code + extract the system calls + math I required for this.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial