LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-16-2007, 08:17 AM   #1
sachinh
Member
 
Registered: Jul 2004
Location: india
Distribution: RH
Posts: 189

Rep: Reputation: 30
disk usage ??


Hi Guys,

Is there any way to find out the disk usage on Linux System?? Wait ..let me finish first...

Need the total amount of disk utilised alongwith the total amount of disk assigned to partitions.

E.g.

df -k

Filesystem 1K-blocks Used Available Use% Mounted
/dev/sda2 10080520 1712060 7856392 18% /
/dev/sda1 101086 11165 84702 12% /boot

So we need the amount of

1. 10080520 + 101086=? i.e. Total of assigned 1K-blocks of / and /boot

and

2. 1712060 + 11165=? i.e. Total of Used / and /boot

We need this o/p for reporting purpose which will tell us the exact disk utilisation by all the linux systems in lan.
Is there any command/script to take this output??


Let me know if u still got any queries.
 
Old 11-16-2007, 08:39 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,805

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
"df" gives information only for partitions that are mounted. For the total disk configuration, you need "fdisk".

I don't know how you would do this for many computers on a LAN---except brute force: eg access each machine using SSH, and run commands as required
 
Old 11-16-2007, 08:48 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
The advice from pixellany is good, except for Used amount which is not provided by fdisk. If you are intersted in sums, you can explicitly do them by awk, e.g.
Code:
df -k | gawk '
/sda/{ tot_blocks+=$2 ;
       tot_used+=$3 }
END{ printf "Total 1K-blocks = %10u\n",tot_blocks ;
     printf "Total Used      = %10u\n",tot_used }'
This will look for all partitions of disk sda. You can customize the code for your needs (multiple disks, different output, etc).
 
Old 11-16-2007, 02:03 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,805

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
Quote:
Originally Posted by colucix View Post
The advice from pixellany is good, except for Used amount which is not provided by fdisk.
Correct---I don't know any way to get the utilization without mounting the partition.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
disk usage? crofty13 Linux - Software 1 10-18-2007 07:42 AM
Disk Usage kegwell Linux - Software 2 05-11-2005 11:59 AM
LQ disk usage student04 LQ Suggestions & Feedback 4 10-24-2004 10:35 PM
101% disk usage on an empty disk tsiuser Linux - Software 3 01-28-2004 07:24 PM
Disk Usage dvong3 Linux - Software 2 06-13-2003 01:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration