16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Unix</strong> Administration<br />

rm -rf /tmp/ *, a typo could involve several hours<br />

Optimizing Performance<br />

! Rebuilding <strong>the</strong> filesystem<br />

Over time, files on <strong>the</strong> system become fragmented and spread <strong>the</strong>ir data over distant parts of <strong>the</strong> filesystem. To<br />

optimize system performance, <strong>the</strong> system should ideally be copied onto tape and rebuilt from scratch to enhance<br />

performance. The drives should also be reformatted to enhance reliability. (Only if you know what you're doing!!)<br />

! Super User<br />

- login as "root"<br />

- "su" - preferred<br />

! AT&T System V<br />

sar - system activity reporter (-a all)<br />

crash<br />

! BSD<br />

iostat<br />

uptime<br />

vrnstat<br />

pstat<br />

- number of chars (kbytes) read, written to term, disk, and cpu time as user mode, niced,<br />

in-system mode, idle mode.<br />

- display time, system up time, number of users, number of jobs<br />

- virtual memory statistics - procs, memory, page, faults, cpu<br />

- process statistics<br />

! Tunable Parameters<br />

NBUF - number of system buffers 250 (3 x number of ttys)<br />

NHBUF - number of hash buffers 64<br />

NPROC - number of process table entries/slots 250<br />

MAXUP - number of process a user can have 20<br />

MAXPROC - maximum number of system processes<br />

NCLIST - character minibuffers are called clists.<br />

TEXT<br />

NSWAP<br />

FILES<br />

MOUNTS<br />

CALLS<br />

- number of slots in text table<br />

- swap device should be at least size of memory<br />

- each process has 3: stdin, stdout and stderr<br />

- size of mount table<br />

- callout table - so that UNIX can operate in as close to real time as possible for applications<br />

Accounting<br />

<strong>Unix</strong> provides facilities for monitoring system performance, network traffic etc. The administrator may need to tune<br />

<strong>the</strong> system by reorganising filesystems or network links.<br />

utmp & wtmp - used by accounting<br />

struct utmp {<br />

char ut_user[8]; /* user login name */<br />

char ut_id[4]; /* /etc/line id */<br />

char ut_line[12]; /* device name (console) */<br />

short ut-pid; /* process id */<br />

short ut_type; /* type of entry */<br />

struct exit_status {<br />

short e_terrnrnination; /* process termination status */<br />

short e_exit; /* process exit status */<br />

}<br />

ut_exit;<br />

time_t ut_time<br />

/* time entry was made*/<br />

}<br />

od -c /etc/utmp | more<br />

198

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!