Come verificare lo stato del controller IBM 71P8592 RAID IDE 133
cd /proc/megaide/0    e fare "cat status"
  Come sapere che versione del kernel sta girando?
uname -r
  Come sapere quanto processore e' in uso?
ps -ef   la colonna 'C' indica l'uso recente della cpu
  Cosa fare se l'installazione si blocca con una schermata blu all'inizio?
provate a scrivere "linux mediacheck ide=nodma" non appena parte il cd di installazione
  In Fedora Core 4 Apache non visualizza i caratteri accentati nelle pagine web
Modificare httpd.conf mettendo "AddDefaultCharset ISO-8859-1" invece del default che e' UTF-8. Inoltre verificare che il supporto per l'italiano e' supportato dal sistema (da x-windows fare add-package e vedere i language installati)
  In Fedora Core 4 Apache e PHP5 apache non interpreta i file .php
Sempre che abbiate installato correttamente php, apache e i moduli php-apache verificare che in http.conf vi sia:

AddType application/x-httpd-php .php .php3 .php5

  Non so qual'e' il locale di default del sistema
Basta digitare il comando "locale"
  Voglio che il sistema parta di default in x-WINDOWS o testo
Editare il file /etc/inittab e inserire il runlevel preferito. Attenzione ai servizi che utilizzeranno /etc/rc.d/rc.RUNLEVEL
  In fedora core 4 il dns non vede le zone in "/var/named"
Questo perche' in fedora core 4 c'e' il chroot sul named. Cosi' le zona vanno messe in /var/named/chroot/var/named
  In fedora core 5 anche se installi il vsftp non figura in /etc/init.d o /etc/xinetd.d
Questo perche' per funzionare necessita semplicemente di "chkconfig vsftpd on" e del riavvio del sistema o di xinetd
  In fedora core 4 non mi funziona il passaggio di variabili con FORM POST e HTTP_POST con PHP
Cambiare le variabili di cui sotto che per default sono ad OFF in php5 e poi riavviare http


; Whether or not to register the old-style input arrays, HTTP_GET_VARS
; and friends. If you're not using them, it's recommended to turn them off,
; for performance reasons.
register_long_arrays = On


; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = On

 

  Come copiare file da un linux all'altro senza ftp
scp ztclock [email protected]:/tmp/
  Non esiste xinetd.d in fedora core 5
In realta' non si installa di default. Fare un bel "yum install xinetd" e si risolve il problema
  Qual'e' la velocita' del  mio hard-disk e dell'accesso a memoria? Come faccio ad aumentare la velocita' di accesso al disco?
Ecco i due valori:
[root@asterisk zaptel-1.2.3]# hdparm -Tt /dev/hdc

/dev/hdc:
Timing cached reads: 1272 MB in 2.01 seconds = 634.19 MB/sec
Timing buffered disk reads: 80 MB in 3.00 seconds = 26.65 MB/sec
[root@asterisk zaptel-1.2.3]#

 

So, you've got your brand-new UltraATA/66 EIDE drive with a screaming brand-new controller chipset that supports multiple PIO modes and DMA and the leather seat option and extra chrome... But is your system actually taking advantage of these snazzy features? The hdparm(8) command will not only tell you how your drives are performing, but will let you tweak them out to your heart's content.

Now before you get too excited, it is worth pointing out that under some circumstances, these commands CAN CAUSE UNEXPECTED DATA CORRUPTION! Use them at your own risk! At the very least, back up your box and bring it down to single-user mode before proceeding.

With the usual disclaimer out of the way, I'd like to point out that if you are using current hardware (i.e. your drive AND controller AND motherboard were manufactured in the last two or three years), you are at considerably lower risk. I've used these commands on several boxes with various hardware configurations, and the worst I've seen happen is the occasional hang, with no data problems on reboot. And no matter how much you might whine at me and the world in general for your personal misfortune, we all know who is ultimately responsible for the well-being of YOUR box: YOU ARE. Caveat Fair Reader.

Now, then. If I haven't scared you away yet, try this (as root, preferably in single-user mode):

hdparm -Tt /dev/hda

You'll see something like:

/dev/hda:
Timing buffer-cache reads: 128 MB in 1.34 seconds =95.52 MB/sec
Timing buffered disk reads: 64 MB in 17.86 seconds = 3.58 MB/sec

What does this tell us? The -T means to test the cache system (i.e., the memory, CPU, and buffer cache). The -t means to report stats on the disk in question, reading data not in the cache. The two together, run a couple of times in a row in single-user mode, will give you an idea of the performance of your disk I/O system. (These are actual numbers from a PII/350 / 128M Ram / newish EIDE HD; your numbers will vary.)

But even with varying numbers, 3.58 MB/sec is PATHETIC for the above hardware. I thought the ad for the HD said something about 66MB per second!!?!? What gives?

Well, let's find out more about how Linux is addressing your drive:

hdparm /dev/hda

/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 1870/255/63, sectors = 30043440, start = 0

These are the defaults. Nice, safe, but not necessarily optimal. What's all this about 16-bit mode? I thought that went out with the 386! And why are most of the other options turned off?

Well, it's generally considered a good idea for any self-respecting distribution to install itself in the kewlest, slickest, but SAFEST way it possibly can. The above settings are virtually guaranteed to work on any hardware you might throw at it. But since we know we're throwing something more than a dusty, 8-year-old, 16-bit multi-IO card at it, let's talk about the interesting options:

  • multcount: Short for multiple sector count. This controls how many sectors are fetched from the disk in a single I/O interrupt. Almost all modern IDE drives support this. The man page claims:

     
    When this feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%. On many systems, it also provides increased data throughput of anywhere from 5% to 50%.
  • I/O support: This is a big one. This flag controls how data is passed from the PCI bus to the controller. Almost all modern controller chipsets support mode 3, or 32-bit mode w/sync. Some even support 32-bit async. Turning this on will almost certainly double your throughput (see below.)

     
  • unmaskirq: Turning this on will allow Linux to unmask other interrupts while processing a disk interrupt. What does that mean? It lets Linux attend to other interrupt-related tasks (i.e., network traffic) while waiting for your disk to return with the data it asked for. It should improve overall system response time, but be warned: Not all hardware configurations will be able to handle it. See the manpage.

     
  • using_dma: DMA can be a tricky business. If you can get your controller and drive using a DMA mode, do it. But I have seen more than one machine hang while playing with this option. Again, see the manpage (and the example on the next page)!

 

hdparm -c3 -m16 /dev/hda

/dev/hda:
setting 32-bit I/O support flag to 3
setting multcount to 16
multcount = 16 (on)
I/O support = 3 (32-bit w/sync)

Great! 32-bit sounds nice. And some multi-reads might work. Let's re-run the benchmark:

hdparm -tT /dev/hda


/dev/hda:
 Timing buffer-cache reads:   128 MB in  1.41 seconds =90.78 MB/sec
 Timing buffered disk reads:  64 MB in  9.84 seconds = 6.50 MB/sec

WOW! Almost double the disk throughput without really trying! Incredible.

But wait, there's more: We're still not unmasking interrupts, using DMA, or even a using decent PIO mode! Of course, enabling these gets riskier. (Why is it always a trade-off between freedom and security?) The man page mentions trying Multiword DMA mode2, so:

hdparm -X34 -d1 -u1 /dev/hda

...Unfortunately this seems to be unsupported on this particular box (it hung like an NT box running a Java app.) So, after rebooting it (again in single-user mode), I went with this:

hdparm -X66 -d1 -u1 -m16 -c3 /dev/hda

/dev/hda:
setting 32-bit I/O support flag to 3
setting multcount to 16
setting unmaskirq to 1 (on)
setting using_dma to 1 (on)
setting xfermode to 66 (UltraDMA mode2)
multcount = 16 (on)
I/O support = 3 (32-bit w/sync)
unmaskirq = 1 (on)
using_dma = 1 (on)

And then checked:

hdparm -tT /dev/hda

/dev/hda:
Timing buffer-cache reads: 128 MB in 1.43 seconds =89.51 MB/sec
Timing buffered disk reads: 64 MB in 3.18 seconds =20.13 MB/sec

20.13 MB/sec. A far cry from the miniscule 3.58 we started with...

By the way, notice how we specified the -m16 and -c3 switch again? That's because it doesn't remember your hdparm settings between reboots. Be sure to add the above line (not the test line with -tT flags!) to your /etc/rc.d/* scripts once you're sure the system is stable (and preferably after your fsck runs; having an extensive fs check run with your controller in a flaky mode may be a good way to generate vast quantities of entropy, but it's no way to administer a system. At least not with a straight face...)

Now, after running the benchmark a few more times, reboot in multi-user mode and fire up X. Load Netscape. And try not to fall out of your chair.

 

  Come vedere l'uso di cpu
Usare il comando "top"
  Come vedere la velocita' della ethernet
[root@asterisk ~]# mii-tool
eth0: negotiated 100baseTx-FD flow-control, link ok
 
  Come sapere quali file sono dentro un rpm?
rpm -q --filesbypkg NOME.rpm

rpm -qi NOME     <-- fornisce tutte le informazioni  ad es.   rpm -qi iptables
 

  Come cambiare l' hostname?
 
 
Changing Linux Hostname

Guys you need to edit the following files:

/etc/hosts

/etc/sysconfig/network

then reboot.
 
  Come sistemare il timezone e il fuso orario e cambiare la data
cat /etc/sysconfig/clock

date 06131110   < 13 giugno ore 11.10

Settaggio data:

date -s "16:55:30 July 7, 1986"

Altra strada:

Verificare il clock del bios e accertarsi che usa utc (o gmt che e' lo stesso). Cosi' non ci sono problemi per l'ora legale

[root@elpi asterisk]# hwclock --systohc --utc

[root@elpi asterisk]# hwclock --show
Tue 03 Apr 2007 12:10:19 PM CEST -0.777725 seconds
[root@elpi asterisk]#

Se dopo che fate la modifica avete errori di "clock skew detected" perche', ad es., siete andati indietro con l'orario e alcuni file hanno il timestamp nel futuro. Correggerlo come segue:

 touch -m ./sendmail.cf

Il file sendmail.cf avra' il timestamp messo all'ora corrente

Con date +%s si vede la data epoch

PER SISTEMARE IL FUSO ORARIO (supponiamo di avere anche ntp attivo)

 cp /usr/share/zoneinfo/Europe/Rome /etc/localtime


Poi in /etc/sysconfig/clock vedere la timezone (che deve avere la corrispondenza giusta in /etc/localtime)

SE C'E' UNO SFASAMENTO DI UN'ORA non e' sbagliato il GMT ma solo non c'e' l'ora legale/solare (daylight saving time). Soluzone: installate "yum install tzdata"
 

  Come trovare file?
 

Usare il comando 'locate' che usa un database che si aggiorna ogni notte e che si puo' forzare con:

/etc/cron.daily/mlocate.cron
 

 find . -size +50000k -type f
file di dimensione di almeno 50 mega nella directory corrente (.)  mettersi in cd /

 

 

  Come sapere quanti file ci sono in una cartella
ls | wc -l
  Come sapere in quale file il comando grep ha trovato un match?
Supponiamo che abbiamo 1000 file in un folder e vogliamo sapere in quale file c'e' la stringa "gianrico@prova".
Il segreto e' usare l'opzione "-H". Le opzioni "-A2" e "-B2" indicano invece che vogliamo stampate anche le due righe antecedenti e conseguenti il match:

 

grep "gianrico@prova" -A2   -B2   -H   ./*

grep -v "pippo"   <-- e' la negazione della regexp: restituisce tutte le righe NON contenenti "pippo"

 Estrai da un file le sottostringhe che fanno match con una espressione regolare:

sed 's / . * \ ( PROVA \ / [0-9] \ {3\} \) .* /  \1 /' showchannels

Restituisce tutte le sottostringhe del tipo PROVA123  ovvero con tre digit finali. Ma attenzione al fatto che se non c'e' matching SED restituisce l'intera riga quindi prerequisito e' che ci sia un match in ogni riga. Con grep si puo' far modo che cio' accada.

Remove le linee duplicate:

uniq <nomefile>

 

  Come evitare che il comando 'cp' chieda sempre la conferma sulla cancellazione dei file?
$ \cp -f <filename> <path/to/existing_file>

Backslashing the command temporarily
 

  Come fare il mirror ISO dell'hard-disk per backup da un server locale ad un server remoto tramite ssh
dd if=/dev/mapper/vg00-data   |    ssh [email protected] "dd of=/root/pippo.iso"
 
  Voglio attivare il telnet
yum install telnet-server
jed /etc/xinetd.d/telnet   <-- mettere disabled no

service xinetd restart
 

    Voglio verificare in caso di crash del sistema o di un servizio cosa e' successo core dump
1)  Nel file di log del sistema messages andare a cercare il nome del file della cartella dove c'e' il dump:
 

Jul  1 12:00:54 5wind abrtd: Directory 'ccpp-1372672854-17380' creation detected
Jul  1 12:00:54 5wind abrt: saved core dump of pid 17380 to /var/cache/abrt/ccpp-1372672854-17380/coredump (618496 bytes)
Jul  1 12:00:57 5wind abrtd: Getting local universal unique identification...
Jul  1 12:00:57 5wind abrtd: Crash is in database already
Jul  1 12:00:57 5wind abrtd: Already saved crash, just sending dbus signal

2) Andare in cd /var/cache/abrt/ccpp-1372672854-17380/

[root@5wind ccpp-1372672854-17380]# ls -l
total 652
-rw-r--r-- 1 root root      4 2013-07-01 12:00 analyzer
-rw-r--r-- 1 root root      4 2013-07-01 12:00 architecture
-rw-r--r-- 1 root root     20 2013-07-01 12:00 cmdline
-rw-r--r-- 1 root root      7 2013-07-01 12:00 component
-rw-r--r-- 1 root root 618496 2013-07-01 12:00 coredump
-rw-r--r-- 1 root root     89 2013-07-01 12:00 description
-rw-r--r-- 1 root root     20 2013-07-01 12:00 executable
-rw-r--r-- 1 root root     26 2013-07-01 12:00 kernel
-rw-r--r-- 1 root root     32 2013-07-01 12:00 package
-rw-r--r-- 1 root root     34 2013-07-01 12:00 reason
-rw-r--r-- 1 root root     31 2013-07-01 12:00 release
-rw-r--r-- 1 root root     10 2013-07-01 12:00 time
-rw-r--r-- 1 root root      1 2013-07-01 12:00 uid

3) Analizzando i file si capisce esattamente cosa ha creato il crash, in questo caso la libreria "fprintd"

[root@5wind ccpp-1372672854-17380]# cat cmdline
/usr/libexec/fprintd

[root@5wind ccpp-1372672854-17380]# cat package
fprintd-0.1-15.git04fd09cfa.fc12