Solved

How to predict df resutls on different machines?!

Posted on 2006-10-20
4
200 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now