Solved

How to predict df resutls on different machines?!

Posted on 2006-10-20
4
209 Views
Last Modified: 2010-04-20


Hello all,
Let's consider a scenario:

1) User is going to transfer   /usr/local  from Machine A onto Machine B.
2) Obviously, the first thing, would be comparing the size of data  on Machine A to available room on Machine B.
3) User runs  (on local):

# du  -s  /usr/local   in a scrip I have used          du -s  /usr/local | cut  f1

and also doing a query on remote machine using:

                           ssh  $REMOTE_MACHINE  df -k  .    |   awk '{ print $4 }'

then compare them BUT the problem is when I run the same command on a different machine such as Fedora instead of $4
I have to use $3 since $4 on Fedora brought up 56% which is a percentage of used room on remote machine.

Now, how can I predict which one should I use? this script will be used on different machines and has to work just fine.

Your feedback will be appreciated greatly.
Thanks


0
Comment
Question by:akohan
  • 2
  • 2
4 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 17779082
df -kP /usr/local # should give portable results...
0
 

Author Comment

by:akohan
ID: 17779173

Hello ravenpl,

Do you mean that I have to df instead of du ?! can you explain it in what them that command is useful?
room occupied by a directory? or available room on a media?


0
 
LVL 43

Accepted Solution

by:
ravenpl earned 125 total points
ID: 17780972
> ssh  $REMOTE_MACHINE  df -k  .
You said that the above gives You different results on various OSes.
try df -kP # P stands for POSIX portable output format
0
 

Author Comment

by:akohan
ID: 17782522


Yes, it is working and thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question