script to differenciate directory and file system


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to differenciate directory and file system
# 1  
Old 09-15-2009
script to differenciate directory and file system

I need to write a script which will check all the directories in / and find out which is separate filesystem or a directory inside /
suppose i have
/application -->/dev/hdisk0 is a partitiom
/abc --> is a directory
/xyz-->is a directory
/db-->/dev/hdisk1 is a partition

actually my / gets full most of the time so i need to check the size of the directories inside / not the partitions (filesystems). so i am trying to write a script which will search all the directories only and can check size inside.
I think we can use Lost+Found for this, which is present only inside partitions.

check Lost+found
if Lost+found not present
du...
else
next step

Last edited by pchangba; 09-15-2009 at 09:09 AM..
# 2  
Old 09-15-2009
Which OS are you on?

Depending on the OS, you could build the below logic:

1. Get a list of file systems using "bdf" or "df -k" as the case may be.

2. Get a list of all directories & file systems under /.

3. Compare the above 2 lists and eliminate the file systems.

4. Whatever remains must be the directories!

HTH, Smilie


Regards,

Praveen
# 3  
Old 09-15-2009
In HP-UX for example "du -x" confines to current filesystem.

To get disc usage in kb of all directories in root directory sorted with highest first:

Code:
du -kx / | sort -n -r | more

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

2. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

3. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

4. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies

5. Shell Programming and Scripting

Script which removes files from the first directory if there is a file in the second directory

Script must removes files from the first directory if there is a file with same name in the second directory Script passed to the two directories, it lies with them in one directory: sh script_name dir1 dir2 This is my version, but it does not work :wall: set - $2/* for i do set -... (6 Replies)
Discussion started by: SLAMUL
6 Replies

6. HP-UX

Potential file system contention on directory

We have an 8-processor Itanium system running HP-UX 11.23 connected to shared SAN discs. We have an application that creates files (about 10) in a specific directory. When the application terminates, these files are removed (unlink) and a few others are updated. The directory contains... (8 Replies)
Discussion started by: FDesrochers
8 Replies

7. Shell Programming and Scripting

Need to find the percentage of the directory in the file system.

Hi All, I want to find the percentage occupied by the directory in the file system. Say, i have the file system /home/arun/work under this file system i have the directories /home/arun/work/yesterday /home/arun/work/today /home/arun/work/tomorrow The size of the file system is... (5 Replies)
Discussion started by: Arunprasad
5 Replies

8. UNIX for Dummies Questions & Answers

how many directory can be mounted on one file system

I have a question and seek help. How many directory can be mounted on one file system on UNIX with solaris 9? For example, I have one file system as /dev/dsk/cieit0a6. I have created one directory as /u01/app/oracle and mounted this directory to cieit06. It works. Then I create another directory as... (4 Replies)
Discussion started by: duke0001
4 Replies

9. UNIX for Dummies Questions & Answers

Distinction b/w file system and directory

Can you give a very basic definition of file system vs. directory in unix. The context is around monitoring for disk capacity maxing out. Why would /appl/sbe/inst_2/config/logs not be able to be because it is a directory but appl/cce can be monitored because it is a unix file system. They... (1 Reply)
Discussion started by: kd9626
1 Replies

10. Shell Programming and Scripting

Shell script for Creating Directory with name as system date

Dear Sir/Madam, I need a bit of your help. The problem is as follows : I have to create a directory in unix whose name is that of system date in the dd_mon_yyyy format . I am able to extract a date in required format ina variable , but when i'm using this variable in mkdir it is not... (7 Replies)
Discussion started by: aarora_98
7 Replies
Login or Register to Ask a Question