Sponsored Content
Top Forums Shell Programming and Scripting Check the partition size on server Post 302540351 by kpoobathi on Wednesday 20th of July 2011 11:11:20 AM
Old 07-20-2011
Check the partition size on server

Dear All,


I need notification mail from server while device size crossed 80% approximately.I tried following shell .its working fine when the device name like /dev/sdc1 etc.Its not working in LVM name.For example

Script:

Code:
#!/bin/sh
echo "Storage server space details";
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
  echo $output
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )
  if [ $usep -ge 80 ]; then
    echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
     mail -s "Alert: Almost out of disk space $usep%" user1@domainname.com
  fi
done

----
>>Its working fine while following device name available

Code:
[root@Server1 test]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda6              95G  8.2G   82G  10% /
/dev/sda12            9.5G  3.5G  5.6G  39% /home

>> Its not working for like below mention name
Code:
#df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/device1/LVM_LGroup1
                      6.8G  791M  5.7G  13% /
/dev/sda1             996M   53M  892M   6% /boot
tmpfs                1006M     0 1006M   0% /dev/shm
/dev/device2/LVM_LGroup2
                      6.8G  163M  6.3G   3% /home

How to filter with entire LVM_LVGrou1.please reply
 

10 More Discussions You Might Find Interesting

1. Solaris

inrease partition size

hi, i created a partition c1t0d0s5 sized 10gb and a soft partition on it. now i want to expand this size to 15gb (my hard disk is 36gb). anybody show me the way to do that, please. here are the outputs of the df and format commands: # df -h Filesystem size used avail capacity ... (5 Replies)
Discussion started by: xuc_xich_duc
5 Replies

2. Solaris

Partition size calculations

Hi guys, I have an V100 server and I'm about to install solaris 8 on it (I have 10 on currently but most of my work is on 8 so I'm going to that). It would be easy for me to post system specs and get a recommendation, but what I'd like is to know HOW to calculate so that I can set up other... (1 Reply)
Discussion started by: Stin
1 Replies

3. UNIX for Dummies Questions & Answers

Increasing the Size of the Samba Partition

Hi, Is there any command to increase the size of the samba partition when the samba share is online?? Regards Arun (1 Reply)
Discussion started by: Arun.Kakarla
1 Replies

4. Shell Programming and Scripting

how to connect to server with ssh to check process size

Hello i have to connect to 11 servers to check the process size on every server. how to that with shell scripting using ssh regards (7 Replies)
Discussion started by: mogabr
7 Replies

5. Linux

primary partition size

hi I am trying to create primary,extended and logical partitions. when I try to create a primary partition, I can give it maximum 1027M (1gb). Why? (9 Replies)
Discussion started by: tjay83
9 Replies

6. UNIX for Dummies Questions & Answers

Size of swap partition during installation

Greetings. I've been into computers since the '80s, but this is my first attempt at Linux. I'm installing Debian Lenny on a PIII 733 with 10GB hard drive and 512MB Ram. I intend to use the machine primarily as a development server, with things like mySQL, Apache, php, etc. I don't really want... (22 Replies)
Discussion started by: fguy
22 Replies

7. HP-UX

Increase of partition Size In HP-UX

Experts, I want to know how to increase partion size in Hp-ux.Actually we installed oracle in separate part ion.As increase of database went to 99% :eek:.What ever data which is in it is important.so i dont want to delete any data in that partion.Now the size of that is 250 GB.I want the same to... (2 Replies)
Discussion started by: naveennella
2 Replies

8. UNIX for Advanced & Expert Users

Check the size of the file on different server

Hello, I have two servers A and B, My script is written on Server A. I am picking up the file say "abc.txt" from Server B using sftp command and putting it in a directory at Server A. Now the catch is, If the file size of "abc.txt" is greater thn the available size on Server A, thn an email... (1 Reply)
Discussion started by: Prashant Jain
1 Replies

9. Shell Programming and Scripting

Check the size of the file on different server

Hello, I have two servers A and B, My script is written on Server A. I am picking up the file say "abc.txt" from Server B using sftp command and putting it in a directory at Server A. Now the catch is, If the file size of "abc.txt" is greater thn the available size on Server A, thn an email... (5 Replies)
Discussion started by: Prashant Jain
5 Replies

10. Shell Programming and Scripting

Check size of a partition

hi want to schedule a script for displaying the size of the partiition. For example df -g /dev/fslv03 2000.00 535.43 74% 179943 1% /nvbkp we have several mount point like this but i want to schedule script to display size of the above mount point only. Thanks Ankit (4 Replies)
Discussion started by: ankit2012
4 Replies
PVCK(8) 						      System Manager's Manual							   PVCK(8)

NAME
pvck - check physical volume metadata SYNOPSIS
pvck [-d|--debug] [-h|--help] [-v|--verbose] [--labelsector] PhysicalVolume [PhysicalVolume...] DESCRIPTION
pvck checks physical volume LVM metadata for consistency. OPTIONS
See lvm for common options. --labelsector sector By default, 4 sectors of PhysicalVolume are scanned for an LVM label, starting at sector 0. This parameter allows you to specify a different starting sector for the scan and is useful for recovery situations. For example, suppose the partition table is corrupted or lost on /dev/sda, but you suspect there was an LVM partition at approximately 100 MB. This area of the disk may be scanned by using the --labelsector parameter with a value of 204800 (100 * 1024 * 1024 / 512 = 204800): pvck --labelsector 204800 /dev/sda Note that a script can be used with --labelsector to automate the process of finding LVM labels. SEE ALSO
lvm(8), pvcreate(8), pvscan(8) vgck(8) Sistina Software UK LVM TOOLS 2.02.95(2) (2012-03-06) PVCK(8)
All times are GMT -4. The time now is 09:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy