Sponsored Content
Top Forums Programming How to get free disk space size in C/C++ program( Solaris system) Post 302130621 by prasad11 on Tuesday 7th of August 2007 05:26:20 AM
Old 08-07-2007
Error need to help to test in linux

hi,

i have written the code to find free space for linux using native code of java like below.

#include <sys/statvfs.h>

JNIEXPORT jlong JNICALL Java_NativeUtils_getDiskFreeSpace
(JNIEnv *env, jclass obj, jstring path) {
struct statvfs fiData;
struct statvfs *fpData;
//char fnPath[128];
int i;
const char *str = (*env)->GetStringUTFChars(env, path, 0);
jlong ret;

if((statvfs(str,&fiData)) < 0 ) {
printf("Failed to stat %s:\n", str);
} else {
printf("\tblock size: %u\n", fiData.f_bsize);
}
(*env)->ReleaseStringUTFChars(env, path, str);
ret = (jlong)fiData.QuadPart;
return ret;
}

if any person is having the linux os and can u please test and get back to me

thanks,
prasad
 

10 More Discussions You Might Find Interesting

1. Programming

free disk space calc

I everybody!! How can i use statvfs() to calculate disk usage and free disk space?? Im using this code: /* Any file on the filesystem in question */ char *filename = "/home/nesto/test/test.cpp"; struct statvfs buf; if (!statvfs(filename, &buf)) { ... (1 Reply)
Discussion started by: ninjanesto
1 Replies

2. Solaris

command to find free disk space on solaris

In linux df is the command to find free space what is the equivalent command in the Solaris (2 Replies)
Discussion started by: harishankar
2 Replies

3. AIX

AIX Free disk space

Hello, I would like to free some space to install gcc with is about 50M large, and I have no free space on my system. What can I delete? Filesystem 1024-blocks Used Free %Used Iused Ifree %Iused Mounted on /dev/hd4 262144 145436 116708 56% 7981 ... (10 Replies)
Discussion started by: aixn00b
10 Replies

4. Solaris

command to get the total disk space (available + free)

is there a command to get the total disk space (available + free) on the solaris server ? thanks (3 Replies)
Discussion started by: sudhiroracle
3 Replies

5. Solaris

Disk free space planning for Sol 10 LU

I'm getting ready to start a LU from Sol 9 to Solaris 10. I want to ensure that I have enough disk space for future upgrades. What I don't know is what free space Solaris requires. If I have 10GB of free space in /opt, will Solaris 10 use that for a LU? Or, do I need to allocate 10GB of space... (5 Replies)
Discussion started by: zeekstern
5 Replies

6. Solaris

free size of disk group

Hello Good morning all, Am not understanding the size of subdisk & group(length &offset).how we need to calculate this? Can anyone suggest me ? Thanks, Gowtham ---------- Post updated at 12:48 PM ---------- Previous update was at 08:30 AM ---------- I got the answer ... if want the... (0 Replies)
Discussion started by: gowthamakanthan
0 Replies

7. Shell Programming and Scripting

Free space at disk

Hi, I would like to create the new file system(mount point) in our unix server. before that i would like to know the total free space available in /home directory. Can you please let me know, how to find free space available for new filesystem? Be careful with your spelling and... (2 Replies)
Discussion started by: koti_rama
2 Replies

8. Solaris

Determine free space in a Disk device

Version: Solaris 10 (August 2011) on VM I am kind of new to Solaris.From VM workstation i allocated 35 GB to this Solaris VM's Disk The disk was named c1t0d0 Few basic slices for root(8gb), swap(517mb) and /export/home(494mb) were created by the solaris Installer during the... (18 Replies)
Discussion started by: polavan
18 Replies

9. Shell Programming and Scripting

I need help!! disk free space script

i want to write a shell script,when disk uses is 90% then automatically send a email to distribution list (group member)...... (1 Reply)
Discussion started by: sonu pandey
1 Replies

10. Solaris

Check free disk space in server

Hi, I need about 500G space in one corporate solaris server. However, I am not sure which command to use to check this. There are few volume groups in the server, and I deleted unused, old volume groups to clear some space. However, now I am not sure how to check the free space itself. ... (2 Replies)
Discussion started by: anaigini45
2 Replies
newfs(8)						      System Manager's Manual							  newfs(8)

Name
       newfs - construct a new file system

Syntax
       /etc/newfs [ -N ] [ -n ] [ -v ] [ mkfs-options ] special disk-type

Description
       The command is a front-end to the program.  The program looks up the type of disk a file system is being created on in the disk description
       file calculates the appropriate parameters to use in calling then builds the file system by forking If the file system is a root partition,
       installs the necessary bootstrap program in the initial 16 sectors of the device.

       If there is no disk description for the specified disk type in the file, the program will use the subroutine to derive disk geometry infor-
       mation from the controlling device driver.  This functionality is provided for MSCP and SCSI disks.

Options
       -N	 Runs in no update mode.  In this mode, will not write to

       -n	 Prevents the bootstrap program from being installed.

       -v	 Instructs to print out its actions, including the parameters passed to

       Options which may be used to override default parameters passed to are:

       -s size	 The size of the file system in sectors.

       -b block-size
		 The block size of the file system in bytes.

       -f frag-size
		 The fragment size of the file system in bytes.

       -t #tracks/cylinder
       -c #cylinders/group
		 The number of cylinders per cylinder group in a file system.  The default value used is 16.

       -m free space %
		 The percentage of space reserved from normal users; the minimum free space threshold.	The default value used is 10%.

       -o optimization
		 Specifies whether the file system will optimize for space or for time.

       -r revolutions/minute
		 The speed of the disk in revolutions per minute (normally 3600).

       -S sector-size
		 The size of a sector in bytes (almost never anything but 512).

       -i number of bytes per inode
		 This specifies the density of inodes in the file system.  The default is to create an inode for each 2048 bytes  of  data  space.
		 If fewer inodes are desired, a larger number should be used; to create more inodes a smaller number should be given.

Files
       For disk geometry and file system partition information

       To actually build the file system

       For boot strapping program

See Also
       disktab(5), fs(5), chpt(8), fsck(8), format(8v), creatediskbyname(3x), mkfs(8), tunefs(8)
       "A Fast File System for UNIX", Supplementary Documents, Volume 3: System Manager

																	  newfs(8)
All times are GMT -4. The time now is 11:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy