Editing
Routine Maintenance
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Infrequent tasks = == Free up space on gateway == <pre>newgateway /var/spool# cd clientmqueue/ newgateway /var/spool/clientmqueue# sh # for f in `ls`; do rm $f; done exit</pre> == Free up space on mail == You can clear out root mail: <pre> mail /var/log# ll -h /var/mail/root -rw------- 1 root mail 543K Dec 19 13:05 /var/mail/root mail /var/log# rm /var/mail/root </pre> Or you can archive mail logs: <pre> mail /var/log# ls -l htt* -rw-r--r-- 1 root wheel 297436931 Dec 19 13:26 httpd-access.log -rw-r--r-- 1 root wheel 9824324 Jul 4 11:34 httpd-access.log.old.0.gz -rw-r--r-- 1 root wheel 6884137 Mar 17 2012 httpd-access.log.old.1.gz -rw-r--r-- 1 root wheel 18557444 Dec 3 2009 httpd-access.log.old.10.gz -rw-r--r-- 1 root wheel 14740263 Jan 9 2007 httpd-access.log.old.11.gz -rw-r--r-- 1 root wheel 14209465 Nov 28 2007 httpd-access.log.old.12.gz -rw-r--r-- 1 root wheel 16874396 Feb 19 2012 httpd-access.log.old.3.gz -rw-r--r-- 1 root wheel 14554859 Jul 22 2011 httpd-access.log.old.4.gz -rw-r--r-- 1 root wheel 10513227 Feb 18 2011 httpd-access.log.old.5.gz -rw-r--r-- 1 root wheel 7201946 Oct 29 2010 httpd-access.log.old.6.gz -rw-r--r-- 1 root wheel 10062537 May 6 2010 httpd-access.log.old.7.gz -rw-r--r-- 1 root wheel 10157042 Aug 12 2010 httpd-access.log.old.8.gz -rw-r--r-- 1 root wheel 11909534 Mar 4 2010 httpd-access.log.old.9.gz -rw-r--r-- 1 root wheel 59030930 Dec 19 13:01 httpd-error.log -rw-r--r-- 1 root wheel 3413134 Mar 4 2010 httpd-error.log.0.gz -rw-r--r-- 1 root wheel 795515 May 1 2007 httpd-error.log.1.gz -rw-r--r-- 1 root wheel 1142153 Nov 30 2007 httpd-error.log.2.gz -rw-r--r-- 1 root wheel 2325801 Feb 18 2011 httpd-error.log.gz mail /var/log# sh # for f in 12 11 10 9 8 7 6 5 4 3 2 1 0; do g=`echo $f+1|bc`; mv httpd-access.log.old.$f.gz httpd-access.log.old.$g.gz; done # mv httpd-access.log httpd-access.log.old.0 # touch httpd-access.log # apachectl restart # gzip httpd-access.log.old.0 # for f in 2 1 0; do g=`echo $f+1|bc`; mv httpd-error.log.$f.gz httpd-error.log.$g.gz; done # mv httpd-error.log httpd-error.log.0 # touch httpd-error.log # apachectl restart # gzip httpd-error.log.0 # exit </pre> == Free up space on bwdb2 == You can either remove items from <tt>/usr/home/archive</tt> or you can scp them to backup3:/data/bwdb2/archive . == Free up space on backup1 == backup1 is our primary customer backup system. As usage grows over time, it needs to be regularly purged of old files. The easiest way to do this is by removing deprecated files. These mostly consist of cancelled customers or temporary dump/storage files (created during dump/restores). Our standard policy is to hang onto cancelled customers for 6mos after which we remove their files (as far as customers know their data is purged immediately, but we hang onto it just in case.. and in some cases we cancel a server due to non payment so this makes it easy to restore their system). To find files to remove: <pre>[root@backup1 ~]# cd /data/deprecated/ [root@backup1 /data/deprecated]# ls 2101-migrated-20120317.tgz old-683-cxld-20121021.tgz 69.55.230.2-wwwbackup old-744-cxld-20120708.tgz 991-DONTDELETE.tgz old-809-cxld-20120609.tgz archive-col02050-mdfile-cxld-20120409.gz old-854-cxld-20120621.tgz col01371.tgz old-931-cxld-20060513.tgz deleteme_ubuntu-10.10-x86_20111205 old-col00123-mdfile-noarchive-20120417.gz jail10_old old-col00147-vnfile-cxld-20120828.gz jail14_rsync_old old-col00419-dump-cxld-20120224.gz jail15_old old-col01098-vnfile-cxld-20120827.gz jail3_old old-col01278-dump-cxld-20120822 jail4_old old-col01517-dump-cxld-20120828 jail5_old old-col01669-dump-cxld-20120203.gz old-1009-cxld-20120608.tgz old-col01687-dump-cxld-20120909 old-1012-cxld-20120411.tgz old-col01790-dump-cxld-20120828 old-1052-cxld-20120721.tgz old-col01812-dump-cxld-20120820 old-10631-cxld-20120622.tgz old-col01938-mdfile-cxld-20120619.gz old-10632-cxld-20120622.tgz old-col02095-mdfile-noarchive-20120523.gz old-10633-cxld-20120622.tgz olddebian-3.0-v15-20110610.tgz old-1236-cxld-20120621.tgz oldmod_frontpage-deb30-v15-20110610.tgz old-1381-cxld-20120404.tgz oldmod_perl-deb30-v15-20110610.tgz old-1422-cxld-20120721.tgz oldmod_ssl-deb30-v15-20110610.tgz old-14681-cxld-20120619.tgz oldmysql-deb30-v15-20110610.tgz old-1544-cxld-20120626.tgz oldproftpd-deb30-v15-20110610.tgz old-18351-cxld-20120605.tgz old_virt14 old-1853-cxld-20120910.tgz old_virt18 old-1963-cxld-20120206.tgz oldwebmin-deb30-v15-20110610.tgz old-1967-cxld-20120605.tgz suse.virt11.20120421.tgz old-1981-noarchive-20120729.tgz virt11 old-2030-migrated-noarchive-20120727.tgz virt12_old old-2037-cxld-20120716.tgz virt13_old old-2065-cxld-20120727.tgz virt16_old old-2068-cxld-20120424.tgz virt4_old old-2085-cxld-20120531.tgz virt5_old old-364-cxld-20120904.tgz virt6_old old-446-cxld-20120512.tgz virt7_old old-613-cxld-20120601.tgz virt8_old [root@backup1 /data/deprecated]# </pre> virtX_old and jailX_old are permanently archived, so ignore those as well as anything else marked not to delete or otherwise suspicious. Likewise, probably a good idea to try to hang onto oldTEMPLATE.gz as long as we can as well. Most of the stuff we want to delete is dated when it was deprecated, making this easy. So to remove files from 6 mos ago (running this in Oct): <pre>[root@backup1 /data/deprecated]# ls old*201204* old-1012-cxld-20120411.tgz old-2068-cxld-20120424.tgz old-1381-cxld-20120404.tgz old-col00123-mdfile-noarchive-20120417.gz [root@backup1 /data/deprecated]# rm old*201204* </pre> Every few months you will also want to remove some of the snapshot archives for mail. We typically save the 1st, 10th, and 20th of each month. To do this you set aside the dates you want to save then remove months at a time, followed by restoring the set aside dates. Here's how that works: <pre>[root@backup1 /data/www/daily]# ls 05 08-10-11 10-04-10 11-10-10 12-07-29 12-09-21 12-11-14 06 08-10-21 10-04-20 11-10-20 12-07-30 12-09-22 12-11-15 06-06-01-usr-home.tgz 08-11-01 10-05-01 11-11-01 12-07-31 12-09-23 12-11-16 06-07-01-usr-home.tgz 08-11-10 10-05-11 11-11-10 12-08-01 12-09-24 12-11-17 06-08-01-usr-home.tgz 08-11-20 10-05-20 11-11-20 12-08-02 12-09-25 12-11-18 06-09-01-usr-home.tgz 08-12-01 10-06-01 11-12-01 12-08-03 12-09-26 12-11-19 06-11-10 08-12-10 10-06-10 11-12-10 12-08-04 12-09-27 12-11-20 06-12-21 08-12-20 10-06-20 11-12-20 12-08-05 12-09-28 12-11-21 07-01-10 09-01-01 10-07-01 12-01-01 12-08-06 12-09-29 12-11-22 07-01-20 09-01-10 10-07-10 12-01-10 12-08-07 12-09-30 12-11-23 07-02-10 09-01-20 10-07-20 12-01-20 12-08-08 12-10-01 12-11-24 07-02-20 09-02-01 10-08-01 12-02-01 12-08-09 12-10-02 12-11-25 07-03-01 09-02-10 10-08-10 12-02-10 12-08-10 12-10-03 12-11-26 07-03-20 09-02-20 10-08-20 12-02-20 12-08-11 12-10-04 12-11-27 07-04-01 09-03-01 10-09-01 12-03-01 12-08-12 12-10-05 12-11-28 07-04-10 09-03-10 10-09-10 12-03-10 12-08-13 12-10-06 12-11-29 07-04-20 09-03-20 10-09-20 12-03-20 12-08-14 12-10-07 12-11-30 07-05-01 09-04-01 10-10-01 12-04-01 12-08-15 12-10-08 12-12-01 07-05-10 09-04-10 10-10-10 12-04-10 12-08-16 12-10-09 12-12-02 07-05-20 09-04-20 10-10-20 12-04-20 12-08-17 12-10-10 12-12-03 07-06-01 09-05-01 10-11-01 12-05-01 12-08-18 12-10-11 12-12-04 07-06-10 09-05-10 10-11-10 12-05-10 12-08-19 12-10-12 12-12-05 07-06-20 09-05-20 10-11-20 12-05-20 12-08-20 12-10-13 12-12-06 07-07-20 09-06-01 10-12-01 12-06-01 12-08-21 12-10-14 12-12-07 07-08-10 09-06-10 10-12-10 12-06-10 12-08-22 12-10-15 12-12-08 07-08-20 09-06-20 10-12-20 12-06-20 12-08-23 12-10-16 12-12-09 07-09-01 09-07-01 11-01-01 12-07-01 12-08-24 12-10-17 12-12-10 07-10-01 09-07-10 11-01-10 12-07-02 12-08-25 12-10-18 12-12-11 07-10-10 09-07-20 11-01-21 12-07-03 12-08-26 12-10-19 12-12-12 07-10-20 09-08-01 11-02-01 12-07-04 12-08-27 12-10-20 12-12-13 07-12-01 09-08-10 11-02-10 12-07-05 12-08-28 12-10-21 12-12-14 07-12-10 09-08-20 11-02-20 12-07-06 12-08-29 12-10-22 12-12-15 08-01-01 09-09-01 11-03-01 12-07-07 12-08-30 12-10-23 12-12-16 08-01-20 09-09-10 11-03-10 12-07-08 12-08-31 12-10-24 12-12-17 08-02-20 09-09-20 11-03-20 12-07-09 12-09-01 12-10-25 12-12-18 08-03-01 09-10-01 11-04-01 12-07-10 12-09-02 12-10-26 12-12-19 08-03-10 09-10-10 11-04-10 12-07-11 12-09-03 12-10-27 12-12-20 08-03-20 09-10-20 11-04-20 12-07-12 12-09-04 12-10-28 12-12-21 08-04-01 09-11-01 11-05-01 12-07-13 12-09-05 12-10-29 12-12-22 08-04-20 09-11-10 11-05-10 12-07-14 12-09-06 12-10-30 12-12-23 08-05-01 09-11-20 11-05-20 12-07-15 12-09-07 12-10-31 12-12-24 08-05-10 09-12-01 11-06-01 12-07-16 12-09-08 12-11-01 12-12-25 08-06-10 09-12-10 11-06-10 12-07-17 12-09-09 12-11-02 12-12-26 08-06-20 09-12-20 11-06-20 12-07-18 12-09-10 12-11-03 12-12-27 08-07-02 10-01-01 11-07-01 12-07-19 12-09-11 12-11-04 12-12-28 08-07-10 10-01-10 11-07-10 12-07-20 12-09-12 12-11-05 2008-10-23 08-07-20 10-01-20 11-07-20 12-07-21 12-09-13 12-11-06 bb.tgz 08-08-01 10-02-01 11-08-01 12-07-22 12-09-14 12-11-07 boot 08-08-10 10-02-10 11-08-10 12-07-23 12-09-15 12-11-08 current 08-08-21 10-02-20 11-08-20 12-07-24 12-09-16 12-11-09 hold 08-09-01 10-03-01 11-09-01 12-07-25 12-09-17 12-11-10 08-09-10 10-03-10 11-09-10 12-07-26 12-09-18 12-11-11 08-09-21 10-03-20 11-09-20 12-07-27 12-09-19 12-11-12 08-10-01 10-04-01 11-10-01 12-07-28 12-09-20 12-11-13 [root@backup1 /data/www/daily]# </pre> So we see that everything up to July 2012 has been pruned. To prune July 2012 we do the following: <pre>mv 12-07-01 hold mv 12-07-10 hold mv 12-07-20 hold rm -fr 12-07* mv hold/* .</pre> == Free up space on Other Servers == Many servers start to run out of disk space over time. Often it is caused by unread mail for root or log files. To find the source of the problems, you use "du" to find where the disk space is being used. You can't do a du on /proc or /dev, so I use the command <pre> [root@virt11 /]# du -hs [a-c]* deprecated [e-o]* [q-u]* var | tee duhs0 which produces something like this. 4.0K backup 4.0K backup1 4.0K backup2 4.0K backup3 4.0K backup4 7.5M bin 47M boot 4.0K deprecated 92M etc 30M home 8.0K initrd 541M lib 16K lost+found 8.0K media 0 misc 8.0K mnt 0 net 92M opt 336K root 36M sbin 8.0K selinux 8.0K srv 0 sys 4.0K test 16K tmp 1.2G usr 583M var In this case it looks like /var is the problem, so cd /var du -hs * | tee duhs9 Produces 12K account 2.6M analog-5.32 63M cache 24K db 4.0K duhs 4.0K duhs1 4.0K duhs2 4.0K duhs3 4.0K duhs4 4.0K duhs5 4.0K duhs6 4.0K duhs7 4.0K duhs8 32K empty 8.0K games 16K kerberos 42M lib 8.0K local 36K lock 457M log 0 mail 8.0K nis 8.0K opt 8.0K preserve 8.0K racoon 240K run 18M spool 8.0K tmp 64K vz 0 vzagent 0 vzagent.tmp 16K vzquota 1.2M www 20K yp Usually, the problem is in /var/spool or /var/log, due to unread mail or excessive log files. You can continue to drill down by doing a "cd <sbdirectory>" and another "du -hs *". </pre>
Summary:
Please note that all contributions to JCWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JCWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information