General discussion

Locked

What is the best way to PM a linux box?

By mshultz ·
I am curious what all of you linux admins do to PM your machines. I am a beginer with about 1 year of experience with linux so don't hold back the obvious answers. Whether it is a server or workstation, what are some of the best actions to take while PMing (Preventative Maintenance) the machine?

This conversation is currently closed to new comments.

13 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

A few ideas

by stress junkie In reply to What is the best way to P ...

In my opinion you can generate your own preventive maintenance task list by first understanding the platform, any platform, and understanding how it accomplishes its work. Then the role that the machine plays and how it's used will help to determine what needs to be done under what circumstances. Here are some ideas.

If the machine is a workstation and is likely to be restarted "frequently", as in daily or weekly, then the boot process can take care of a lot of preventive maintenance. For instance when you create a file system it is tuned to be checked during boot every 30th or 34th mount. You can tune this parameter to check the file system with fsck during boot on every 5th mount or whatever. The boot process can also be configured to clear temporary directories such as /tmp. This is a good time to clear these directories because during the boot process it is not possible for any process to be using a file in those directories so you can delete everything in these locations.

If the machine is running for long periods of time then you should probably do the things listed above using scheduled jobs. You should use the logrotate utility to archive existing logs when they get to big and start a new log in place of the archived log. This is configured using the file /etc/logrotate.conf and with the files in /etc/logrotate.d. You can get rid of old unused user files in the /tmp directory with a cron job with a command something like the following:

find /tmp -group users -atime +5 -exec rm {} \;

This command will delete files owned by users in the /tmp directory tree if they have not been accessed in over 5 days. If your user accounts have a temp directory in each account login directory such as /home/username/tmp you can make a find command to clear out these directories based on some criteria. Since most Linux machines are probably being used as servers so you probably don't have junk created by users that log in to the machine.

I hope this helps get you started. Maybe other people will contribute other ideas.

Collapse -

Good, thanks.

by mshultz In reply to A few ideas

Thanks SJ, I did not even know about fsck. Thanks again for your suggestions.

Collapse -

Any ideas would be great

by mshultz In reply to What is the best way to P ...

Any other ideas/comments would be great.

Collapse -

Check the logs

by kmiller In reply to Any ideas would be great

If you're logging anything (by default you'll be logging several things) be sure you're not putting the logs on the root filesystem. If you fill up the root, the machine will eventually stop responding and you'll have to reboot it. Don't ask how I know, but here's a hint - it was on a SCO box! As suggested earlier, make sure you're using logrotate on a reasonable schedule and you'll be fine, just don't log to the root. Look at the logs, if they're getting too big to manage, either log less or rotate more often.

Collapse -

Linux doesn't really need it PMing

by f-626541 In reply to What is the best way to P ...

Think about it:
1) How many viruses have been written for linux?
2) How often do you have to patch things?
3) When you do patch, how often do you have to reboot?
4) How often do you have kernel panics, the linux equivalent to the Blue Screen of Death?

Let's face it: in terms of reliability, cost, efficient use of machine resources, and ease of use, Linux is better than Windows

Collapse -

PM added

by emdreyes In reply to Linux doesn't really need ...

The only thing I do in a Linux box is to update kernel. I agree that Linux doesn't need much PM, coz if you fine tune your box correctly it will become stable rather than MS with Blue Screen.

Collapse -

Well

by mshultz In reply to PM added

I realize linux is more stable and self-reliant than windows but that's not what I'm asking. Linux is not an AI box, yet, so it's not going to straight fix itself; it's still going to need a little management and maintenance to stay running at the top.

Collapse -

A suggestion for everyone.

by Guapo In reply to What is the best way to P ...

If you have a tip, please post it with the name
and likely location of any file that needs
modification. While it may be obvious to you
where the startup files are and which one needs
to be modified to increase the frequency of fsck
on boot, (not picking on anyone, but that was
the first example found) most newbies won't even
know where to look.

BTW, one of the things I noticed very early on
in my Linux experience is that almost no PM is
needed. Just keep your system updated, and you
can forget all that defragging and virus update
nonsense.

Thanks.

Thanks.

Collapse -

Just watch disk space and memory

by jdclyde In reply to What is the best way to P ...

Command: df
I will once a month make a point to use the "df" command to make sure I don't have a file system getting too full. Just keep an eye on the available amount. /usr has 3Gig free. Fine for now.

Command: free
The other thing I watch for is if my system is getting taxed or not. Use the "free" command to see your memory useage. If you see during busy times of the day that you are hitting over 75% useage it is time to drop in more memory.
I do this during off times and busy times to see the difference between what the server is using to run and the demand the users are putting on it.
Shoot, I see out of 512M I only have 10M free. Need to go PM........

Command: uptime
This shows how long the system has been up, and what average demand on it has been. Just checked and my server was up 160 days.

In five years as linux admin I have had two crashes.
One was a toasted hard drive.
The other was a dumb co-worker created a symbolic link to it's self.

Good luck.

Collapse -

Some server hints

by robert.hendrickx In reply to What is the best way to P ...

There are some things you can do to follow the behaviour of your server (I've no experience in workstations).

First of all, keep track of some important resources counters, like disk occupation, memory consumption, network traffic, cpu use and so on. If you do that, you can first see an abnormal use of one of the resources, (which can reveal a malicious user or an internet attack), and second, you can follow the evolution of your needs, and for instance, install a new disk before the time your last byte is used.
For this, I use Cacti - http://www.raxnet.net/products/cacti/ - (something like an evolution of MRTG). It has a web interface, and give you graphics of these kind of things.

Second, Keep your data safe. If you can afford that, put your system partitions in mirroring, and depending on how critical are your data, put them also in mirroring (or RAID5), and take regular backups.

Third, mainly if your machine is an internet server, follow the last security patches for the exposed services. Even if there are less virus for *nix than for windoze, there are server expoits...

Last but not least, monitor yours services. This is more reactive than preventive, but learn via an automatic e-mail that the web server answer no more or that the network connectivity has a problem, is better than to wait for the users complaints. Therefore, I use Nagios - www.nagios.org - which is, I think, really powerfull.

Back to IT Employment Forum
13 total posts (Page 1 of 2)   01 | 02   Next

Related Forums