10-16-2001
You can use the statvfs() system call to get statistics about file systems. That's the one to use.
Your os may support earlier system calls like statfs() or ustat(). I would avoid these and use the more modern statvfs().
10 More Discussions You Might Find Interesting
1. Programming
Does anyone know any C code to get the remaining disk space ? (2 Replies)
Discussion started by: spu230479
2 Replies
2. HP-UX
My HP9000 has 10 disks of 9.1 GB each.
With help of the fpmurphy (thank you) it is knowing that 8 of them are mirrored (using lvdisplay).
What should i do to know which is the existent free space after mirroring.
Regards (1 Reply)
Discussion started by: cgege
1 Replies
3. Linux
i want to access mounted/mapped drive in linux using C code
is it possible to access the mapped drive in linux using C code ?
waiting for replay
NIrav (0 Replies)
Discussion started by: niravuchat
0 Replies
4. Shell Programming and Scripting
I would like to create a script for calculating size and remaining space of a directory automatically every 24 hours, then send an email to report to the admin.
* POSIX and PERL are preferred.
Can anyone help, please? (1 Reply)
Discussion started by: leonall
1 Replies
5. UNIX for Dummies Questions & Answers
Hi,
Is their an easy way to realloate hard drive space on Solaris 10.
For example :
/c20td0 10G
/space 90 G
I would like to move some of the hard-drive space from "/space" and add it to "/c20td0". In Windows this can be easily done using Partition magic, anything similar for UNIX? (4 Replies)
Discussion started by: annointed3
4 Replies
6. UNIX for Dummies Questions & Answers
Sorry if this is totally the wrong place to post this but I have a question or something rather thats bugging me. I got a new Dell Inspiron laptop the other day and I was expecting it to have 80G on it, well atleast 70 or so after installation of OS and such but after looking carefully yesterday, I... (8 Replies)
Discussion started by: Ecclesiastes
8 Replies
7. Solaris
I have 2 hard disks ,one hard disk(40gb) completely for windows Os,and the other(120gb) for solaris Os.
In the second hard disk.I have utilised around 10gb for the solaris installation and also partitioned with the available 10gb space for the solaris x86 OS.
Now i need to utilise the... (8 Replies)
Discussion started by: jayaprakash
8 Replies
8. Shell Programming and Scripting
I'm new to Linux and have very limited experience with shell scripts in general. I am taking a class and I have to research online and come up with a shell script that monitors disk space. I also have to be able to explain it line by line. I've researched various sites and came across this shell... (3 Replies)
Discussion started by: wgreg23
3 Replies
9. SCO
Dear all
I would like to know if you have face to the problems as add
1. 256 MB DDR Ram memory
2. IDE 40 GB slaved hard-disk
my current machine is GA-SIML Rev 1.0, 1.6 GHz CPU, 1GB HDD, 256 MB DDR-Ram memory, as I add another 256 DDR-Ram, and 40 GB Slaved EDI Hard disk it, the systems... (1 Reply)
Discussion started by: TinhNhi
1 Replies
10. Fedora
Hi,
I run Fedora 17.
I created a physical volume of 30GB on a disk with 60GB of space so there is 30GB of free space. On the physical volume, I created my volume group and logical volumes. I assigned all the space in the physical volume to my volume group. I need to add the 30GB of free space... (1 Reply)
Discussion started by: mojoman
1 Replies
LEARN ABOUT DEBIAN
statvfs
STATVFS(3) Linux Programmer's Manual STATVFS(3)
NAME
statvfs, fstatvfs - get file system statistics
SYNOPSIS
#include <sys/statvfs.h>
int statvfs(const char *path, struct statvfs *buf);
int fstatvfs(int fd, struct statvfs *buf);
DESCRIPTION
The function statvfs() returns information about a mounted file system. path is the pathname of any file within the mounted file system.
buf is a pointer to a statvfs structure defined approximately as follows:
struct statvfs {
unsigned long f_bsize; /* file system block size */
unsigned long f_frsize; /* fragment size */
fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
fsblkcnt_t f_bfree; /* # free blocks */
fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */
fsfilcnt_t f_files; /* # inodes */
fsfilcnt_t f_ffree; /* # free inodes */
fsfilcnt_t f_favail; /* # free inodes for unprivileged users */
unsigned long f_fsid; /* file system ID */
unsigned long f_flag; /* mount flags */
unsigned long f_namemax; /* maximum filename length */
};
Here the types fsblkcnt_t and fsfilcnt_t are defined in <sys/types.h>. Both used to be unsigned long.
The field f_flag is a bit mask (of mount flags, see mount(8)). Bits defined by POSIX are
ST_RDONLY
Read-only file system.
ST_NOSUID
Set-user-ID/set-group-ID bits are ignored by exec(3).
It is unspecified whether all members of the returned struct have meaningful values on all file systems.
fstatvfs() returns the same information about an open file referenced by descriptor fd.
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EACCES (statvfs()) Search permission is denied for a component of the path prefix of path. (See also path_resolution(7).)
EBADF (fstatvfs()) fd is not a valid open file descriptor.
EFAULT Buf or path points to an invalid address.
EINTR This call was interrupted by a signal.
EIO An I/O error occurred while reading from the file system.
ELOOP (statvfs()) Too many symbolic links were encountered in translating path.
ENAMETOOLONG
(statvfs()) path is too long.
ENOENT (statvfs()) The file referred to by path does not exist.
ENOMEM Insufficient kernel memory was available.
ENOSYS The file system does not support this call.
ENOTDIR
(statvfs()) A component of the path prefix of path is not a directory.
EOVERFLOW
Some values were too large to be represented in the returned struct.
CONFORMING TO
POSIX.1-2001.
NOTES
The Linux kernel has system calls statfs(2) and fstatfs(2) to support this library call.
The current glibc implementations of
pathconf(path, _PC_REC_XFER_ALIGN);
pathconf(path, _PC_ALLOC_SIZE_MIN);
pathconf(path, _PC_REC_MIN_XFER_SIZE);
respectively use the f_frsize, f_frsize, and f_bsize fields of the return value of statvfs(path,buf).
SEE ALSO
statfs(2)
COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2003-08-22 STATVFS(3)