Outils pour utilisateurs

Outils du site


issue146:certifie_linux

Ceci est une ancienne révision du document !


Welcome back learners, and a nod to those “just interested”. We are continuing from last issue with the very first topic, capacity planning. We are still busy with resource availability and troubleshooting. Last issue, we covered memory. Memory forms only one leg of the CPU, RAM and DISK triangle. Ready? Disks are next on the menu. Just like with memory, let’s start simple.

Many of you will know lsof. If you do not, head over to the man page. I can see frowns appearing - how can a command that lists open files tell us anything about availability and troubleshooting a disk? I will tell you, lsof is like second tier support, once you have identified you actually have an issue. We are starting with something really easy, then easing you into more complex commands. Let’s assume you used something like sar or iostat to identify that something is amiss. Remember Linux treats everything like a file. When you are troubleshooting, you will be running this command as root and you will see lots of things you will not see as a user. (This means you will even be able to use lsof to look at things like network sockets!).

Okay we identified an issue, and we use lsof to see which files are using the disk. As you know lsof run as root gives you information overload, so we have to filter that. You can use “-u” to specify a user, so, if it is a web server, you can see which files Apache has open, for instance. If you have only desktop Linux, don’t worry, this will work just as well with your user, try it now. Have a look at my output on my laptop:

Now if you look at my “device” column, you will see 8,2. If you have a blank stare right now, I did too, the first time I saw it. Looking for the device is not simple either as ls -l /dev | grep 8,2 brings up no results! Do not wildcard it (ls -l /dev | grep 8,*) as it will just list anything with an 8 in it, instead, just use 8. Please try all three ways on your system now using YOUR device number, to see why.

Now, how do we bring it together? Well let’s say top or htop is giving you excessive usage in one of our resources, lsof will list the PID too and you need to match the two up. Then, from that bit of information, lsof now gives you the device, the node name, and so on, to help you diagnose your fault or performance issue.

How easy was that? I told you Linux was not difficult! Remember, LPI wants to know you can diagnose performance issues as it helps you plan for the future. I refer you back to the very first link about exam objectives. The key words are “measure” and “troubleshoot” and “capacity planning”.

Let us look at a typical exam question: In capacity planning exercises, which tools assist in listing and identifying processes of interest? (Choose TWO correct answers): A. acpid B. lsof C. pstree D. telinit b Since it cannot be A or D, it must be B and C. See how easy that was? acpid is not a command but an event notifier, and telinit tells your computer which runlevel you want to move to. Try them all in a terminal if you like.

If you would like to jump ahead, or test your skills at an LPI exam, do a test paper here: https://www.itexams.com/exam/117-201

These were once valid LPI questions and will ease you into the format.

*The new exam number is 201-400 and 117-201 was the old one. *The site does require signing up, but sign up with a temporary email, not your real email.

Let us know how you did – good or bad, it does not matter. Good means you are ready to write and confident in your skills. Bad means you will be learning new stuff!! Yay! There is no down-side here. If you do not know why an answer is the way it is, contact us.

issue146/certifie_linux.1562059843.txt.gz · Dernière modification : 2019/07/02 11:30 de auntiee