Hey there,
As you may recall, we just completed a short series of posts on using LVM on Linux and Unix. At the time that I wrote it, I made mention (probably several times) of the similarities between LVM for Linux and HP-UX's brand. Also at that time, since I had hardly any experience with AIX, I was completely unaware that LVM was being used on that operating system.
If you need help with some of the basic concepts of LVM, please check out our older post on getting started with LVM and then check out the series listed above.
Now, I think I'm not allowed to get "too" excited about this, since this blog is mostly about Linux flavours and Solaris Unix (peppered with a little HP and one old post on AIX commands for the Unix user), but I thought I'd put this little series of posts (possibly not in totally sequential order -- Sometimes things come up that I'm compelled to write about ;) up for the AIX enthuisast who is thinking of using, or just beginning to use, LVM on AIX.
I hope this post is helpful to you. In any event, it should make for a good reference and might possibly be useful "later" :) Today, we'll look at LVM creation and display/monitoring commands for AIX and our next post will be on usage and destruction! Please note that all examples are mocked up and any variable that starts with Optional (such as OptionalVolumeGroupName) is an argument that you don't necessarily need to pass to the command.
Enjoy :)
AIX LVM Creation commands:
Create a Physical Volume (Note that Physical Volumes, in AIX, already exist - they just need to be allocated to Volume Groups):
host # lsvpcfg <-- To show the disks/vpaths and any Volume Groups they may already be associated with.
host # lspv|grep None <-- To show available Physical Volumes
host # cfgmgr <-- Use this interactively to allocate the Physical Volume for use with LVM.
Create a Volume Group:
host # mkvg -y VolumeGroupName HardDiskNumber <-- You can get the hard disk number from the lsdev command
host # varyonvg VolumeGroupName
Create a logical volume within a volume group:
host # mklv -y LogicalVolumeName -t FileSystemType VolumeGroup PhysicalPartion(PP) OptionalSpecificHardDriveDefinition
Ex:
host # mklv -y MylogicalVolume -t jfs MyVolumeGroup 8 <-- Note that the PP size is in MB.
or
host # mklv -y MylogicalVolume -t jfs MyVolumeGroup 8 /dev/DiskName
AIX LVM Display/Monitoring commands:
List out information about physical volumes:
host # lspv OptionalPhysicalVolumeName
List out Physical Volume information by Hard Disk:
host # lspv HardDiskNumber
List out Logical Volumes Within a Physical Volume:
host # lspv -l HardDiskNumber
List out Physical Partitions within a Physical Volume:
host # lspv -p HardDiskNumber
List out information about volume groups:
host # lsvg OptionalVolumeGroupName
List out properties of logical volumes within a volume group:
host # lsvg -l VolumeGroupName
List out properties, including hard drives, within a volume group:
host # lsvg -p VolumeGroupName
List out properties of a logical volume:
host # lslv OptionalLogicalVolumeName
List out Logical Volumes within a Physical Volume:
host # lslv -l OptionalLogicalVolumeName
List out Logical Volumes by Physical Volume:
host # lslv -p OptionalPhysicalVolumeName
List out mirrored Logical Volumes:
host # lslv -m OptionalLogicalVolumeName
List out hard disks in a vpath (Virtual Path). Necessary after Physical Volume Allocation to ensure everything went ok:
host # lsvpcfg
List out Fiber Channel adapters:
host # lsdev -Cc adapter
host # scfg -vl Number of fiber channel card
, Mike
Saturday, July 5, 2008
Using LVM on AIX Unix. Part One Of No More Than Two.
Monday, January 28, 2008
A Few Linux RAID Disk Monitoring Tips
Hey there,
For today's post, I thought I'd put together a few Linux RAID disk monitoring tips. This list isn't meant to be too specific, but more of a catch-all of stuff you probably have to do over and over again. But sometimes not often enough that it burns into your brain ;)
At the very basic level, you can manage your disk partitions using fdisk, much like in Windows, although completely different (type "m" to get a menu listing of available commands once you bring this little utility up). You can use the "-l" option to just print out the partition menu and not use it in interactive mode:host # fdisk -l /dev/hda
Disk /dev/hda: 16 heads, 63 sectors, 77520 cylinders
Units = cylinders of 1008 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 6095 3071848+ fd Linux raid autodetect
/dev/hda2 6096 67047 30719808 fd Linux raid autodetect
/dev/hda3 67048 73142 3071880 fd Linux raid autodetect
/dev/hda4 75175 77206 1024096+ 82 Linux swap
If you want to display the status of your RAID devices, much the way metastat does on Solaris, it's much simpler. One of the great things about Linux is the way they've taken the /proc filesystem and turned into a really useful tool.
Entering the following will display the information you need. Note that this is a two way mirror with only one active mirror (I take the examples I can find on our network ;). Ideally, you'd want to have a [2/2] configuration for better HA.host # cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hda3[0]
62912 blocks [2/1] [U_]
md1 : active raid1 hda2[0]
153152 blocks [2/1] [U_]
md0 : active raid1 hda1[0]
307328 blocks [2/1] [U_]
If you're syncing up your RAID devices and want to check on the progress, just use the same command, like so:host # cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hdc3[1]
1020032 blocks [2/1] [_U]
md0 : active raid1 hdc1[1]
3068288 blocks [2/1] [_U]
md1 : active raid1 hda2[2] hdc2[1]
3068288 blocks [2/1] [_U]
[==>..................] recovery = 13.7% (894298/6136576) finish=10.2min speed=7833K/sec
unused devices:
Now, assuming all that is taken care of and you want to check out your RAID configuration, you'll just need to read your RAID configuration table (/etc/raidtab):host # cat /etc/raidtab
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/hda1
raid-disk 0
device /dev/hdc1
raid-disk 1
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/hda2
raid-disk 0
device /dev/hdc2
raid-disk 1
raiddev /dev/md2
raid-level 1
nr-raid-disks 2
chunk-size 64k
persistent-superblock 1
nr-spare-disks 0
device /dev/hda3
raid-disk 0
device /dev/hdc3
raid-disk 1
If you want to get more detailed with your analysis, there are (of course) built in commands to enable you to do so. lsraid is one of my favorites :)
To display a short listing of the md0 device, type the following:
# lsraid -A -a /dev/md0
[dev 9, 0] /dev/md0 8F88ACB0.7D06B4C4.FA677344.C3448700 online
[dev 3, 3] /dev/hda1 8F88ACB0.7D06B4C4.FA677344.C3448700 good
[dev 22, 3] /dev/hdc1 8F88ACB0.7D06B4C4.FA677344.C3448700 good
If you'd like to display a short listing of the RAID array that the disk hda1 belongs to (essentially the same output in this case), just type:
# lsraid -A -d /dev/hda1
[dev 9, 0] /dev/md0 8F88ACB0.7D06B4C4.FA677344.C3448700 online
[dev 3, 3] /dev/hda1 8F88ACB0.7D06B4C4.FA677344.C3448700 good
[dev 22, 3] /dev/hdc1 8F88ACB0.7D06B4C4.FA677344.C3448700 good
lsraid also comes in handy if you want to list out any faulty devices. This is something to consider putting in cron, or running regularly, so that you get notified of any failures in a timely fashion. No sense in having RAID's HA setup if you wait for all the components to fail before you replace any of them ;)
For a short listing, go with:
# lsraid -A -f -a /dev/md0
[dev 9, 0] /dev/md0 8F88ACB0.7D06B4C4.FA677344.C3448700 online
If you want, or need, all the gruesome details, lsraid will be happy to oblige. Just invoke it like this:lsraid -D -l -a /dev/md0
[dev 3, 3] /dev/hda1:
md version = 0.90.0
superblock uuid = 8F88ACB0.7D06B4C4.FA677344.C3448700
md minor number = 0
created = 1169715493 (Fri Jan 25 08:58:13 2007)
last updated = 1169933481 (Sun Jan 27 21:31:21 2007)
raid level = 1
chunk size = 64 KB
apparent disk size = 3068288 KB
disks in array = 2
required disks = 2
active disks = 2
working disks = 2
failed disks = 0
spare disks = 0
position in disk list = 0
position in md device = 0
state = good
[dev 22, 3] /dev/hdc1:
...
In a near future post (maybe tomorrow), we'll follow up with some tips on setting up your RAID arrays in Linux and walk through that process together.
Hope this helps you out some in the meantime :)
Cheers,
, Mike
linux unix internet technology
Monday, December 17, 2007
Simple Sun Cluster Monitoring Script
Hey There,
Today, I've included a script I wrote to monitor a small SunCluster 3.1 environment (Running Oracle Parallel Server - OPS) we have set up at our shop. It basically runs through the output of various "scstat" command variations and reports on all combinations of errors it encounters. I built some functionality in it to be as specific as possible about the error states and to make sure that it returns an "All Clear" once the error condition no longer exists.
I also wrote this to run in cron. I run it every 5 minutes. Any time period is acceptable, depending upon what you need, and, of course, you could always put this script in a wrapper so that it runs constantly (although that generally necessitates writing another script to make sure that this script is running, restarting it as necessary and vice versa - For Veritas Cluster Server fans out there, this is a cheap and quick way to imitate the relationship between had and hashadow).
This was also written for a small environment (2 machines with 2 "live" network connections each). I didn't include monitoring of the heartbeats, since the script is meant to be run locally (with "exactly" the same values in the customizable section) on all nodes in a cluster, and scstat's indication of failure on any of these tests is, in and of itself, a guarantee that loss of a heartbeat connection is the very least of your problems ;)
Enjoy!
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License#!/usr/bin/perl
###################################
# suncluster_mon - check cluster health
# 2007 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#
# simple parser for:
# 1. scstat -n
# 2. scstat -i
# 3. scstat -g
# 4. scstat -D
#
###################################
###################################
# CUSTOMIZE SETTINGS HERE
# $debug can be set with the -d
# switch when invoking the script
###################################
$primary_node="";
$secondary_node="";
$primary_eth="";
$secondary_eth="";
$date=`/usr/bin/date "+%A, %B %d - %H:%M:%S"`;
$hostname=`/usr/bin/hostname`;
$debug=0;
###################################
# PLEASE DO NOT EDIT BELOW
# EXCEPT MAIL SETTINGS AT END
###################################
chomp($date);
if ( $#ARGV >= 0 ) {
foreach $arg (@ARGV) {
if ( $arg =~ /-d/ ) {
$debug=1;
print "Debug Output Set\n";
} else {
push(@nogo, $arg)
}
}
if ( @nogo > 0 ) {
print "Unrecognized options: @nogo\n";
print "Ignoring and continuing\n";
}
}
@scstatn=`/usr/cluster/bin/scstat -n|/usr/bin/egrep 'node:'`;
for $nodestat (@scstatn) {
if ( $nodestat =~ /Cluster node:/ ) {
$nodestat =~ s/Cluster node://;
@nodestat = split(" ", $nodestat);
if ( $nodestat[1] eq "Offline" && $nodestat[0] eq $secondary_node ) {
if ( $nodefailure ) {
$alert="\nCluster Alert:\n$primary_node and $secondary_node are both in Offline state. Cluster Failed\n";
} else {
$alert="\nCluster Alert:\n$primary_node is in Offline state. $secondary_node is Online - Cluster Crippled\n";
}
$alert="\nCluster Alert:\n$nodestat[0] has switched to $nodestat[1] Status - Cluster Crippled - Checking For Dual Failure\n";
$nodefailure=1;
push(@alert, $alert);
} elsif ( $nodestat[1] eq "Offline" && $nodestat[0] eq $primary_node ) {
if ( $nodefailure ) {
$alert="\nCluster Alert:\n$primary_node and $secondary_node are both in Offline state. Cluster Failed\n";
} else {
$alert="\nCluster Alert:\n$primary_node is in Offline state. $secondary_node is Online - Cluster Crippled\n";
}
$alert="\nCluster Alert:\n$nodestat[0] has switched to $nodestat[1] Status - Cluster Crippled - Checking For Dual Failure\n";
$nodefailure=1;
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="Cluster Info: $nodestat[0] and $nodestat[1] OK\n";
push(@debug, $alert);
}
$beautiful++;
}
} else {
print "WTF ---- SCSTAT -D\n";
}
}
if ( $beautiful == 2 ) {
if ( $debug ) {
$alert="Cluster Info: Both nodes OK\n";
push(@debug, $alert);
}
}
@scstati=`/usr/cluster/bin/scstat -i|/usr/bin/egrep 'Group:'`;
for $ipmpstat (@scstati) {
if ( $ipmpstat =~ /IPMP Group:/ ) {
$ipmpstat =~ s/IPMP Group://;
@ipmpstat = split(" ", $ipmpstat);
if ( $ipmpstat[0] == $primary_node ) {
if ( $ipmpstat[3] eq $primary_eth && $ipmpstat[4] ne "Online" ) {
$alert="\nIPMP Alert:\n$ipmpstat[3] is in $ipmpstat[4] mode on $ipmpstat[0] - Checking for Online of $ipmpstat[0] $secondary_eth\n";
$ethprimaryfailure=1;
push(@alert, $alert);
} elsif ( $ipmpstat[3] eq $secondary_eth && $ipmpstat[4] ne "Online" && $ethprimaryfailure == 1 ) {
$alert="\nIPMP Alert:\n$ipmpstat[0] $secondary_eth is not in an Online state on $ipmpstat[0] - IPMP Group Down on both Interfaces!\n";
push(@alert, $alert);
} elsif ( $ipmpstat[3] eq $secondary_eth && $ipmpstat[4] ne "Standby" && ! $ethprimaryfailure ) {
$alert="\nIPMP Alert:\n$ipmpstat[3] is in $ipmpstat[4] mode on $ipmpstat[0] - Failover interface is not UP - IPMP Group Crippled on $ipmpstat[0]!\n";
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="IPMP Info: IPMP Group $ipmpstat[0] $ipmpstat[3] OK\n";
push(@debug, $alert);
}
}
} elsif ( $ipmpstat[0] == $secondary_node ) {
if ( $ipmpstat[3] eq $primary_eth && $ipmpstat[4] ne "Online" ) {
$alert="\nIPMP Alert:\n$primary_eth is in $ipmpstat[4] mode on $ipmpstat[0] - Checking for Online of $ipmpstat[0] $secondary_eth\n";
$ethprimaryfailure=1;
push(@alert, $alert);
} elsif ( $ipmpstat[3] eq $secondary_eth && $ipmpstat[4] ne "Online" && $ethprimaryfailure == 1 ) {
$alert="\nIPMP Alert:\n$ipmpstat[0] ipmpstat[3] not in an Online state on ipmpstat[0] - IPMP Group Down on both Interfaces!\n";
push(@alert, $alert);
} elsif ( $ipmpstat[3] eq $secondary_eth && $ipmpstat[4] ne "Standby" && ! $ethprimaryfailure ) {
$alert="\nIPMP Alert:\n$ipmpstat[3] is in $ipmpstat[4] mode on $ipmpstat[0] - Failover interface is not UP - IPMP Group Crippled on $ipmpstat[0]!\n";
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="IPMP Info: IPMP Group $ipmpstat[0] $ipmpstat[3] OK\n";
push(@debug, $alert);
}
}
}
} else {
print "WTF ---- SCSTAT -I\n";
}
}
@scstatg=`/usr/cluster/bin/scstat -g|/usr/bin/egrep 'Resource:|Resources:|Group:'`;
for $rgstat (@scstatg) {
if ( $rgstat =~ /Resources:/ ) {
$rgstat =~ s/Resources://;
@rgstat = split(" ", $rgstat);
if ( @rgstat != 5 ) {
shift @rgstat;
$alert="\nOracle Resource Alert:\nOracle resource group $rgstat[0] is not running all resources on the cluster\n--Only running -- @rgstat\n";
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="Oracle Resource Info: Oracle resource group $rgstat[0] OK -- @rgstat OK\n";
push(@debug, $alert);
}
}
} elsif ( $rgstat =~ /Group:/ ) {
$rgstat =~ s/Group://;
@rgstat = split(" ", $rgstat);
if ( $rgstat[2] ne "Online" && $rgstat[1] eq $primary_node ) {
$alert="\nOracle Resource Alert:\nResource Group $rgstat[0] is in $rgstat[2] state on primary node $rgstat[1] - Checking for failover\n";
$rgprimaryfailure=1;
push(@alert, $alert);
} elsif ( $rgstat[2] ne "Online" && $rgstat[1] eq $secondary_node && $rgprimaryfailure == 1 ) {
$alert="\nOracle Resource Alert:\nResource Group $rgstat[0] is in $rgstat[2] state on cluster - Resource Group Down on both Nodes!\n";
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="Oracle Resource Info: $rgstat[1] Resource Group $rgstat[0] OK\n";
push(@debug, $alert);
}
}
} elsif ( $rgstat =~ /Resource:/ ) {
$rgstat =~ s/Resource://;
@rgstat = split(" ", $rgstat);
if ( $rgstat[2] ne "Online" && $rgstat[1] eq $primary_node ) {
$alert="\nOracle Resource Alert:\nResource$rgstat[0] is in $rgstat[2] state on primary node $rgstat[1] - Checking for failover\n";
$rgprimaryfailure=1;
push(@alert, $alert);
} elsif ( $rgstat[2] ne "Online" && $rgstat[1] eq $secondary_node && $rgprimaryfailure == 1 ) {
$alert="\nOracle Resource Alert:\nResource $rgstat[0] is in $rgstat[2] state on cluster - Resource Group Down on both Nodes!\n";
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="Oracle Resource Info: $rgstat[1] Resource $rgstat[0] OK\n";
push(@debug, $alert);
}
}
} else {
print "WTF ---- SCSTAT -G\n";
}
}
@scstatD=`/usr/cluster/bin/scstat -D|/usr/bin/egrep 'servers|status'`;
for $diskstat (@scstatD) {
if ( $diskstat =~ /servers/ ) {
$diskstat =~ s/Device group servers://;
@diskstat = split(" ", $diskstat);
if ( $diskstat[1] ne $primary_node ) {
$alert="\nDisk Resource Alert:\n$diskstat[0] has switched primary node to $diskstat[1] from $diskstat[2]\n";
push(@alert, $alert);
} elsif ( $diskstat[1] ne $primary_node && $diskstat[1] ne $secondary_node ) {
$alert="\nDisk Resource Alert:\n$diskstat[0] has failed on all nodes!\n";
push(@alert, $alert);
} else {
if ( $debug ) {
$alert="Disk Resource Info: $diskstat[1] primary - $diskstat[0] OK\n";
push(@debug, $alert);
}
}
} elsif ( $diskstat =~ /status/ ) {
$diskstat =~ s/Device group status://;
@diskstat = split(" ", $diskstat);
if ( $diskstat[1] ne "Online" ) {
$alert="\nDisk Resource Group Alert:\n$diskstat[0] has switched to $diskstat[1] state on the cluster\n";
push(@alert, $alert);
} elsif ( $diskstat[1] eq "Online" ) {
if ( $debug) {
$alert="Disk Resource Group Info: $diskstat[0] OK\n";
push(@debug, $alert);
}
}
} else {
print "WTF ---- SCSTAT -D\n";
}
}
###################################
# EDIT To: Reply-To: and From:
# if you want mail to go somewhere
# useful and-or helpful!
###################################
if ( @alert > 0 || @debug > 0 ) {
open(CMAIL, "|/usr/lib/sendmail -t");
print CMAIL "Subject: CLUSTER ALERT - $hostname - $date\n";
print CMAIL "From: you\@yourdomain.com\n";
print CMAIL "Reply-To: you\@yourdomain.com\n";
print CMAIL "To: recipients\@yourdomain.com\n";
print CMAIL "\n\n";
foreach $warning (@alert) {
print CMAIL $warning;
}
if ( $debug > 0 ) {
foreach $message (@debug) {
print CMAIL $message;
}
}
close(CMAIL);
system("touch /tmp/cfail_ihot_stat");
} elsif ( @alert == 0 && -f "/tmp/cfail_ihot_stat" ) {
open(CMAIL, "|/usr/lib/sendmail -t");
print CMAIL "Subject: CLUSTER RESTORED - $hostname - $date\n";
print CMAIL "From: you\@yourdomain.com\n";
print CMAIL "Reply-To: you\@yourdomain.com\n";
print CMAIL "To: recipients\@yourdomain.com\n";
print CMAIL "\n\n";
print CMAIL "All Cluster Services Back To Good State\n";
print CMAIL "All Cluster Nodes: OK\n";
print CMAIL "All IPMP Groups: OK\n";
print CMAIL "All Oracle Resources: OK\n";
print CMAIL "All Storage Groups: OK\n";
close(CMAIL);
unlink("/tmp/cfail_ihot_stat");
}
, Mike
linux unix internet technology
Monday, November 12, 2007
Determining The Real Space Hogs On a Multiple-Overlay Mounted File System
This happens a lot to me, and probably most system administrators, at work. All the machines are being monitored (the "important" ones, anyway) 24x7. Of course, that's good because it's our job to make sure the machines keep running optimally and it would be a real drag to have to log in and check them manually.
However, no matter how sophisticated your monitoring system is, it's prone to giving you the usual headaches. A computer's only as smart as a computer, after all. On the one end of the spectrum, you'll get notified if the cpu so much as spikes under 10% idle for 1 minute of the day and on the other end, you won't find out that your machine is melting until you smell the smoke. In any event, some sort of automation is better than none!
Disk watching is something that's becoming more and more critical, in so far as performance assurance goes, as time marches on. What we used to store in MegaBytes, we're now storing in PetaBytes and it's still not enough space to store all that important music and video... I mean, customer data :P
The issue I'm addressing with today's bit of work, is how to deal with getting a clear assessment of disk space usage when you've got a multiple-overlay mounted file system. This may not be the proper industry term, so I'll explain that when I say this I mean a partition which has many other partitions mounted over it. For instance (all separate mount points):
/stuff
/stuff/IBM/aa
/stuff/IBM/bb
/stuff/oracle/db_files
...and so on. A lot of times, the overlain mounts number in the hundreds. So, in our instance, what do we do (in our role as administrators and blame-takers) to determine who's really using up all that space? Obviously, running a disk usage command like "du -sk" on the /stuff directory would be very time consuming, and it wouldn't accurately reflect what files/directories are eating up all the space on /stuff since most of the directories beneath /stuff are on entirely separate partitions!
The only way to really do it accurately is to ensure that you're only measuring the disk usage of files and directories that are on /stuff and not any of the overlain partitions. The little script below does just that. For your consideration:
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#!/bin/ksh
#
# 2007 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#
trap 'rm tmpfile.$pid;echo "Caught Signal. Cleaning Up And Quitting...";exit 3"' 1 2 3 9 15
pid=$$
nicedate=`date "+%m/%d/%y`
date=`date +%m%d%y`
hostname=`hostname`
print ""
print "$hostname StuffCheck Output for $nicedate"
echo "---------------------------------------------------------------------"
print ""
printf "%-15s %-10s %-20s %-10s %-10s\n" Hostname Size Partition User Group
echo "---------------------------------------------------------------------"
if [ -d /stuff ]
then
cd /stuff
counter=0
ls -1d * 2>&1|while read x
do
if [ `df -k |grep "$x" >/dev/null 2>&1;echo $?` -ne 0 ]
then
if [ $counter -eq 0 ]
then
dir_array="$x"
let counter=$counter+1
else
dir_array="${dir_array}\t$x"
fi
fi
done
for y in `echo $dir_array`
do
du -dsk $y 2>&1
done|sort -rn|head -5|while read size partition
do
printf "%-15s %-10s %-20s %-10s %-10s\n" $hostname: $size $partition `ls -ld /stuff/$partition|/bin/awk '{ print $3}'` `ls -ld /stuff/$partition|/bin/awk '{ print $4}'`
done
else
print "No /stuff Directory found!!!"
fi
Note that the real time saver here is that we only run du on files and/or directories that we've already determined are not on any overlay mount (using df -k).
All in all, it's a fairly simple script to decipher, since I wrote it quickly and hardcoded a lot of things that could very well be variable (the partition name for instance) and tipped my hand to what I wanted to accomplish before the timer ran out by adding a "hostname" field to the output. But, I'm sure I'll end up making this more flexible as soon as the /things, /odds and /ends directories start getting overloaded :)
Take care,
, Mike
linux unix internet technology
Posted by
Mike Golvach
at
4:47 PM
administration, advice, df, disk, du, file, filesystems, linux, monitoring, mounts, script, scripting, scripts, space, systems, technology, tips, tricks, unix





