Find the answer to your Linux question:
Results 1 to 2 of 2
Given the name of a mounted volume (e.g., /mnt/vol), how would I determine its capacity and available space in C? I've been googling for a while now and nothing jumps ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    37

    How to find available space in a volume?


    Given the name of a mounted volume (e.g., /mnt/vol), how would I determine its capacity and available space in C?

    I've been googling for a while now and nothing jumps out as the solution. I can use getmntent() to get the name of the actual partition that is associated with the mount point, e.g. /dev/sda2, but I can't figure out how to find the capacity of the volume nor how much space is remaining, such as what the df command shows.

    Is there an ioctl defined to get this information or some other system call?

  2. #2
    Just Joined!
    Join Date
    Nov 2010
    Posts
    37
    Found it--statfs(). That gives me what I need....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •