File system usage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File system usage
# 1  
Old 09-26-2014
File system usage

Hi Experts,

I am trying to write script to find the FS usage.

My requirement is first i need to gather all the mountpoint details.like below.
Code:
df -k 2> /dev/null | awk '{print "FS=" $1 "\tMP=" $6 "\tTOT(KB)=" $2 "\tUSED(KB)=" $3 }'

Then I need to find which FS is using space >10GB.some thing like this.
Code:
echo "Sub="`pwd` "\tSize(KB)"=`du -s| awk '{ print $1}'`

if it is greater than 10GB I need to list all files with size inside that directory.
Required output something like this
Code:
MP=/tmp
/tmp/file1   2.05G
/tmp/file2   3.5G
/tmp/file3   8.0G
MP=/var/
/var/f1 10G
/var/f2 12G


Last edited by rbatte1; 09-26-2014 at 01:37 PM.. Reason: Removed needless bold/colours and font from CODE blocks
# 2  
Old 09-26-2014
Quote:
Originally Posted by navsan420
Hi Experts,

I am trying to write script to find the FS usage.

My requirement is first i need to gather all the mountpoint details.like below.
Code:
df -k 2> /dev/null | awk '{print "FS=" $1 "\tMP=" $6 "\tTOT(KB)=" $2 "\tUSED(KB)=" $3 }'

Then i need to find which FS is using space >10GB.some thing like this.
Code:
echo "Sub="`pwd` "\tSize(KB)"=`du -s| awk '{ print $1}'`

if it is greater than 10GB i need to list all files with size inside that directory.
Required output something like this
Code:
MP=/tmp
/tmp/file1   2.05G
/tmp/file2   3.5G
/tmp/file3   8.0G
MP=/var/
/var/f1 10G
/var/f2 12G

Hello navsan420,

You can try following for same.

Code:
df -hP | awk '($3 ~ /G/){A=$NF;gsub(/G/,X,$3); if($3 > 10){print "MP="A ;system ("du -h " A)}}''

Thanks,
R. Singh

Last edited by RavinderSingh13; 09-26-2014 at 09:04 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Berkeley version bdf: combination of inode and file system usage

hello, i need a command like "bdf" of HP-UX. ( report number of free disk blocks (Berkeley version) ). it should report inode and file system usage in one line like bdf -i manpage : Man Page for bdf (all Section 1m) - The UNIX and Linux Forums HP-UX command "" report inode and file... (2 Replies)
Discussion started by: bora99
2 Replies

2. Linux

System Went panic after CPU usage high

Hi All, Yesterday my Linux server went panic and even a small command took a lot of time to run. When i monitored pl find the below output Cpu(s): 0.1%us, 98.4%sy, 0.0%ni, 1.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st the time spent on kernel mode is 98 % and also idle time is around 1.5 %...... (4 Replies)
Discussion started by: jegaraman
4 Replies

3. Ubuntu

High System CPU Usage

I am running a Dell PE R815 with 4 x AMD 12 core CPUs with 128GB of RAM and a RAID 5 array of 6 SAS disks. This is an HPC application and is definitely CPU bound, however once I run 16 of these processes (thus pinning 16 cores) the work performed slows down dramatically, to maybe 5 or 10% of what... (2 Replies)
Discussion started by: mowmentous
2 Replies

4. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

5. Red Hat

File system and its usage

HI all, Can anybody send me some useful links or explain about file system and its usage.As i want to know before using it. Actually, i am going to install linux and then planning to install oracle on it. OS -- Red hat linux 8.0 Regards, Willaim (2 Replies)
Discussion started by: William1482
2 Replies

6. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

7. AIX

system usage list

Hi, I would like to produce a list of system usage for each process, if I use 'ps v' it can only show one process a time, i.e. ps v 20876 PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND 20876 - A 0:00 0 4752 43556 32768 27289 38724 0.0 5.0... (2 Replies)
Discussion started by: victorcheung
2 Replies

8. UNIX and Linux Applications

The usage of mount file system of different servers

There is a file system in server1 which is mounted on different file system on server2. Filesystem kbytes used avail capacity Mounted on server1:/users/user1 7047581 5994192 982914 86% /u01 /data/datafiles/user1 The data in... (1 Reply)
Discussion started by: vamshikrishnab
1 Replies

9. AIX

System usage check

Hi , i have been usning AIX unix ,besides sar and topas what are the other commands thru which we could see the resource utilisation and CPU usage. thanks pushkar (3 Replies)
Discussion started by: pushkar.verma
3 Replies

10. UNIX for Dummies Questions & Answers

How to get system memory usage like top

Hello all im working on sunos machine that dont have the top installed and can't be install , now i need to get information similar to what top gives me about the cpu usage and so can it be done somehow else where ? (3 Replies)
Discussion started by: umen
3 Replies
Login or Register to Ask a Question