*File system space management
(1) File systems expand upon notice, not automatically.
(2) To keep from running into problems:
- Monitor file system growth
- Determine causes
- Control growing files
- Manage file system space usage
- Control user disk usage
- Block size considerations
- Fragmentation considerations
*Listing file system utilization
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 74.00 5.33 93% 153333 11% /
/dev/hd2 10.00 6.56 35% 57099 4% /usr
/dev/hd9var 10.00 9.72 3% 4477 1% /var
/dev/hd3 10.00 6.35 37% 2509 1% /tmp
/dev/fwdump 1.00 1.00 1% 13 1% /var/adm/ras/platform
/dev/hd1 39.50 19.70 51% 278 1% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 10.00 8.86 12% 13436 1% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 100.00 50.01 50% 234694 2% /ptc
/dev/fslv02 60.00 49.62 18% 51120 1% /oracle
/dev/fslv03 10.00 2.98 71% 2503 1% /ftp
x3550-PC:print 70.70 58.23 18% 0 0% /ptc/Windchill/temp/print
/dev/fslv01 300.00 277.70 8% 24176 1% /pdmdata
# df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 77594624 5593508 93% 153333 11% /
/dev/hd2 10485760 6881712 35% 57099 4% /usr
/dev/hd9var 10485760 10193892 3% 4477 1% /var
/dev/hd3 10485760 6653388 37% 2509 1% /tmp
/dev/fwdump 1048576 1046916 1% 13 1% /var/adm/ras/platform
/dev/hd1 41418752 20656480 51% 278 1% /home
/dev/hd11admin 524288 523848 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 10485760 9293388 12% 13436 1% /opt
/dev/livedump 524288 523880 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 104857600 52437892 50% 234694 2% /ptc
/dev/fslv02 62914560 52025260 18% 51120 1% /oracle
/dev/fslv03 10485760 3120960 71% 2503 1% /ftp
x3550-PC:print 74136572 61054548 18% 0 0% /ptc/Windchill/temp/print
/dev/fslv01 314572800 291192540 8% 24176 1% /pdmdata
# df -m
Filesystem MB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 75776.00 5462.41 93% 153333 11% /
/dev/hd2 10240.00 6720.42 35% 57099 4% /usr
/dev/hd9var 10240.00 9954.97 3% 4477 1% /var
/dev/hd3 10240.00 6497.45 37% 2509 1% /tmp
/dev/fwdump 1024.00 1022.38 1% 13 1% /var/adm/ras/platform
/dev/hd1 40448.00 20172.34 51% 278 1% /home
/dev/hd11admin 512.00 511.57 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 10240.00 9075.57 12% 13436 1% /opt
/dev/livedump 512.00 511.60 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 102400.00 51208.88 50% 234694 2% /ptc
/dev/fslv02 61440.00 50805.92 18% 51120 1% /oracle
/dev/fslv03 10240.00 3047.81 71% 2503 1% /ftp
x3550-PC:print 72399.00 59623.58 18% 0 0% /ptc/Windchill/temp/print
/dev/fslv01 307200.00 284367.71 8% 24176 1% /pdmdata
# df -i
Filesystem 512-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 155189248 11187016 93% 153333 11% /
/dev/hd2 20971520 13763424 35% 57099 4% /usr
/dev/hd9var 20971520 20387784 3% 4477 1% /var
/dev/hd3 20971520 13306776 37% 2509 1% /tmp
/dev/fwdump 2097152 2093832 1% 13 1% /var/adm/ras/platform
/dev/hd1 82837504 41312960 51% 278 1% /home
/dev/hd11admin 1048576 1047696 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 20971520 18586776 12% 13436 1% /opt
/dev/livedump 1048576 1047760 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 209715200 104875736 50% 234694 2% /ptc
/dev/fslv02 125829120 104050520 18% 51120 1% /oracle
/dev/fslv03 20971520 6241920 71% 2503 1% /ftp
x3550-PC:print 148273144 122109096 18% 0 0% /ptc/Windchill/temp/print
/dev/fslv01 629145600 582385080 8% 24176 1% /pdmdata
# df -I
Filesystem 512-blocks Used Free %Used Mounted on
/dev/hd4 155189248 144002232 11187016 93% /
/dev/hd2 20971520 7208096 13763424 35% /usr
/dev/hd9var 20971520 583736 20387784 3% /var
/dev/hd3 20971520 7664744 13306776 37% /tmp
/dev/fwdump 2097152 3320 2093832 1% /var/adm/ras/platform
/dev/hd1 82837504 41524544 41312960 51% /home
/dev/hd11admin 1048576 880 1047696 1% /admin
/proc - - - - /proc
/dev/hd10opt 20971520 2384744 18586776 12% /opt
/dev/livedump 1048576 816 1047760 1% /var/adm/ras/livedump
/dev/fslv00 209715200 104839728 104875472 50% /ptc
/dev/fslv02 125829120 21778600 104050520 18% /oracle
/dev/fslv03 20971520 14729600 6241920 71% /ftp
x3550-PC:print 148273144 26164048 122109096 18% /ptc/Windchill/temp/print
/dev/fslv01 629145600 46760520 582385080 8% /pdmdata
*Monitoring file system growth
A simple script using the df command, which can be run at regular intervals to warn against file systems becoming full
#!/bin/ksh
df | egrep -v '(used|proc)' | awk '{print $4" "$7}' \
| sed 's:%::g' | while read LINE
do
PERC=`echo $LINE | awk '{print $1}'`
FILESYSTEM=`echo $LINE | awk '{print $2}'`
if [ $PERC -gt 70 ]
then
mail -s "Filesystem check on box: `hostname`" \
[email protected] <<EOF
$FILESYSTEM is $PERC% full, please check
EOF
fi
done
*Listing disk usage
du [-k] [-m] [-g] [-]
# du -sg .
0.00 .
# du newfile.sh
8 newfile.sh
# du -sm * | sort -rn
0.00 newfile.sh
# du -ax
560 ./Snap.20110927.135433.4259858.0003.trc
608 ./Snap.20111007.101649.4063266.0003.trc
560 ./Snap.20111007.164235.3866898.0003.trc
1104 ./Snap.20111011.163558.5832924.0008.trc
48 ./Snap.20111011.163558.5832924.0009.trc
48 ./Snap.20111011.163558.5832924.0010.trc
48 ./Snap.20111011.163558.5832924.0011.trc
768 ./Snap.20111011.170913.5767352.0003.trc
4694016 ./core.20111007.101649.4063266.0001.dmp
5093808 ./core.20111011.170913.5767352.0001.dmp
19296 ./heapdump.20110927.135433.4259858.0001.phd
19560 ./heapdump.20111007.164235.3866898.0001.phd
844264 ./heapdump.20111011.163558.5832924.0001.phd
844264 ./heapdump.20111011.163558.5832924.0002.phd
844256 ./heapdump.20111011.163558.5832924.0003.phd
844256 ./heapdump.20111011.163558.5832924.0004.phd
1440 ./javacore.20110927.135433.4259858.0002.txt
2352 ./javacore.20111007.101649.4063266.0002.txt
1416 ./javacore.20111007.164235.3866898.0002.txt
5016 ./javacore.20111011.163558.5832924.0005.txt
5016 ./javacore.20111011.163558.5832924.0006.txt
5008 ./javacore.20111011.163558.5832924.0007.txt
5008 ./javacore.20111011.163558.5832924.0012.txt
6416 ./javacore.20111011.170913.5767352.0002.txt
8 ./mvlogs.sh
8 ./start_DS.sh
8 ./start_all_root.sh
8 ./start_apache.sh
8 ./start_windchill.sh
8 ./stop_DS.sh
8 ./stop_all_root.sh
8 ./stop_apache.sh
8 ./stop_windchill.sh
13239216 .
# find / -size +1000000c
*Control growing files
(1) Growing files should be monitored and cleaned out periodically. Some of the files that grow are listed below:
①-- /var/adm/wtmp
①-- /etc/security/failedlogin
-- /var/adm/sulog //can be edited directly
-- /var/spool/*/*
-- /var/tmp/*
-- $HOME/smit*
-- $HOME/websm*
(2) Two ways of overwriting a log file ①:
Example 1:
# cat test1
just a test!
# touch test2
# cat test2 > test1
# cat test1
#
Example 2:
# cat test3
just a test!
# > test3
# cat test3
#
(3) The /var/spool directory
The directory /var/spool contains cron entries, the mail, and other items that grow on an ongoing basis, along with printer files. If there is a problem with the printer files, you can try to clear the queuing subsystem by executing the following commands:
Stopsrc -s qdaemon
rm /var/spool/lpd/qdir/*
rm /var/spool/lpd/stat/*
rm /var/spool/qdaemon/*
startsrc -s qdaemon
*The skulker command
- The skulker command cleans up file systems by removing unwanted or obsolete files.
- Candidate files include:
(1) Files older than a selected age
(2) Files in the /tmp, /var/spool, /var/tmp, /var/news directories
(3) a.out, *.bak, core, ed.hup files
- skulker is normally invoked daily by the cron command as part of the crontab file of the root user. (Disabled by default)
- Modify the skulker shell script to suit local needs for the removal of files. (Test carefully!!)
*Verify and repair a file system
(1) fsck command
-- Checks file system consistency and interactively repairs the file system
-- If no file system name is specified, the fsck command checks all file systems which have the check=true attribute set in the /etc/filesystems.
-- Orphan files are placed in the lost+found directory.
(2) Unmount the file system before running fsck.
# fsck /data
*Documenting file system setup
-- Run the lsfs command.
-- Save the contents of the /etc/filesystems file.
-- Run the df command to check space allocation.
-- Check all the mounted file systems by running the mount command.