RedHat 5 Inhouse Schulung
-- Grafik Treiber Installieren.
-- DNS Domain einrichten (Name Server einrichten)
-- Software Paketmangment (rpm ).
- extended Partion create anlegen and 4 logical Partitionen.
- "Raid 5" drei Platten und eine HotSpare Disks
- Simulieren das eine Disk kaputt geht
- LV extend , vgdata-datenbank extend to 900MB.
-- PV attach to VG and LV extend to 1,5G
-- ein Stripe erstellen über zwei LV
- PV in eine bestehende VG hinzufügen.
-- Bestehende "Raid 5" einbinden und Filesystem erstellen.
- anschauen vom inhalt des snap shorts.
-- Softwareverwaltung / Packagemanagment.
- RPM in ein YUM Repository integrieren.
http://www.linuxjournal.com/article/4445
-- Dienst anlegen
[root@localhost ~]# vi /usr/local/bin/myservice
#!/bin/sh
## das ist mein Dienst mydienst
#
# Alle 30 Sec wird bei laufenden dienst ein neuer eintrag in der log datei erzeugt.#!/bin/sh
#
while [ 1 -eq 1 ]; do
echo "HAllo Welt: $(date)" >> /var/log/myservice.log
sleep 30
done
- Dienst ausführen.
./myservice
- Datei in init.d erstellen.
root@localhost init.d]# more /etc/init.d/myservice
#!/bin/sh
#
#stop start scripte
#
# chkconfig: 2345 60 20
# description: Besonders wichtiger Dienst
#
#### Info: 2345 Runlevel
#### Info: 60 name S60myservice
#### Info: 20 name K20myservice
case $1 in
start)
echo "start myservice"
if [ -f /var/run/myservice.pid ]; then
echo "myservice läuft bereits"
exit 1
fi
/usr/local/bin/myservice &
PID=$! //enthält die PID
echo $PID > /var/run/myservice.pid
;;
stop)
if [ ! -f /var/run/myservice.pid ]; then
echo "myservice läuft nicht, wird nicht gestoppt"
exit 1
fi
echo "stop myservice"
PID=$(cat /var/run/myservice.pid)
kill $PID
rm -f /var/run/myservice.pid
;;
restart)
$0 stop
$0 start
echo "restart myservice"
;;
*)
echo "usage : $0 {start|stop|restart}"
;;
esac
- Dienst einbinden in chkconfig (RunLevel), links werden autom. kreiert.
[root@localhost ~]# chkconfig --add myservice
[root@localhost ~]# chkconfig --list myservice
myservice 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost etc]# ls -la rc*.d/*myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc0.d/K20myservice -> ../init.d/myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc1.d/K20myservice -> ../init.d/myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc2.d/S60myservice -> ../init.d/myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc3.d/S60myservice -> ../init.d/myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc4.d/S60myservice -> ../init.d/myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc5.d/S60myservice -> ../init.d/myservice
lrwxrwxrwx 1 root root 19 Jul 13 15:46 rc6.d/K20myservice -> ../init.d/myservice
- Eine Konfigurations Datei erstellen
Unter /etc/sysconfig eine Datei myservice anlegen.
[root@localhost sysconfig]# more /etc/sysconfig/myservice
#Config Datei myservice
# Time = Intevall zwieschen 2 Logineinträgen, in sec.
TIME=10
[root@localhost network-scripts]# more /usr/local/bin/myservice
#!/bin/sh
## das ist mein Dienst mydienst
#
# Alle 10 Sec wird bei laufenden dienst ein neuer eintrag in der log datei erzeugt.#!/bi
n/sh
#
if [ -f /etc/sysconfig/myservice ] ; then
. /etc/sysconfig/myservice
else
echo "etc/sysconfig/myservice existiert nicht, beendet mich"
exit 1
fi
while [ 1 -eq 1 ]; do
echo -n "HAllo Welt: $(date)" >> /var/log/myservice.log
echo " ---> sleep $TIME Sec" >> /var/log/myservice.log
sleep $TIME
done
# system-config-network
- überprüfen
[root@localhost ]# more /etc/sysconfig/network-scripts/ifcfg-eth0
# nVidia Corporation MCP51 Ethernet Controller
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1D:60:37:A4:4F
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.0.109
GATEWAY=192.168.0.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
- Welche Dateien wurde durch „ system-config-network „ geändert.
[root@localhost network-scripts]# find /etc -type f -cmin -5 |xargs grep 192.168.0.109
/etc/sysconfig/network-scripts/ifcfg-eth0:IPADDR=192.168.0.109
/etc/sysconfig/networking/devices/ifcfg-eth0:IPADDR=192.168.0.109
/etc/sysconfig/networking/profiles/default/ifcfg-eth0:IPADDR=192.168.0.109
1.) /etc/nsswitch.conf
hosts: files oder dns
2.) wenn dns dann lesen der /etc/resolv.conf datei
[root@ws09 etc]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
-- Grafik Treiber Installieren.
à Zum erreichen ein besseren auflösung.
sh NVIDIA-Linux-x86_64-185.18.14-pkg2.run
-- DNS Domain einrichten (Name Server einrichten)
- /etc/hosts eintrag durchführen.
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
192.168.0.109 ws09.windmuehl.linux ws09
[root@ws09 ~]# /etc/init.d/sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
oder so:
[root@ws09 ~]# service sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
-- Name server einrichten, siehe verzeichmis Dienstag_verz auf USB Stick
[root@ws09 ~]# vi /etc/named.conf
options
{
directory "/var/named"; // the default
};
view "localhost_resolver"
{
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "named.root.hints";
include "named.rfc1912.zones";
};
view "internal"
{
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
include "named.root.hints";
zone "windmuehl.linux" {
type master;
file "windmuehl.linux.zone";
};
};
- noch dies datei erstellen. ws00 ist admin Station
[root@ws09 ~]# vi /var/named/windmuehl.linux.zone
$TTL 86400
@ IN SOA @ root (
2009071401
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS ws00.windmuehl.linux.
IN A 192.168.0.100
ws00 IN A 192.168.0.100
ws01 IN A 192.168.0.101
ws02 IN A 192.168.0.102
ws03 IN A 192.168.0.103
ws04 IN A 192.168.0.104
ws05 IN A 192.168.0.105
ws06 IN A 192.168.0.106
ws07 IN A 192.168.0.107
ws08 IN A 192.168.0.108
ws09 IN A 192.168.0.109
ws10 IN A 192.168.0.110
[root@ws09 slaves]# pwd
/var/named/
[root@ws09 slaves]# cp /usr/share/doc/bind-9.3.4/sample/etc/named.rfc1912.zones .
[root@ws09 slaves]# cp /usr/share/doc/bind-9.3.4/sample/etc/named.root.hints .
[root@ws09 slaves]# cp /usr/share/doc/bind-9.3.4/sample/etc/localhost.zone .
[root@ws09 slaves]# cp /usr/share/doc/bind-9.3.4/sample/etc/named.local .
[root@ws09 slaves]# cp /usr/share/doc/bind-9.3.4/sample/etc/named.broadcast .
à falls "named.root" nicht vor mit wget ftp://ftp.rs.internic.net/domain/named.root aus Internet hollen.
Zur Info: diese Dateien werden benötigt.
[root@localhost named]# pwd
/var/named
[root@localhost named]# ls -l
drwxrwx--- 2 named named 4096 Jan 6 2009 data
-rw-r--r-- 1 root root 198 Jul 14 10:07 localdomain.zone
-rw-r--r-- 1 root root 195 Jul 14 10:07 localhost.zone
-rw-r--r-- 1 root root 427 Jul 14 10:07 named.broadcast
-rw-r--r-- 1 root root 426 Jul 14 10:07 named.local
-rw-r--r-- 1 root root 617 Jul 14 10:06 named.rfc1912.zones
-rw-r--r-- 1 root root 2940 Jul 14 09:58 named.root
-rw-r--r-- 1 root root 524 Jul 14 09:52 named.root.hints
-rw-r--r-- 1 root root 427 Jul 14 10:07 named.zero
drwxrwx--- 2 named named 4096 Jan 6 2009 slaves
-rw-r--r-- 1 root root 765 Jul 14 09:51 windmuehl.linux.zone
/etc/init.d/named start
- resolv.conf editieren.
[root@ws09 ~]# more /etc/resolv.conf
nameserver 192.168.0.100
search windmuehl.linux
tcpdump
- Wireshark (Grafig Tool für tcpdump) Package installieren
à erhält man eine abhängigkeit zu anderen pkg
[root@ws09 Server]# rpm -Uvh wireshark-*
warning: wireshark-1.0.3-4.el5_2.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libsmi.so.2()(64bit) is needed by wireshark-1.0.3-4.el5_2.x86_64
libsmi is needed by wireshark-gnome-1.0.3-4.el5_2.x86_64
libsmi.so.2()(64bit) is needed by wireshark-gnome-1.0.3-4.el5_2.x86_64
- zusatz Package installieren.
[root@ws09 Server]# rpm -Uvh wireshark-* libsmi-0.4.5-2.el5.x86_64.rpm
[root@localhost etc]# rpm -q dhcp
dhcp-3.0.5-18.el5
[root@localhost etc]# more /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "windmuehl.linux";
option domain-name-servers 192.168.0.100;
range 192.168.0.200 192.168.0.220;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ws08 {
hardware ethernet 00:1D:60:37:A4:DB;
fixed-address 192.168.0.108;
}
}
/etc/init.d/dhcp start
- output.
[root@localhost etc]# chkconfig --list |grep dhc
dhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dhcrelay 0:off 1:off 2:off 3:off 4:off 5:off 6:off
- auf client "dhclient" aufrufen um eine Ip zu erhalten von der Range.
-- Software Paketmangment (rpm ).
rpm -q quers
-qa all
-qi info
-qf file
-qp package
rpm -i install
-u update
-v verbose
-h hashes
- Ausgang Sitution. haben nur eine Disk,
[root@ws09 ~]# fdisk -l
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
- extended Partion create anlegen and 4 logical Partitionen.
- 1 Erweiterte Partion anlegen und 4 logical Partitionen.
[root@ws09 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 9729.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 4
First cylinder (8160-9729, default 8160):
Using default value 8160
Last cylinder or +size or +sizeM or +sizeK (8160-9729, default 9729):
Using default value 9729
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (8160-9729, default 8160):
Using default value 8160
Last cylinder or +size or +sizeM or +sizeK (8160-9729, default 9729): +2G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (8404-9729, default 8404):
Using default value 8404
Last cylinder or +size or +sizeM or +sizeK (8404-9729, default 9729): +2G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (8648-9729, default 8648):
Using default value 8648
Last cylinder or +size or +sizeM or +sizeK (8648-9729, default 9729): +2G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (8892-9729, default 8892):
Using default value 8892
Last cylinder or +size or +sizeM or +sizeK (8892-9729, default 9729): +2G
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
/dev/sda5 8160 8403 1959898+ 83 Linux
/dev/sda6 8404 8647 1959898+ 83 Linux
/dev/sda7 8648 8891 1959898+ 83 Linux
/dev/sda8 8892 9135 1959898+ 83 Linux
Command (m for help): t
Partition number (1-8): 5
Hex code (type L to list codes): fd
Changed system type of partition 6 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-8): 6
Hex code (type L to list codes): fd
Changed system type of partition 6 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-8): 7
Hex code (type L to list codes): fd
Changed system type of partition 7 to fd (Linux raid autodetect)
Command (m for help): t
Partition number (1-8): 8
Hex code (type L to list codes): fd
Changed system type of partition 8 to fd (Linux raid autodetect)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
/dev/sda5 8160 8403 1959898+ fd Linux raid autodetect
/dev/sda6 8404 8647 1959898+ fd Linux raid autodetect
/dev/sda7 8648 8891 1959898+ fd Linux raid autodetect
/dev/sda8 8892 9135 1959898+ fd Linux raid autodetect
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
oder:
[root@ws09 ~]# partprobe //PatitionsTable wird aktualisiert /proc/partitions
- Strip Set über drei Platten, kapazitet 6GB, siehe MAN Patches
[root@ws09 ~]# mdadm --create /dev/md0 --level=0 --raid-devices=3 /dev/sda[567]
mdadm: array /dev/md0 started.
[root@ws09 ~]# more /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sda7[2] sda6[1] sda5[0]
5879424 blocks 64k chunks
unused devices: <none>
[root@ws09 ~]# mdadm --query --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Jul 14 14:01:07 2009
Raid Level : raid0
Array Size : 5879424 (5.61 GiB 6.02 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Tue Jul 14 14:01:07 2009
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Chunk Size : 64K
UUID : 49723a57:0e0601a1:443afb8a:e5974cfb
Events : 0.1
Number Major Minor RaidDevice State
0 8 5 0 active sync /dev/sda5
1 8 6 1 active sync /dev/sda6
2 8 7 2 active sync /dev/sda7
[root@ws09 ~]# fdisk -l
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
/dev/sda5 8160 8403 1959898+ fd Linux raid autodetect
/dev/sda6 8404 8647 1959898+ fd Linux raid autodetect
/dev/sda7 8648 8891 1959898+ fd Linux raid autodetect
/dev/sda8 8892 9135 1959898+ fd Linux raid autodetect
Disk /dev/md0: 6020 MB, 6020530176 bytes
2 heads, 4 sectors/track, 1469856 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table
[root@ws09 ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: ST380815AS Rev: 3.AA
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
Vendor: USB Model: Flash Disk Rev: 1100
Type: Direct-Access ANSI SCSI revision: 02
[root@ws09 ~]# mkfs.ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
735840 inodes, 1469856 blocks
73492 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1505755136
45 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@ws09 ~]# mount /dev/md0 /mnt
[root@ws09 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 3.1G 51G 6% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sdb1 3.8G 3.1G 691M 82% /media/BRNUSAK
/dev/md0 5.6G 140M 5.2G 3% /mnt
umount /mnt
[root@ws09 ~]# mdadm --manage --stop /dev/md0
mdadm: stopped /dev/md0
Zur Info:
ist nicht gelöscht, sonderm gestop, kann wider zu leben erweckt werden(mit examine)
- "Raid 5" drei Platten und eine HotSpare Disks
[root@ws09 ~]# mdadm --create /dev/md0 --level=5 --spare-devices=1 --raid-devices=3 /dev/sda[5678]
mdadm: /dev/sda5 appears to contain an ext2fs file system
size=5879424K mtime=Tue Jul 14 14:49:53 2009
mdadm: /dev/sda5 appears to be part of a raid array:
level=raid0 devices=3 ctime=Tue Jul 14 14:01:07 2009
mdadm: /dev/sda6 appears to be part of a raid array:
level=raid0 devices=3 ctime=Tue Jul 14 14:01:07 2009
mdadm: /dev/sda7 appears to be part of a raid array:
level=raid0 devices=3 ctime=Tue Jul 14 14:01:07 2009
Continue creating array? y
- Alle 1 sec. werde die AUsgabe aktualisieren.
[root@ws09 ~]# watch -n1 cat /proc/mdstat
//das ist der Output
Every 1.0s: cat /proc/mdstat Tue Jul 14 15:37:21 2009
Personalities : [raid0] [raid6] [raid5] [raid4]
md0 : active raid5 sda7[4] sda8[3](S) sda6[1] sda5[0]
3919616 blocks level 5, 64k chunk, algorithm 2 [3/2] [UU_]
[====>................] recovery = 20.2% (396416/1959808) finish=2.6min speed=9705K/sec
unused devices: <none>
STG+C
[root@ws09 Desktop]# more /proc/mdstat
Personalities : [raid0] [raid6] [raid5] [raid4]
md0 : active raid5 sda7[2] sda8[3](S) sda6[1] sda5[0]
3919616 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
unused devices: <none>
[root@ws09 Desktop]# mkfs.ext3 /dev/md0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
490560 inodes, 979904 blocks
48995 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1006632960
30 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@ws09 Desktop]# mount /dev/md0 /mnt
[root@ws09 Desktop]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 3.1G 51G 6% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sdb1 3.8G 3.1G 691M 82% /media/BRNUSAK
/dev/md0 3.7G 72M 3.5G 3% /mnt
[root@ws09 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Jul 14 15:36:40 2009
Raid Level : raid5
Array Size : 3919616 (3.74 GiB 4.01 GB)
Used Dev Size : 1959808 (1914.20 MiB 2006.84 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Tue Jul 14 15:43:50 2009
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
UUID : d8f0d838:b41265d3:5d2af310:af9419b2
Events : 0.2
Number Major Minor RaidDevice State
0 8 5 0 active sync /dev/sda5
1 8 6 1 active sync /dev/sda6
2 8 7 2 active sync /dev/sda7
3 8 8 - spare /dev/sda8
- Simulieren das eine Disk kaputt geht
[root@ws09 Desktop]# mdadm --manage /dev/md0 --fail /dev/sda6
mdadm: set /dev/sda6 faulty in /dev/md0
- Hir wird die Platte autom. getauscht im "Raid 5"
[root@ws09 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Jul 14 15:36:40 2009
Raid Level : raid5
Array Size : 3919616 (3.74 GiB 4.01 GB)
Used Dev Size : 1959808 (1914.20 MiB 2006.84 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Tue Jul 14 15:51:57 2009
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 1
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 29% complete
UUID : d8f0d838:b41265d3:5d2af310:af9419b2
Events : 0.4
Number Major Minor RaidDevice State
0 8 5 0 active sync /dev/sda5
3 8 8 1 spare rebuilding /dev/sda8
2 8 7 2 active sync /dev/sda7
4 8 6 - faulty spare /dev/sda6
[root@ws09 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Tue Jul 14 15:36:40 2009
Raid Level : raid5
Array Size : 3919616 (3.74 GiB 4.01 GB)
Used Dev Size : 1959808 (1914.20 MiB 2006.84 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Tue Jul 14 15:55:30 2009
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 1
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : d8f0d838:b41265d3:5d2af310:af9419b2
Events : 0.6
Number Major Minor RaidDevice State
0 8 5 0 active sync /dev/sda5
1 8 8 1 active sync /dev/sda8
2 8 7 2 active sync /dev/sda7
3 8 6 - faulty spare /dev/sda6
- Noch Infos über die defecte Platte, mit den Flag (F).
[root@ws09 ~]# cat /proc/mdstat
Personalities : [raid0] [raid6] [raid5] [raid4]
md0 : active raid5 sda7[2] sda8[1] sda6[3](F) sda5[0]
3919616 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]
unused devices: <none>
- defecte Disk kann mann jetzt herrausnemmen.
hda1 hdc1 (PV:s on partitions or whole disks or Raid Array)
\ /
\ /
diskvg (VG)
/ | \
/ | \
usrlv rootlv varlv (LV:s)
| | |
ext2 reiserfs xfs (filesystems)
- erzeugen zusätzlich partion auf disk erstellen.
[root@ws09 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 9729.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
/dev/sda5 8160 8403 1959898+ fd Linux raid autodetect
/dev/sda6 8404 8647 1959898+ fd Linux raid autodetect
/dev/sda7 8648 8891 1959898+ fd Linux raid autodetect
/dev/sda8 8892 9135 1959898+ fd Linux raid autodetect
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (9136-9729, default 9136):
Using default value 9136
Last cylinder or +size or +sizeM or +sizeK (9136-9729, default 9729): +1G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (9259-9729, default 9259):
Using default value 9259
Last cylinder or +size or +sizeM or +sizeK (9259-9729, default 9729): +1G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (9382-9729, default 9382):
Using default value 9382
Last cylinder or +size or +sizeM or +sizeK (9382-9729, default 9729): +1G
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (9505-9729, default 9505):
Using default value 9505
Last cylinder or +size or +sizeM or +sizeK (9505-9729, default 9729): +1G
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
/dev/sda5 8160 8403 1959898+ fd Linux raid autodetect
/dev/sda6 8404 8647 1959898+ fd Linux raid autodetect
/dev/sda7 8648 8891 1959898+ fd Linux raid autodetect
/dev/sda8 8892 9135 1959898+ fd Linux raid autodetect
/dev/sda9 9136 9258 987966 83 Linux
/dev/sda10 9259 9381 987966 83 Linux
/dev/sda11 9382 9504 987966 83 Linux
/dev/sda12 9505 9627 987966 83 Linux
Command (m for help): t
Partition number (1-12): 9
Hex code (type L to list codes): 8e
Changed system type of partition 9 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-12): 10
Hex code (type L to list codes): 8e
Changed system type of partition 10 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-12): 11
Hex code (type L to list codes): 8e
Changed system type of partition 11 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-12): 12
Hex code (type L to list codes): 8e
Changed system type of partition 12 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 7649 61440561 83 Linux
/dev/sda2 7650 8159 4096575 82 Linux swap / Solaris
/dev/sda4 8160 9729 12611025 5 Extended
/dev/sda5 8160 8403 1959898+ fd Linux raid autodetect
/dev/sda6 8404 8647 1959898+ fd Linux raid autodetect
/dev/sda7 8648 8891 1959898+ fd Linux raid autodetect
/dev/sda8 8892 9135 1959898+ fd Linux raid autodetect
/dev/sda9 9136 9258 987966 8e Linux LVM
/dev/sda10 9259 9381 987966 8e Linux LVM
/dev/sda11 9382 9504 987966 8e Linux LVM
/dev/sda12 9505 9627 987966 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
- reboot des systems.
[root@ws09 ~]# init 6
oder:
[root@ws09 ~]# partprobe //PatitionsTable wird aktualisiert /proc/partitions
[root@ws09 ~]# pvcreate /dev/sda9
Physical volume "/dev/sda9" successfully created
[root@ws09 ~]# pvcreate /dev/sda10
Physical volume "/dev/sda10" successfully created
[root@ws09 ~]# pvcreate /dev/sda11
Physical volume "/dev/sda11" successfully created
[root@ws09 ~]# pvcreate /dev/sda12
Physical volume "/dev/sda12" successfully created
[root@ws09 ~]# pvdisplay
"/dev/sda9" is a new physical volume of "964.81 MB"
--- NEW Physical volume ---
PV Name /dev/sda9
VG Name
PV Size 964.81 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID SY0x0D-yS8M-ZszX-07H4-kijr-tOWj-8SykBt
"/dev/sda10" is a new physical volume of "964.81 MB"
--- NEW Physical volume ---
PV Name /dev/sda10
VG Name
PV Size 964.81 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID R2c4ZK-m1Gq-h0Y8-GSKp-XZxo-e3I2-zCzpyE
"/dev/sda11" is a new physical volume of "964.81 MB"
--- NEW Physical volume ---
PV Name /dev/sda11
VG Name
PV Size 964.81 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID LThMSA-xw8K-TuuF-G462-SMM6-wXO5-Uu0nsh
"/dev/sda12" is a new physical volume of "964.81 MB"
--- NEW Physical volume ---
PV Name /dev/sda12
VG Name
PV Size 964.81 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 2fzLaM-BxJv-ZnGb-Zfgk-95er-TnqF-SzZGRv
[root@ws09 ~]# pvscan
PV /dev/sda9 lvm2 [964.81 MB]
PV /dev/sda10 lvm2 [964.81 MB]
PV /dev/sda11 lvm2 [964.81 MB]
PV /dev/sda12 lvm2 [964.81 MB]
Total: 4 [3.77 GB] / in use: 0 [0 ] / in no VG: 4 [3.77 GB]
[root@ws09 ~]# vgcreate vgdata /dev/sda9
Volume group "vgdata" successfully created
[root@ws09 ~]# vgdisplay
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 964.00 MB
PE Size 4.00 MB
Total PE 241 ## Physical Extends, kleinste Einheit in einer VG (standart: 4MB)
Alloc PE / Size 0 / 0
Free PE / Size 241 / 964.00 MB
VG UUID LDoM3e-Giqb-mTgq-PUPY-FlGK-dFc9-kPYs8Q
[root@ws09 ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vgdata" using metadata type lvm2
[root@ws09 mydb]# lvextend -L +100 /dev/vgdata/datenbank
Extending logical volume datenbank to 900.00 MB
Logical volume datenbank successfully resized
[root@ws09 mydb]# resize2fs /dev/vgdata/datenbank
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vgdata/datenbank is mounted on /data/mydb; on-line resizing required
Performing an on-line resize of /dev/vgdata/datenbank to 230400 (4k) blocks.
The filesystem on /dev/vgdata/datenbank is now 230400 blocks long.
- LV create (Logical Volume).
[root@ws09 ~]# lvcreate -L 800M -n datenbank vgdata
Logical volume "datenbank" created
[root@ws09 ~]# lvdisplay
--- Logical volume ---
LV Name /dev/vgdata/datenbank
VG Name vgdata
LV UUID bP247U-CFyG-39Pz-RDve-eS2a-wAmq-CTEdcv
LV Write Access read/write
LV Status available
# open 0
LV Size 800.00 MB
Current LE 200
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@ws09 ~]# lvscan
ACTIVE '/dev/vgdata/datenbank' [800.00 MB] inherit
[root@ws09 ~]# mkfs.ext3 /dev/vgdata/datenbank
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
102592 inodes, 204800 blocks
10240 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=209715200
7 block groups
32768 blocks per group, 32768 fragments per group
14656 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@ws09 ~]# mkdir /data
[root@ws09 ~]# mkdir /data/mydb
[root@ws09 ~]# mount /dev/vgdata/datenbank /data/mydb/
- einbind in die fstab.
[root@ws09 ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/vgdata/datenbank /data/mydb ext3 defaults 0 0
[root@ws09 ~]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdb1 on /media/BRNUSAK type vfat (rw,noexec,nosuid,nodev,shortname=winnt,uid=0)
/dev/mapper/vgdata-datenbank on /data/mydb type ext3 (rw)
[root@ws09 ~]# ll /dev/vgdata/
lrwxrwxrwx 1 root root 28 Jul 15 09:42 datenbank -> /dev/mapper/vgdata-datenbank
[root@ws09 ~]# ll /dev/mapper/
crw------- 1 root root 10, 63 Jul 15 09:21 control
brw-rw---- 1 root disk 253, 0 Jul 15 09:44 vgdata-datenbank
Info: DM = Device Mapper
[root@ws09 ~]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 59515524 3254208 53189288 6% /
tmpfs 2007336 0 2007336 0% /dev/shm
/dev/sdb1 3908100 3202692 705408 82% /media/BRNUSAK
/dev/mapper/vgdata-datenbank
806288 17216 748112 3% /data/mydb
- füllen des Mountpoint mit info.
[root@ws09 ~]# dd if=/dev/urandom of=/data/mydb/dbfile01 bs=1k count=600000
[root@ws09 mydb]# du -h *
587M dbfile01
16K lost+found
- LV extend , vgdata-datenbank extend to 900MB.
- vergrößern des LV, vgdata-datenbank vergrößern auf 900MB.
[root@ws09 mydb]# lvextend -L +100 /dev/vgdata/datenbank
Extending logical volume datenbank to 900.00 MB
Logical volume datenbank successfully resized
Info: filesystem wurde noch nicht aktualiseren.
[root@ws09 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 3.2G 51G 6% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sdb1 3.8G 3.1G 689M 82% /media/BRNUSAK
/dev/mapper/vgdata-datenbank
788M 604M 145M 81% /data/mydb
- Jetzt wird auch das Filesystem aktualisieren.
[root@ws09 mydb]# resize2fs /dev/vgdata/datenbank
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vgdata/datenbank is mounted on /data/mydb; on-line resizing required
Performing an on-line resize of /dev/vgdata/datenbank to 230400 (4k) blocks.
The filesystem on /dev/vgdata/datenbank is now 230400 blocks long.
[root@ws09 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 3.2G 51G 6% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sdb1 3.8G 3.1G 689M 82% /media/BRNUSAK
/dev/mapper/vgdata-datenbank
886M 604M 242M 72% /data/mydb
-- PV attach to VG and LV extend to 1,5G
[root@ws09 ~]# pvcreate /dev/sda10
Physical volume "/dev/sda10" successfully created
[root@ws09 ~]# vgextend vgdata /dev/sda10
Volume group "vgdata" successfully extended
[root@ws09 ~]# vgdisplay
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2 //aus zwei PV besteht diese VG
Act PV 2
VG Size 1.88 GB
PE Size 4.00 MB
Total PE 482
Alloc PE / Size 225 / 900.00 MB
Free PE / Size 257 / 1.00 GB
VG UUID LDoM3e-Giqb-mTgq-PUPY-FlGK-dFc9-kPYs8Q
[root@ws09 ~]# pvscan
PV /dev/sda9 VG vgdata lvm2 [964.00 MB / 64.00 MB free]
PV /dev/sda10 VG vgdata lvm2 [964.00 MB / 964.00 MB free]
PV /dev/sda11 lvm2 [964.81 MB]
PV /dev/sda12 lvm2 [964.81 MB]
Total: 4 [3.77 GB] / in use: 2 [1.88 GB] / in no VG: 2 [1.88 GB]
[root@ws09 ~]# lvextend -L +600 /dev/vgdata/datenbank
Extending logical volume datenbank to 1.46 GB
Logical volume datenbank successfully resized
oder: lvextend -L 1500 /dev/vgdata/datenbank
- Jetzt wird auch das Filesystem aktualisieren.
[root@ws09 ~]# resize2fs /dev/vgdata/datenbank
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vgdata/datenbank is mounted on /data/mydb; on-line resizing required
Performing an on-line resize of /dev/vgdata/datenbank to 384000 (4k) blocks.
The filesystem on /dev/vgdata/datenbank is now 384000 blocks long.
[root@ws09 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 3.2G 51G 6% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sdb1 3.8G 3.1G 689M 82% /media/BRNUSAK
/dev/mapper/vgdata-datenbank
1.5G 604M 811M 43% /data/mydb
[root@ws09 ~]# vgdisplay -v
Finding all volume groups
Finding volume group "vgdata"
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.88 GB
PE Size 4.00 MB
Total PE 482
Alloc PE / Size 375 / 1.46 GB
Free PE / Size 107 / 428.00 MB
VG UUID LDoM3e-Giqb-mTgq-PUPY-FlGK-dFc9-kPYs8Q
--- Logical volume ---
LV Name /dev/vgdata/datenbank
VG Name vgdata
LV UUID bP247U-CFyG-39Pz-RDve-eS2a-wAmq-CTEdcv
LV Write Access read/write
LV Status available
# open 1
LV Size 1.46 GB
Current LE 375
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Physical volumes ---
PV Name /dev/sda9
PV UUID SY0x0D-yS8M-ZszX-07H4-kijr-tOWj-8SykBt
PV Status allocatable
Total PE / Free PE 241 / 0
PV Name /dev/sda10
PV UUID R2c4ZK-m1Gq-h0Y8-GSKp-XZxo-e3I2-zCzpyE
PV Status allocatable
Total PE / Free PE 241 / 107
Info: /etc/lvm Verzeichnis wo infos über das letzte doing hinterlegt ist.
Info Internet:
http://www.centos.org/docs/5/html/5.1/Cluster_Logical_Volume_Manager/index.html
-- ein Stripe erstellen über zwei LV
- PV in eine bestehende VG hinzufügen.
[root@ws09 ~]# vgextend vgdata /dev/sda11 /dev/sda12
Volume group "vgdata" successfully extended
[root@ws09 ~]# vgdisplay
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 4
Act PV 4
VG Size 3.77 GB
PE Size 4.00 MB
Total PE 964
Alloc PE / Size 375 / 1.46 GB
Free PE / Size 589 / 2.30 GB
VG UUID LDoM3e-Giqb-mTgq-PUPY-FlGK-dFc9-kPYs8Q
[root@ws09 ~]# pvscan
PV /dev/sda9 VG vgdata lvm2 [964.00 MB / 0 free]
PV /dev/sda10 VG vgdata lvm2 [964.00 MB / 428.00 MB free]
PV /dev/sda11 VG vgdata lvm2 [964.00 MB / 964.00 MB free]
PV /dev/sda12 VG vgdata lvm2 [964.00 MB / 964.00 MB free]
Total: 4 [3.77 GB] / in use: 4 [3.77 GB] / in no VG: 0 [0 ]
[root@ws09 ~]# vgdisplay -v
Finding all volume groups
Finding volume group "vgdata"
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 4
Act PV 4
VG Size 3.77 GB
PE Size 4.00 MB
Total PE 964
Alloc PE / Size 375 / 1.46 GB
Free PE / Size 589 / 2.30 GB
VG UUID LDoM3e-Giqb-mTgq-PUPY-FlGK-dFc9-kPYs8Q
--- Logical volume ---
LV Name /dev/vgdata/datenbank
VG Name vgdata
LV UUID bP247U-CFyG-39Pz-RDve-eS2a-wAmq-CTEdcv
LV Write Access read/write
LV Status available
# open 1
LV Size 1.46 GB
Current LE 375
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Physical volumes ---
PV Name /dev/sda9
PV UUID SY0x0D-yS8M-ZszX-07H4-kijr-tOWj-8SykBt
PV Status allocatable
Total PE / Free PE 241 / 0
PV Name /dev/sda10
PV UUID R2c4ZK-m1Gq-h0Y8-GSKp-XZxo-e3I2-zCzpyE
PV Status allocatable
Total PE / Free PE 241 / 107
PV Name /dev/sda11
PV UUID jG08ED-s4gq-g80r-hUdh-AN7i-PbKa-283T62
PV Status allocatable
Total PE / Free PE 241 / 241
PV Name /dev/sda12
PV UUID iPnLsy-A6OB-hvNo-ePjS-beIR-d6wW-0A3RCY
PV Status allocatable
Total PE / Free PE 241 / 241
[root@ws09 ~]# lvcreate -n fotos -L 2G -i 2 vgdata /dev/sda11 /dev/sda12
Info: [root@ws09 ~]# lvdisplay -m
-- Bestehende "Raid 5" einbinden und Filesystem erstellen.
[root@ws09 ~]# pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
[root@ws09 ~]# vgextend vgdata /dev/md0
Volume group "vgdata" successfully extended
[root@ws09 ~]# pvscan
PV /dev/sda9 VG vgdata lvm2 [964.00 MB / 0 free]
PV /dev/sda10 VG vgdata lvm2 [964.00 MB / 428.00 MB free]
PV /dev/sda11 VG vgdata lvm2 [964.00 MB / 964.00 MB free]
PV /dev/sda12 VG vgdata lvm2 [964.00 MB / 964.00 MB free]
PV /dev/md0 VG vgdata lvm2 [3.73 GB / 3.73 GB free]
Total: 5 [7.50 GB] / in use: 5 [7.50 GB] / in no VG: 0 [0 ]
[root@ws09 ~]# vgdisplay -v
Finding all volume groups
Finding volume group "vgdata"
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 5
Metadata Sequence No 7
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 5
Act PV 5
VG Size 7.50 GB
PE Size 4.00 MB
Total PE 1920
Alloc PE / Size 375 / 1.46 GB
Free PE / Size 1545 / 6.04 GB
VG UUID LDoM3e-Giqb-mTgq-PUPY-FlGK-dFc9-kPYs8Q
--- Logical volume ---
LV Name /dev/vgdata/datenbank
VG Name vgdata
LV UUID bP247U-CFyG-39Pz-RDve-eS2a-wAmq-CTEdcv
LV Write Access read/write
LV Status available
# open 1
LV Size 1.46 GB
Current LE 375
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Physical volumes ---
PV Name /dev/sda9
PV UUID SY0x0D-yS8M-ZszX-07H4-kijr-tOWj-8SykBt
PV Status allocatable
Total PE / Free PE 241 / 0
PV Name /dev/sda10
PV UUID R2c4ZK-m1Gq-h0Y8-GSKp-XZxo-e3I2-zCzpyE
PV Status allocatable
Total PE / Free PE 241 / 107
PV Name /dev/sda11
PV UUID jG08ED-s4gq-g80r-hUdh-AN7i-PbKa-283T62
PV Status allocatable
Total PE / Free PE 241 / 241
PV Name /dev/sda12
PV UUID iPnLsy-A6OB-hvNo-ePjS-beIR-d6wW-0A3RCY
PV Status allocatable
Total PE / Free PE 241 / 241
PV Name /dev/md0
PV UUID 3HFg9h-22UB-l3zL-OhCD-pfA3-aNbs-LKSOuA
PV Status allocatable
Total PE / Free PE 956 / 956
[root@ws09 ~]# lvcreate -n filme -L 4300m vgdata
Logical volume "filme" created
[root@ws09 ~]# lvscan
ACTIVE '/dev/vgdata/datenbank' [1.46 GB] inherit
ACTIVE '/dev/vgdata/filme' [4.20 GB] inherit
[root@ws09 ~]# mkfs.ext3 /dev/vgdata/filme
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
550528 inodes, 1100800 blocks
55040 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1128267776
34 block groups
32768 blocks per group, 32768 fragments per group
16192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@ws09 ~]# mount /dev/vgdata/filme /mnt
Info: Gesamt Überblick:
[root@ws09 ~]# lvmdiskscan
/dev/ramdisk [ 16.00 MB]
/dev/md0 [ 3.74 GB] LVM physical volume
/dev/vgdata/datenbank [ 1.46 GB]
/dev/ram [ 16.00 MB]
/dev/root [ 58.59 GB]
/dev/vgdata/filme [ 4.20 GB]
/dev/ram2 [ 16.00 MB]
/dev/sda2 [ 3.91 GB]
/dev/ram3 [ 16.00 MB]
/dev/ram4 [ 16.00 MB]
/dev/ram5 [ 16.00 MB]
/dev/ram6 [ 16.00 MB]
/dev/ram7 [ 16.00 MB]
/dev/ram8 [ 16.00 MB]
/dev/ram9 [ 16.00 MB]
/dev/sda9 [ 964.81 MB] LVM physical volume
/dev/ram10 [ 16.00 MB]
/dev/sda10 [ 964.81 MB] LVM physical volume
/dev/ram11 [ 16.00 MB]
/dev/sda11 [ 964.81 MB] LVM physical volume
/dev/ram12 [ 16.00 MB]
/dev/sda12 [ 964.81 MB] LVM physical volume
/dev/ram13 [ 16.00 MB]
/dev/ram14 [ 16.00 MB]
/dev/ram15 [ 16.00 MB]
/dev/sdb1 [ 3.73 GB]
5 disks
16 partitions
0 LVM physical volume whole disks
5 LVM physical volumes
kmucr276:/root # kudzu -p
-
class: NETWORK
bus: PCI
detached: 0
device: eth0
driver: e1000
desc: "Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)"
network.hwaddr: 00:50:56:9B:6D:22
vendorId: 8086
deviceId: 100f
subVendorId: 15ad
subDeviceId: 0750
pciType: 1
pcidom: 0
pcibus: 0
pcidev: 11
pcifn: 0
-
class: SCSI
bus: PCI
detached: 0
driver: mptscsih
desc: "LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI"
vendorId: 1000
deviceId: 0030
subVendorId: 0000
subDeviceId: 0000
pciType: 1
pcidom: 0
pcibus: 0
pcidev: 10
pcifn: 0
[root@ws09 ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: ST380815AS Rev: 3.AA
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
Vendor: USB Model: Flash Disk Rev: 1100
Type: Direct-Access ANSI SCSI revision: 02
- /proc Verzeichniss.
[root@ws09 usb]# pwd
/proc/bus/usb
[root@ws09 usb]# ls -la
-r--r--r-- 1 root root 0 Jul 15 09:21 devices
[root@ws09 usb]# more devices
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 8
B: Alloc= 25/900 us ( 3%), #Int= 2, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.18-128.el5 ohci_hcd
S: Product=OHCI Host Controller
S: SerialNumber=0000:00:0b.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms
T: Bus=02 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=045e ProdID=0040 Rev= 3.00
S: Manufacturer=Microsoft
S: Product=Microsoft 3-Button Mouse with IntelliEye(TM)
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=10ms
T: Bus=02 Lev=01 Prnt=01 Port=03 Cnt=02 Dev#= 3 Spd=1.5 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=046a ProdID=0001 Rev= 0.26
S: Manufacturer=Cherry GmbH
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 2.06
S: Manufacturer=Linux 2.6.18-128.el5 ehci_hcd
S: Product=EHCI Host Controller
S: SerialNumber=0000:00:0b.1
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=256ms
T: Bus=01 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=090c ProdID=1000 Rev=11.00
S: Manufacturer=SMI Corporation
S: Product=USB DISK
S: SerialNumber=AA04012700007487
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=31875us
- lspci Info
[root@ws09 usb]# lspci oder lspci -v
00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.1 RAM memory: nVidia Corporation C51 Memory Controller 0 (rev a2)
00:00.2 RAM memory: nVidia Corporation C51 Memory Controller 1 (rev a2)
00:00.3 RAM memory: nVidia Corporation C51 Memory Controller 5 (rev a2)
00:00.4 RAM memory: nVidia Corporation C51 Memory Controller 4 (rev a2)
00:00.5 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
00:00.6 RAM memory: nVidia Corporation C51 Memory Controller 3 (rev a2)
00:00.7 RAM memory: nVidia Corporation C51 Memory Controller 2 (rev a2)
00:02.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:03.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:04.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)
00:05.0 VGA compatible controller: nVidia Corporation C51 [Quadro NVS 210S/GeForce 6150LE] (rev a2)
00:09.0 RAM memory: nVidia Corporation MCP51 Host Bridge (rev a2)
00:0a.0 ISA bridge: nVidia Corporation MCP51 LPC Bridge (rev a3)
00:0a.1 SMBus: nVidia Corporation MCP51 SMBus (rev a3)
00:0a.2 RAM memory: nVidia Corporation MCP51 Memory Controller 0 (rev a3)
00:0b.0 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)
00:0b.1 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)
00:0d.0 IDE interface: nVidia Corporation MCP51 IDE (rev a1)
00:0e.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev a1)
00:0f.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev a1)
00:10.0 PCI bridge: nVidia Corporation MCP51 PCI Bridge (rev a2)
00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)
00:14.0 Bridge: nVidia Corporation MCP51 Ethernet Controller (rev a3)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
- lsusb Info
[root@ws09 md]# lsusb
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 004: ID 090c:1000 Feiya Technology Corp. Memory Bar
Bus 002 Device 001: ID 0000:0000
Bus 002 Device 003: ID 046a:0001 Cherry GmbH My3000 Keyboard
Bus 002 Device 002: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
[root@ws09 md]# hal-device
82: udi = '/org/freedesktop/Hal/devices/pci_10de_26c_alsa_playback_1'
info.udi = '/org/freedesktop/Hal/devices/pci_10de_26c_alsa_playback_1' (string)
linux.device_file = '/dev/snd/pcmC0D1p' (string)
linux.subsystem = 'sound' (string)
linux.hotplug_type = 2 (0x2) (int)
info.product = 'AD198x Digital ALSA Playback Device' (string)
alsa.type = 'playback' (string)
[...]
[root@ws09 usb]# lsmod
Module Size Used by
vfat 46401 1
fat 85873 1 vfat
autofs4 57033 2
hidp 83521 2
rfcomm 104809 0
l2cap 89281 10 hidp,rfcomm
bluetooth 118597 5 hidp,rfcomm,l2cap
sunrpc 197897 1
ip_conntrack_netbios_ns 36033 0
ipt_REJECT 38849 1
xt_state 35265 2
ip_conntrack 91109 2 ip_conntrack_netbios_ns,xt_state
nfnetlink 40457 1 ip_conntrack
iptable_filter 36161 1
ip_tables 55329 1 iptable_filter
ip6t_REJECT 38849 1
xt_tcpudp 36289 10
ip6table_filter 36033 1
ip6_tables 50049 1 ip6table_filter
x_tables 50377 6 ipt_REJECT,xt_state,ip_tables,ip6t_REJECT,xt_tcpudp,ip6_tables
dm_mirror 53193 0
dm_multipath 55257 0
scsi_dh 41665 1 dm_multipath
raid456 153185 1
xor 38865 1 raid456
video 53197 0
backlight 39873 1 video
sbs 49921 0
i2c_ec 38593 1 sbs
button 40545 0
battery 43849 0
asus_acpi 50917 0
acpi_memhotplug 40133 0
ac 38729 0
ipv6 424609 17 ip6t_REJECT
xfrm_nalgo 43333 1 ipv6
crypto_api 42945 1 xfrm_nalgo
lp 47121 0
snd_hda_intel 481777 1
snd_seq_dummy 37061 0
snd_seq_oss 65473 0
snd_seq_midi_event 41025 1 snd_seq_oss
nvidia 10302696 26
snd_seq 87777 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
i2c_nforce2 40897 0
sg 69993 0
snd_seq_device 41557 3 snd_seq_dummy,snd_seq_oss,snd_seq
i2c_core 56129 3 i2c_ec,nvidia,i2c_nforce2
shpchp 70765 0
snd_pcm_oss 77377 0
ide_cd 73825 0
snd_mixer_oss 49985 1 snd_pcm_oss
parport_pc 62312 1
snd_pcm 116681 2 snd_hda_intel,snd_pcm_oss
parport 73165 2 lp,parport_pc
snd_timer 57161 2 snd_seq,snd_pcm
snd_page_alloc 44113 2 snd_hda_intel,snd_pcm
snd_hwdep 43593 1 snd_hda_intel
snd 99433 11 snd_hda_intel,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_hwdep
soundcore 41825 1 snd
usb_storage 116641 1
k8_edac 50693 0
edac_mc 60193 1 k8_edac
cdrom 68713 1 ide_cd
serio_raw 40517 0
k8temp 39105 0
hwmon 36553 1 k8temp
forcedeth 80329 0
pcspkr 36289 0
dm_raid45 99025 0
dm_message 36161 1 dm_raid45
dm_region_hash 46145 1 dm_raid45
dm_log 44865 3 dm_mirror,dm_raid45,dm_region_hash
dm_mod 100369 9 dm_mirror,dm_multipath,dm_raid45,dm_log
dm_mem_cache 38977 1 dm_raid45
sata_nv 62025 7
libata 208721 1 sata_nv
sd_mod 56385 10
scsi_mod 196569 5 scsi_dh,sg,usb_storage,libata,sd_mod
ext3 168017 3
jbd 94257 1 ext3
uhci_hcd 57433 0
ohci_hcd 55925 0
ehci_hcd 65741 0
- major und minor NR. die auf eine VG zeigen.
[root@ws09 proc]# more /proc/partitions
major minor #blocks name
8 0 78150744 sda
8 1 61440561 sda1
8 2 4096575 sda2
8 4 0 sda4
8 5 1959898 sda5
8 6 1959898 sda6
8 7 1959898 sda7
8 8 1959898 sda8
8 9 987966 sda9
8 10 987966 sda10
8 11 987966 sda11
8 12 987966 sda12
8 16 3915776 sdb
8 17 3915752 sdb1
9 0 3919616 md0
253 0 1536000 dm-0
253 1 4403200 dm-1
[root@ws09 proc]# ll /dev/mapper/
crw------- 1 root root 10, 63 Jul 15 09:21 control
brw-rw---- 1 root disk 253, 0 Jul 15 09:44 vgdata-datenbank
brw-rw---- 1 root disk 253, 1 Jul 15 13:10 vgdata-filme
- System informationen findet man auch unter /sys.
-- Tool das alle infos von den Server samelt. (wie SunExplorer).
[root@ws09 networking]# sysreport
WARNING: sysreport is deprecated, please use sosreport instead.
sosreport (version 1.7)
This utility will collect some detailed information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is packaged under
/tmp, which you can send to a support representative.
Red Hat will use this information for diagnostic purposes ONLY
and it will be considered confidential information.
This process may take a while to complete.
No changes will be made to your system.
Press ENTER to continue, or CTRL-C to quit.
Please enter your first initial and last name [ws09]:
Please enter the case number that you are generating this report for:
Progress [###################100%##################][01:19/01:19]
Creating compressed archive...
Your sosreport has been generated and saved in:
The md5sum is: a275d6b3b4ccf5fd0dd7ed365bf4dcbc
Please send this file to your support representative.
- in der Datei /tmp/sosreport-ws09-356936-f4dcbc.tar.bz2 steht die ganze Infos.
[root@ws09 ~]# lvcreate -s -L 100m -n datenbank_snap.200907151418 vgdata/datenbank
Logical volume "datenbank_snap.200907151418" created
[root@ws09 ~]# lvscan
ACTIVE Original '/dev/vgdata/datenbank' [1.46 GB] inherit
ACTIVE '/dev/vgdata/filme' [4.20 GB] inherit
ACTIVE Snapshot '/dev/vgdata/datenbank_snap.200907151418' [100.00 MB] inherit
- anschauen vom inhalt des snap shorts.
[root@ws09 ~]# mount /dev/vgdata/datenbank_snap.200907151418 /gg
[root@ws09 ~]# cd /gg
[root@ws09 gg]# ls
dbfile01 lost+found
- hir liegen die log Dateien /var/log
- Daemen muss laufen.
[root@ws09 md]# chkconfig --list |grep syslog
syslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- Konfigdatei unter /etc/syslog.conf
- Rotieren der log "myservice.log" Dateien, mit logrotate.
[root@ws09 logrotate.d]# cd /etc/logrotate.d/
[root@ws09 logrotate.d]# ll
-rw-r--r-- 1 root root 144 Aug 1 2008 acpid
-rw-r--r-- 1 root root 288 Jun 28 2007 conman
-rw-r--r-- 1 root root 71 Dec 1 2008 cups
-rw-r--r-- 1 root root 167 Nov 12 2008 httpd
-rw-r--r-- 1 root root 571 Aug 21 2006 mgetty
-rw-r----- 1 root named 163 Jan 6 2009 named
-rw-r--r-- 1 root root 136 Aug 12 2008 ppp
-rw-r--r-- 1 root root 442 Jul 16 2008 psacct
-rw-r--r-- 1 root root 61 Dec 3 2008 rpm
-rw-r--r-- 1 root root 232 Dec 9 2008 samba
-rw-r--r-- 1 root root 121 Apr 1 2008 setroubleshoot
-rw-r--r-- 1 root root 543 Sep 9 2008 squid
-rw-r--r-- 1 root root 306 Mar 25 2008 syslog
-rw-r--r-- 1 root root 48 Aug 23 2006 tux
-rw-r--r-- 1 root root 32 Dec 5 2006 up2date
-rw-r--r-- 1 root root 100 Dec 3 2008 wpa_supplicant
-rw-r--r-- 1 root root 100 Nov 25 2008 yum
- eigene datei kreieren.
[root@ws09 logrotate.d]# cp yum myservice
[root@ws09 logrotate.d]# vi /etc/logrotate.d/myservice
/var/log/myservice.log {
missingok
notifempty
daily
size 2k
rotate 30
compress
}
- versuch logrotate zu starten.
[root@ws09 etc]# logrotate -v /etc/logrotate.d/myservice
reading config file /etc/logrotate.d/myservice
reading config info for /var/log/myservice.log
Handling 1 logs
rotating pattern: /var/log/myservice.log after 1 days (30 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/myservice.log
log does not need rotating
- Log Datei wir rotiert.
[root@ws09 log]# ll /var/log/*my*
-rw-r--r-- 1 root root 360 Jul 15 15:38 /var/log/myservice.log
-rw-r--r-- 1 root root 52740 Jul 15 15:37 /var/log/myservice.log.1.gz
- eigene logrotaition die jede Stunde ausgeführt wird.
[root@ws09 cron.hourly]# vi /etc/cron.hourly/logrotate.myservice
#!/bin/sh
logrotate /etc/logrotate.d/myservice
[root@ws09 cron.hourly]# chmod +x /etc/cron.hourly/logrotate.myservice
- "logwatch" Dienst wertet Log Dateien aus (Report).
[root@ws09 services]# vi /etc/logwatch/conf/services/myservice.conf
# Service definition für myservice
Title = "myservice"
LogFile = myservice
[root@ws09 services]# vi /etc/logwatch/conf/logfiles/myservice.conf
# Logfile Defintionen für Service myservice
LogFile = myservice.log
Archive = myservice.log.*.gz
[root@ws09 services]# vi /etc/logwatch/scripts/services/myservice
#!/bin/sh
echo "Hallo Welt"
[root@ws09 services]# chmod +x /etc/logwatch/scripts/services/myservice
- aufruf
[root@ws09 scripts]# logwatch --service myservice --print
################### Logwatch 7.3 (03/24/06) ####################
Processing Initiated: Wed Jul 15 16:14:56 2009
Date Range Processed: yesterday
( 2009-Jul-14 )
Period is day.
Detail Level of Output: 0
Type of Output: unformatted
Logfiles for Host: ws09
##################################################################
--------------------- myservice Begin ------------------------
Hallo Welt
---------------------- myservice End -------------------------
###################### Logwatch End #########################
- output mit mail.
[root@ws09 scripts]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 23 messages 19 new 23 unread
U 1 logwatch@localhost.l Mon Jul 13 12:33 42/1537 "Logwatch for localhost.localdomain (Linux)"
U 2 MAILER-DAEMON@ws09.w Tue Jul 14 09:28 164/4845 "Warning: could not send message for past 4 hours"
U 3 root@ws09.windmuehl. Wed Jul 15 09:21 30/1063 "DegradedArray event on /dev/md0:ws09"
U 4 logwatch@ws09.windmu Wed Jul 15 15:49 146/4500 "Logwatch for ws09 (Linux)"
- Noch eine vernünftige Config Datei.
[root@ws09 ~]# vi /etc/logwatch/scripts/services/myservice
#!/bin/sh
COUNT=0
while read line; do
COUNT=$((COUNT+1))
done
echo "Es wurden $COUNT Ausgaben gezählt."
[root@ws09 ~]# logwatch --service myservice --print
################### Logwatch 7.3 (03/24/06) ####################
Processing Initiated: Thu Jul 16 09:11:58 2009
Date Range Processed: yesterday
( 2009-Jul-15 )
Period is day.
Detail Level of Output: 0
Type of Output: unformatted
Logfiles for Host: ws09
##################################################################
--------------------- myservice Begin ------------------------
Es wurden 53288 Ausgaben gezählt.
---------------------- myservice End -------------------------
###################### Logwatch End #########################
-- Softwareverwaltung / Packagemanagment.
Internet Link: http://linuxwiki.de/yum
- Repository datei anlegen.
[root@ws09 yum.repos.d]# pwd
/etc/yum.repos.d
[root@ws09 yum.repos.d]# vi dvd.repo
[dvd]
name=DVD Install Quelle
baseurl=file:///install/Server
enabled=1
gpgcheck=0
- Quelle Mounten.
[root@ws09 ~]# mount ws00:/install/ /install/
- Info über ein pkg das mit rpm vorhanden ist in der Repository
[root@ws09 yum.repos.d]# yum search rpm
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
dvd | 1.3 kB 00:00
primary.xml.gz | 825 kB 00:00
dvd 2985/2985
=================================================== Matched: rpm ====================================================
mc.x86_64 : User-friendly text console file manager and visual shell
lam.i386 : The LAM (Local Area Multicomputer) programming environment.
lam.x86_64 : The LAM (Local Area Multicomputer) programming environment.
chkfontpath.x86_64 : Simple interface for editing the font path for the X font server.
createrepo.noarch : Creates a common metadata repository
file.x86_64 : A utility for determining file types.
jpackage-utils.noarch : JPackage utilities
nfs-utils-lib.i386 : Network File System Support Library
nfs-utils-lib.x86_64 : Network File System Support Library
popt.i386 : A C library for parsing command line parameters.
popt.x86_64 : A C library for parsing command line parameters.
python.x86_64 : An interpreted, interactive, object-oriented programming language.
redhat-logos.noarch : Red Hat-related icons and pictures.
redhat-rpm-config.noarch : Red Hat specific rpm configuration files.
rpm.x86_64 : The RPM package management system
rpm-apidocs.x86_64 : API documentation for RPM libraries
rpm-build.x86_64 : Scripts and executable programs used to build packages
rpm-devel.i386 : Development files for manipulating RPM packages
rpm-devel.x86_64 : Development files for manipulating RPM packages
rpm-libs.i386 : Libraries for manipulating RPM packages
rpm-libs.x86_64 : Libraries for manipulating RPM packages
rpm-python.x86_64 : Python bindings for apps which will manipulate RPM packages
xorg-x11-drivers.x86_64 : X.Org X11 driver installation package
yum.noarch : RPM installer/updater
yum-protect-packages.noarch : Yum plugin to prevents Yum from removing itself and other protected packages
yum-verify.noarch : Yum plugin to add verify command, and options
- Wir möchten ein pkg "createrepo" installieren.
- Ist überhaupt das pkg "createrepo" installiert
[root@ws09 yum.repos.d]# rpm -q createrepo
package createrepo is not installed
- Installation des Pkg "createrepo"
[root@ws09 yum.repos.d]# yum install createrepo
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.4.11-3.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
createrepo noarch 0.4.11-3.el5 dvd 59 k
Transaction Summary
=====================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 59 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : createrepo [1/1]
Installed: createrepo.noarch 0:0.4.11-3.el5
Complete!
-- RPM Installat / kreieren.
rpm -q quers
-qa all
-qi info
-qf file
-qp package
rpm -i install
-u update
-v verbose
-h hashes
rpm -e Erase
[root@ws09 yum.repos.d]# rpm -qa | grep repo
createrepo-0.4.11-3.el5
[root@ws09 yum.repos.d]# rpm -ql createrepo
/usr/bin/createrepo
/usr/bin/modifyrepo
/usr/share/createrepo
/usr/share/createrepo/dumpMetadata.py
/usr/share/createrepo/dumpMetadata.pyc
/usr/share/createrepo/dumpMetadata.pyo
/usr/share/createrepo/genpkgmetadata.py
/usr/share/createrepo/genpkgmetadata.pyc
/usr/share/createrepo/genpkgmetadata.pyo
/usr/share/createrepo/modifyrepo.py
/usr/share/createrepo/modifyrepo.pyc
/usr/share/createrepo/modifyrepo.pyo
/usr/share/createrepo/readMetadata.py
/usr/share/createrepo/readMetadata.pyc
/usr/share/createrepo/readMetadata.pyo
/usr/share/doc/createrepo-0.4.11
/usr/share/doc/createrepo-0.4.11/COPYING
/usr/share/doc/createrepo-0.4.11/ChangeLog
/usr/share/doc/createrepo-0.4.11/README
/usr/share/man/man8/createrepo.8.gz
[root@ws09 yum.repos.d]# rpm -qi createrepo
Name : createrepo Relocations: (not relocatable)
Version : 0.4.11 Vendor: Red Hat, Inc.
Release : 3.el5 Build Date: Wed 16 Apr 2008 09:32:49 PM CEST
Install Date: Thu 16 Jul 2009 09:37:24 AM CEST Build Host: ia64-2.build.redhat.com
Group : System Environment/Base Source RPM: createrepo-0.4.11-3.el5.src.rpm
Size : 221261 License: GPLv2
Signature : DSA/SHA1, Mon 21 Apr 2008 01:48:33 PM CEST, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://linux.duke.edu/projects/metadata/
Summary : Creates a common metadata repository
Description :
This utility will generate a common metadata repository from a directory of
rpm packages
- siehe auch S.136 im Buch.
- Vorraussetzung: .spec Datei und Tar (gz) datei
- Internet Info: http://de.wikibooks.org/wiki/Linux-Kompendium:_Software-Installation
[root@ws09 ~]# useradd -m otto
[root@ws09 ~]# passwd otto
Changing password for user otto.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@ws09 ~]# su - otto
[otto@ws09 ~]$ pwd
/home/otto
Zusatz info: um gedit zu starten kann man das ausführen, -X nimmt die Xserver einstellung vom anderen Rechner.
- versuchen mit mozilla
[root@ws09 ~]# ssh localhost -l otto -X
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is d1:42:33:04:c5:49:be:8f:2c:a9:6b:28:2a:b4:e3:05.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
otto@localhost's password:
/usr/bin/xauth: creating new authority file /home/otto/.Xauthority
[otto@ws09 ~]$ gedit
[otto@ws09 ~]$ vi .rpmmacros
%_topdir /home/otto/RPMBUILD
[otto@ws09 ~]$ mkdir RPMBUILD
[otto@ws09 ~]$ cd RPMBUILD/
[otto@ws09 RPMBUILD]$ mkdir BUILD
[otto@ws09 RPMBUILD]$ mkdir RPMS
[otto@ws09 RPMBUILD]$ mkdir RPMS/noarch
[otto@ws09 RPMBUILD]$ mkdir SOURCES
[otto@ws09 RPMBUILD]$ mkdir SRPMS
[otto@ws09 RPMBUILD]$ mkdir SPECS
[otto@ws09 RPMBUILD]$ cd SPECS/
[otto@ws09 RPMBUILD]$ vi myservice.spec
Name: myservice
Summary: Ganz wichtiger Systemdienst
Version: 1.0
Release: 1
License: MyLicense
Group: System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
Source0: %{name}-%{version}.tar
%description
Dieser wichtige Systemdienst schreibt in definierbaren Zeiträumen Logdaten nach /var/log/myservice.log.
Kann ungeheuer wichtig sein.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
install -D etc/sysconfig/myservice $RPM_BUILD_ROOT/etc/sysconfig/myservice
install -D usr/local/bin/myservice $RPM_BUILD_ROOT/usr/local/bin/myservice
install -D etc/init.d/myservice $RPM_BUILD_ROOT/etc/init.d/myservice
install -D etc/logrotate.d/myservice $RPM_BUILD_ROOT/etc/logrotate.d/myservice
install -D etc/cron.hourly/logrotate.myservice $RPM_BUILD_ROOT/etc/cron.hourly/logrotate.myservice
install -D etc/logwatch/conf/logfiles/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles/myservice.conf
install -D etc/logwatch/conf/services/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/services/myservice.conf
install -D etc/logwatch/scripts/services/myservice $RPM_BUILD_ROOT/etc/logwatch/scripts/services/myservice
mkdir -p $RPM_BUILD_ROOT/var/log
touch $RPM_BUILD_ROOT/var/log/myservice.log
%clean
rm -rf $RPM_BUILD_ROOT
%files
/etc/sysconfig/myservice
/usr/local/bin/myservice
/etc/init.d/myservice
/etc/logrotate.d/myservice
/etc/cron.hourly/logrotate.myservice
/etc/logwatch/conf/logfiles/myservice.conf
/etc/logwatch/conf/services/myservice.conf
/etc/logwatch/scripts/services/myservice
/var/log/myservice.log
- als root die gz Datei erstellen.
[root@ws09 ~]# more myservice.files
/etc/sysconfig/myservice
/usr/local/bin/myservice
/etc/init.d/myservice
/etc/logrotate.d/myservice
/etc/cron.hourly/logrotate.myservice
/etc/logwatch/conf/logfiles/myservice.conf
/etc/logwatch/conf/services/myservice.conf
/etc/logwatch/scripts/services/myservice
/var/log/myservice.log
[root@ws09 ~]# tar cf myservice.tar -T myservice.files -C /
tar: Removing leading `/' from member names
[root@ws09 ~]# ll myservice.*
-rw-r--r-- 1 root root 286 Jul 16 10:35 myservice.files
-rw-r--r-- 1 root root 153600 Jul 16 10:35 myservice.tar
[root@ws09 ~]# tar tvf myservice.tar
-rw-r--r-- root/root 89 2009-07-13 14:19:52 etc/sysconfig/myservice
-rwxrwxr-x root/root 443 2009-07-13 14:22:43 usr/local/bin/myservice
-rwxrwxr-x root/root 753 2009-07-13 16:00:19 etc/init.d/myservice
-rw-r--r-- root/root 106 2009-07-15 15:37:02 etc/logrotate.d/myservice
-rwxr-xr-x root/root 49 2009-07-15 15:43:55 etc/cron.hourly/logrotate.myservice
-rw-r--r-- root/root 98 2009-07-15 16:05:26 etc/logwatch/conf/logfiles/myservice.conf
-rw-r--r-- root/root 76 2009-07-15 16:11:42 etc/logwatch/conf/services/myservice.conf
-rwxr-xr-x root/root 111 2009-07-16 09:11:47 etc/logwatch/scripts/services/myservice
-rw-r--r-- root/root 141180 2009-07-16 10:35:36 var/log/myservice.log
[root@ws09 ~]# mv myservice.tar /home/otto/RPMBUILD/SOURCES/
[root@ws09 ~]# chown otto.otto /home/otto/RPMBUILD/SOURCES/myservice.tar
-- zurück als otto
[otto@ws09 SPECS]$ cd ..
[otto@ws09 RPMBUILD]$ mv SOURCES/myservice.tar SOURCES/myservice-1.0.tar
[otto@ws09 RPMBUILD]$ cd SOURCES/
[otto@ws09 SOURCES]$ ls
myservice-1.0.tar
[otto@ws09 SOURCES]$ mkdir myservice-1.0
[otto@ws09 SOURCES]$ cd myservice-1.0
[otto@ws09 myservice-1.0]$ tar xf ../myservice-1.0.tar
[otto@ws09 myservice-1.0]$ ll
drwxrwxr-x 7 otto otto 4096 Jul 16 11:22 etc
drwxrwxr-x 3 otto otto 4096 Jul 16 11:22 usr
drwxrwxr-x 3 otto otto 4096 Jul 16 11:22 var
[otto@ws09 myservice-1.0]$ pwd
/home/otto/RPMBUILD/SOURCES/myservice-1.0
[otto@ws09 myservice-1.0]$ cd ..
[otto@ws09 SOURCES]$ ll
drwxrwxr-x 5 otto otto 4096 Jul 16 11:22 myservice-1.0
-rw-r--r-- 1 otto otto 153600 Jul 16 10:35 myservice-1.0.tar
[otto@ws09 SOURCES]$ tar cf myservice-1.0.tar myservice-1.0
[otto@ws09 SOURCES]$ ll
drwxrwxr-x 5 otto otto 4096 Jul 16 11:22 myservice-1.0
-rw-r--r-- 1 otto otto 163840 Jul 16 11:23 myservice-1.0.tar
[otto@ws09 RPMBUILD]$ rpmbuild -bb SPECS/myservice.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.51337
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/otto/RPMBUILD/BUILD
+ rm -rf myservice-1.0
+ tar -xf /home/otto/RPMBUILD/SOURCES/myservice-1.0.tar
+ cd myservice-1.0
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.51337
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/myservice-1.0-1
+ mkdir /var/tmp/myservice-1.0-1
+ install -D etc/sysconfig/myservice /var/tmp/myservice-1.0-1/etc/sysconfig/myservice
+ install -D usr/local/bin/myservice /var/tmp/myservice-1.0-1/usr/local/bin/myservice
+ install -D etc/init.d/myservice /var/tmp/myservice-1.0-1/etc/init.d/myservice
+ install -D etc/logrotate.d/myservice /var/tmp/myservice-1.0-1/etc/logrotate.d/myservice
+ install -D etc/cron.hourly/logrotate.myservice /var/tmp/myservice-1.0-1/etc/cron.hourly/logrotate.myservice
+ install -D etc/logwatch/conf/logfiles/myservice.conf /var/tmp/myservice-1.0-1/etc/logwatch/conf/logfiles/myservice.conf
+ install -D etc/logwatch/conf/services/myservice.conf /var/tmp/myservice-1.0-1/etc/logwatch/conf/services/myservice.conf
+ install -D etc/logwatch/scripts/services/myservice /var/tmp/myservice-1.0-1/etc/logwatch/scripts/services/myservice
+ mkdir -p /var/tmp/myservice-1.0-1/var/log
+ touch /var/tmp/myservice-1.0-1/var/log/myservice.log
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: myservice-1.0-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh /sbin/sh
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/myservice-1.0-1
Wrote: /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.65674
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.0
+ rm -rf /var/tmp/myservice-1.0-1
+ exit 0
- pkg wurde kreieret in den u.g. verz.
[otto@ws09 RPMBUILD]$ ll /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-1.noarch.rpm
-rw-r--r-- 1 otto otto 4276 Jul 16 11:59 /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-1.noarch.rpm
- Package inhalt anzeigen.
[otto@ws09 RPMBUILD]$ rpm -qilp RPMS/noarch/myservice-1.0-1.noarch.rpm
Name : myservice Relocations: (not relocatable)
Version : 1.0 Vendor: (none)
Release : 1 Build Date: Thu 16 Jul 2009 11:59:35 AM CEST
Install Date: (not installed) Build Host: ws09.windmuehl.linux
Group : System Source RPM: myservice-1.0-1.src.rpm
Size : 1725 License: MyLicense
Signature : (none)
Summary : Ganz wichtiger Systemdienst
Description :
Dieser wichtige Systemdienst schreibt in definierbaren Zeiträumen Logdaten nach /var/log/myservice.log.
Kann ungeheuer wichtig sein.
/etc/cron.hourly/logrotate.myservice
/etc/init.d/myservice
/etc/logrotate.d/myservice
/etc/logwatch/conf/logfiles/myservice.conf
/etc/logwatch/conf/services/myservice.conf
/etc/logwatch/scripts/services/myservice
/etc/sysconfig/myservice
/usr/local/bin/myservice
/var/log/myservice.log
-Install PKG
[root@ws09 ~]# rpm -ivh /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-1.noarch.rpm
Preparing... ########################################### [100%]
package myservice-1.0-1.noarch is already installed
- Zusatz Aufgabe: Abhängikkeiten in pkg definieren und Release auf zwei erhöhen.
[otto@ws09 RPMBUILD]$ vi SPECS/myservice.spec
Name: myservice
Summary: Ganz wichtiger Systemdienst
Version: 1.0
Release: 2
License: MyLicense
Group: System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
Source0: %{name}-%{version}.tar
Requires: logrotate
Requires: logwatch
%description
Dieser wichtige Systemdienst schreibt in definierbaren Zeiträumen Logdaten nach /var/log/myservice.log.
Kann ungeheuer wichtig sein.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
install -D etc/sysconfig/myservice $RPM_BUILD_ROOT/etc/sysconfig/myservice
install -D usr/local/bin/myservice $RPM_BUILD_ROOT/usr/local/bin/myservice
install -D etc/init.d/myservice $RPM_BUILD_ROOT/etc/init.d/myservice
install -D etc/logrotate.d/myservice $RPM_BUILD_ROOT/etc/logrotate.d/myservice
install -D etc/cron.hourly/logrotate.myservice $RPM_BUILD_ROOT/etc/cron.hourly/logrotate.myservice
install -D etc/logwatch/conf/logfiles/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles/myservice.conf
install -D etc/logwatch/conf/services/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/services/myservice.conf
install -D etc/logwatch/scripts/services/myservice $RPM_BUILD_ROOT/etc/logwatch/scripts/services/myservice
mkdir -p $RPM_BUILD_ROOT/var/log
touch $RPM_BUILD_ROOT/var/log/myservice.log
%clean
rm -rf $RPM_BUILD_ROOT
%files
/etc/sysconfig/myservice
/usr/local/bin/myservice
/etc/init.d/myservice
/etc/logrotate.d/myservice
/etc/cron.hourly/logrotate.myservice
/etc/logwatch/conf/logfiles/myservice.conf
/etc/logwatch/conf/services/myservice.conf
/etc/logwatch/scripts/services/myservice
/var/log/myservice.log
[otto@ws09 RPMBUILD]$ rpmbuild -bb SPECS/myservice.spec
[otto@ws09 RPMBUILD]$ rpmbuild -bb SPECS/myservice.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.28097
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/otto/RPMBUILD/BUILD
+ rm -rf myservice-1.0
+ tar -xf /home/otto/RPMBUILD/SOURCES/myservice-1.0.tar
+ cd myservice-1.0
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.28097
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/myservice-1.0-2
+ mkdir /var/tmp/myservice-1.0-2
+ install -D etc/sysconfig/myservice /var/tmp/myservice-1.0-2/etc/sysconfig/myservice
+ install -D usr/local/bin/myservice /var/tmp/myservice-1.0-2/usr/local/bin/myservice
+ install -D etc/init.d/myservice /var/tmp/myservice-1.0-2/etc/init.d/myservice
+ install -D etc/logrotate.d/myservice /var/tmp/myservice-1.0-2/etc/logrotate.d/myservice
+ install -D etc/cron.hourly/logrotate.myservice /var/tmp/myservice-1.0-2/etc/cron.hourly/logrotate.myservice
+ install -D etc/logwatch/conf/logfiles/myservice.conf /var/tmp/myservice-1.0-2/etc/logwatch/conf/logfiles/myservice.conf
+ install -D etc/logwatch/conf/services/myservice.conf /var/tmp/myservice-1.0-2/etc/logwatch/conf/services/myservice.conf
+ install -D etc/logwatch/scripts/services/myservice /var/tmp/myservice-1.0-2/etc/logwatch/scripts/services/myservice
+ mkdir -p /var/tmp/myservice-1.0-2/var/log
+ touch /var/tmp/myservice-1.0-2/var/log/myservice.log
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: myservice-1.0-2
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh logrotate logwatch
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/myservice-1.0-1
Wrote: /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.65674
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.0
+ rm -rf /var/tmp/myservice-1.0-1
+ exit 0
[root@ws09 ~]# rpm -Uvh /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-2.noarch.rpm
Preparing... ########################################### [100%]
1:myservice ########################################### [100%]
[root@ws09 ~]# rpm -q myservice
myservice-1.0-2
eck-files /var/tmp/myservice-1.0-2
Wrote: /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-2.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.9855
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.0
+ rm -rf /var/tmp/myservice-1.0-2
+ exit 0
- jetzt sind zwei Release vorhanden.
[otto@ws09 RPMBUILD]$ ll RPMS/noarch/
-rw-r--r-- 1 otto otto 4225 Jul 16 13:10 myservice-1.0-1.noarch.rpm
-rw-r--r-- 1 otto otto 4254 Jul 16 13:15 myservice-1.0-2.noarch.rpm
[otto@ws09 RPMBUILD]$
- Optional -U ist vorzuziehen vor -i , da bei -i noch die letzet version auf den System bleiben kann.
[root@ws09 ~]# rpm -Uvh /home/otto/RPMBUILD/RPMS/noarch/myservice-1.0-2.noarch.rpm
Preparing... ########################################### [100%]
1:myservice ########################################### [100%]
[root@ws09 ~]# rpm -q myservice
myservice-1.0-2
- neu Version erstellen.
[otto@ws09 RPMBUILD]$ cd SOURCES/
[otto@ws09 SOURCES]$ ll
drwxrwxr-x 5 otto otto 4096 Jul 16 11:22 myservice-1.0
-rw-r--r-- 1 otto otto 163840 Jul 16 13:09 myservice-1.0.tar
[otto@ws09 SOURCES]$ cp -s myservice-1.0 myservice-1.1
cp: omitting directory `myservice-1.0'
[otto@ws09 SOURCES]$ cp -a myservice-1.0 myservice-1.1
[otto@ws09 SOURCES]$ ll
drwxrwxr-x 5 otto otto 4096 Jul 16 11:22 myservice-1.0
-rw-r--r-- 1 otto otto 163840 Jul 16 13:09 myservice-1.0.tar
drwxrwxr-x 5 otto otto 4096 Jul 16 11:22 myservice-1.1
- Tar file kreieren, vom myservice-1.1
[otto@ws09 SOURCES]$ vi myservice-1.1/etc/init.d/myservice
# Start-/Stop-Skript für myservice
#
# chkconfig: 2345 60 20
# description: Besonders wichtiger Dienst
#
### BEGIN INIT INFO
# Provides: myservice
# Required-Start: network crond
### END INIT INFO
. /etc/sysconfig/myservice
case $1 in
start)
echo "Starte myservice..."
if [ -f $PIDFILE ]; then
echo "$PIDFILE existiert, Dienst scheint schon zu laufen"
exit 1
fi
/usr/local/bin/myservice &
PID=$! # enthält die PID des zuletzt gestarteten Prozesses
echo -n $PID > $PIDFILE
;;
stop)
echo "Stoppe myservice..."
if [ ! -f $PIDFILE ]; then
echo "myservice läuft nicht, wird nicht gestoppt."
exit 1
fi
PID=$(cat $PIDFILE)
kill $PID
rm -f $PIDFILE
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
;;
esac
- Version Nr aendern.
[otto@ws09 RPMBUILD]$ more SPECS/myservice.spec
Name: myservice
Summary: Ganz wichtiger Systemdienst
Version: 1.1
Release: 1
License: MyLicense
Group: System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
Source0: %{name}-%{version}.tar
Requires: logrotate
Requires: logwatch
%description
Dieser wichtige Systemdienst schreibt in definierbaren Zeiträumen Logdaten nach /var/log/myservice.log.
Kann ungeheuer wichtig sein.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
install -D etc/sysconfig/myservice $RPM_BUILD_ROOT/etc/sysconfig/myservice
install -D usr/local/bin/myservice $RPM_BUILD_ROOT/usr/local/bin/myservice
install -D etc/init.d/myservice $RPM_BUILD_ROOT/etc/init.d/myservice
install -D etc/logrotate.d/myservice $RPM_BUILD_ROOT/etc/logrotate.d/myservice
install -D etc/cron.hourly/logrotate.myservice $RPM_BUILD_ROOT/etc/cron.hourly/logrotate.myservice
install -D etc/logwatch/conf/logfiles/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles/myservice.conf
install -D etc/logwatch/conf/services/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/services/myservice.conf
install -D etc/logwatch/scripts/services/myservice $RPM_BUILD_ROOT/etc/logwatch/scripts/services/myservice
mkdir -p $RPM_BUILD_ROOT/var/log
touch $RPM_BUILD_ROOT/var/log/myservice.log
%clean
rm -rf $RPM_BUILD_ROOT
%files
/etc/sysconfig/myservice
/usr/local/bin/myservice
/etc/init.d/myservice
/etc/logrotate.d/myservice
/etc/cron.hourly/logrotate.myservice
/etc/logwatch/conf/logfiles/myservice.conf
/etc/logwatch/conf/services/myservice.conf
/etc/logwatch/scripts/services/myservice
/var/log/myservice.log
[otto@ws09 RPMBUILD]$ rpmbuild -bb SPECS/myservice.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.93842
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/otto/RPMBUILD/BUILD
+ rm -rf myservice-1.1
+ tar -xf /home/otto/RPMBUILD/SOURCES/myservice-1.1.tar
+ cd myservice-1.1
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.93842
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/myservice-1.1-1
+ mkdir /var/tmp/myservice-1.1-1
+ install -D etc/sysconfig/myservice /var/tmp/myservice-1.1-1/etc/sysconfig/myservice
+ install -D usr/local/bin/myservice /var/tmp/myservice-1.1-1/usr/local/bin/myservice
+ install -D etc/init.d/myservice /var/tmp/myservice-1.1-1/etc/init.d/myservice
+ install -D etc/logrotate.d/myservice /var/tmp/myservice-1.1-1/etc/logrotate.d/myservice
+ install -D etc/cron.hourly/logrotate.myservice /var/tmp/myservice-1.1-1/etc/cron.hourly/logrotate.myservice
+ install -D etc/logwatch/conf/logfiles/myservice.conf /var/tmp/myservice-1.1-1/etc/logwatch/conf/logfiles/myservice.conf
+ install -D etc/logwatch/conf/services/myservice.conf /var/tmp/myservice-1.1-1/etc/logwatch/conf/services/myservice.conf
+ install -D etc/logwatch/scripts/services/myservice /var/tmp/myservice-1.1-1/etc/logwatch/scripts/services/myservice
+ mkdir -p /var/tmp/myservice-1.1-1/var/log
+ touch /var/tmp/myservice-1.1-1/var/log/myservice.log
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: myservice-1.1-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh logrotate logwatch
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/myservice-1.1-1
Wrote: /home/otto/RPMBUILD/RPMS/noarch/myservice-1.1-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.35151
+ umask 022
+ cd /home/otto/RPMBUILD/BUILD
+ cd myservice-1.1
+ rm -rf /var/tmp/myservice-1.1-1
+ exit 0
[root@ws09 install]# rpm -Uvh /home/otto/RPMBUILD/RPMS/noarch/myservice-1.1-1.noarch.rpm
Preparing... ########################################### [100%]
1:myservice ########################################### [100%]
[root@ws09 install]# rpm -q myservice
myservice-1.1-1
- nächste Test: ändern Configuration Datei
z.B. alte datei sichern , neue datei installieren (%config /etc/...)
- %pre, %post u.s.w
- Buch Seite 141
- neue spec datei
[otto@ws09 RPMBUILD]$ more SPECS/myservice.spec
Name: myservice
Summary: Ganz wichtiger Systemdienst
Version: 1.1
Release: 1
License: MyLicense
Group: System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
Source0: %{name}-%{version}.tar
Requires: logrotate
Requires: logwatch
%description
Dieser wichtige Systemdienst schreibt in definierbaren Zeiträumen Logdaten nach /var/log/myservice.log.
Kann ungeheuer wichtig sein.
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
install -D etc/sysconfig/myservice $RPM_BUILD_ROOT/etc/sysconfig/myservice
install -D usr/local/bin/myservice $RPM_BUILD_ROOT/usr/local/bin/myservice
install -D etc/init.d/myservice $RPM_BUILD_ROOT/etc/init.d/myservice
install -D etc/logrotate.d/myservice $RPM_BUILD_ROOT/etc/logrotate.d/myservice
install -D etc/cron.hourly/logrotate.myservice $RPM_BUILD_ROOT/etc/cron.hourly/logrotate.myservice
install -D etc/logwatch/conf/logfiles/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/logfiles/myservice.conf
install -D etc/logwatch/conf/services/myservice.conf $RPM_BUILD_ROOT/etc/logwatch/conf/services/myservice.conf
install -D etc/logwatch/scripts/services/myservice $RPM_BUILD_ROOT/etc/logwatch/scripts/services/myservice
mkdir -p $RPM_BUILD_ROOT/var/log
touch $RPM_BUILD_ROOT/var/log/myservice.log
%clean
rm -rf $RPM_BUILD_ROOT
%files
%config(noreplace) /etc/sysconfig/myservice
/usr/local/bin/myservice
/etc/init.d/myservice
/etc/logrotate.d/myservice
/etc/cron.hourly/logrotate.myservice
/etc/logwatch/conf/logfiles/myservice.conf
/etc/logwatch/conf/services/myservice.conf
/etc/logwatch/scripts/services/myservice
/var/log/myservice.log
%pre
%post
chkconfig --add myservice
chkconfig myservice on
service myservice start
%preun
service myservice stop
chkconfig --del myservice
%postun
echo "%{name} wurde deinstalliert" | mail -s "RPM Informations" root@localhost
[root@ws09 install]# rpm -e myservice
[root@ws09 install]# rpm -Uvh /home/otto/RPMBUILD/RPMS/noarch/myservice-1.1-1.noarch.rpm
Preparing... ########################################### [100%]
1:myservice ########################################### [100%]
Starte myservice...
- RPM in ein YUM Repository integrieren.
- verzeichniss mit *rpm dateien und reprodata verz. mit xml dateien.
[root@ws09 ~]# /etc/init.d/httpd start
Starting httpd: [ OK ]
[root@ws09 html]# mkdir software
[root@ws09 html]# cd software/
[root@ws09 software]# cp /install/myservice-1.1-1.noarch.rpm .
[root@ws09 software]# ll
-rw-r--r-- 1 root root 4762 Jul 16 15:10 myservice-1.1-1.noarch.rpm
[root@ws09 software]# more /etc/yum.repos.d/software.repo
[software]
name= unsere interne softwarequelle
baseurl=http://ws09.windmuehl.linux/software
enabled=1
gpgcheck=0
siehe jetzt unter den Browser:
http://ws09.windmuehl.linux/software/
[root@ws09 software]# pwd
/var/www/html/software
[root@ws09 software]# createrepo /var/www/html/software/
1/1 - myservice-1.1-1.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@ws09 software]# ll
-rw-r--r-- 1 root root 4762 Jul 16 15:10 myservice-1.1-1.noarch.rpm
drwxr-xr-x 2 root root 4096 Jul 16 15:18 repodata
[root@ws09 software]# yum search myservice
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
software | 951 B 00:00
primary.xml.gz | 856 B 00:00
software 1/1
================================================ Matched: myservice =================================================
myservice.noarch : Ganz wichtiger Systemdienst
- yum installiert über eigen repo date installiert.
- myservice ist schon installiert, weil schon installiert ist.
[root@ws09 software]# yum install myservice
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Package myservice-1.1-1.noarch already installed and latest version
Nothing to do[root@ws09 software]# rpm -e logwatch
[root@ws09 software]# yum install myservice
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package myservice.noarch 0:1.1-1 set to be updated
--> Processing Dependency: logwatch for package: myservice
--> Running transaction check
---> Package logwatch.noarch 0:7.3-6.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
myservice noarch 1.1-1 software 4.7 k
Installing for dependencies:
logwatch noarch 7.3-6.el5 dvd 247 k
Transaction Summary
=====================================================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 252 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): myservice-1.1-1.noarch.rpm | 4.7 kB 00:00
---------------------------------------------------------------------------------------------------------------------
Total 19 MB/s | 252 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : logwatch [1/2]
Installing : myservice [2/2]
Starte myservice...
Installed: myservice.noarch 0:1.1-1
Dependency Installed: logwatch.noarch 0:7.3-6.el5
Complete!
You have mail in /var/spool/mail/root
- löschen von myservice und logwatch, bei anschli. install von myservice, erkennt er die abhängikkeiten.
[root@ws09 software]# rpm -e myservice
[root@ws09 software]# rpm -e logwatch
[root@ws09 software]# yum install myservice
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package myservice.noarch 0:1.1-1 set to be updated
--> Processing Dependency: logwatch for package: myservice
--> Running transaction check
---> Package logwatch.noarch 0:7.3-6.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
myservice noarch 1.1-1 software 4.7 k
Installing for dependencies:
logwatch noarch 7.3-6.el5 dvd 247 k
Transaction Summary
=====================================================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 252 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): myservice-1.1-1.noarch.rpm | 4.7 kB 00:00
---------------------------------------------------------------------------------------------------------------------
Total 19 MB/s | 252 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : logwatch [1/2]
Installing : myservice [2/2]
Starte myservice...
Installed: myservice.noarch 0:1.1-1
Dependency Installed: logwatch.noarch 0:7.3-6.el5
Complete!
You have mail in /var/spool/mail/root
BIOS --> MBR --> Grub Saage1 --> liest config.: menu.lst /boot/grub/menu.lst (grub.conf)
[root@ws09 ~]# ls -ld /etc/grub.conf
lrwxrwxrwx 1 root root 22 Jul 10 17:58 /etc/grub.conf -> ../boot/grub/grub.conf
- Boot Konfig Datei.
[root@ws09 ~]# more /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-128.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-128.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-128.el5.img
- Boot Binary verzeichniss
- vmlinuz... à ist das Image vom Kernel.
- initrd... à ist die Inital Ramdisk (Enthält Treiber für Systemstart).
[root@ws09 ~]# ll /boot
-rw-r--r-- 1 root root 64994 Dec 17 2008 config-2.6.18-128.el5
drwxr-xr-x 2 root root 4096 Jul 10 17:58 grub
-rw------- 1 root root 2617325 Jul 10 17:50 initrd-2.6.18-128.el5.img
-rw-r--r-- 1 root root 102182 Dec 17 2008 symvers-2.6.18-128.el5.gz
-rw-r--r-- 1 root root 1188481 Dec 17 2008 System.map-2.6.18-128.el5
-rw-r--r-- 1 root root 1889308 Dec 17 2008 vmlinuz-2.6.18-128.el5
- Grub in Interaktieven Shell bedinen.
http://www.ordix.de/ORDIXNews/3_2003/unix_linux_1.html
-Kopieren MBR (Master Boot-Record) auf eine andere Platte (bei uns andere Partion)
z.B.
[root@ws09 ~]# grub-install /dev/sdb1
- Netzwerk
[root@ws09 sbin]# iptstate
- Memory/swap anzeigen.
[root@ws09 ~]# free
total used free shared buffers cached
Mem: 4014672 967284 3047388 0 84832 349848
-/+ buffers/cache: 532604 3482068
Swap: 4096564 0 4096564
- mrtg Tool downloaden und testen
im verzeichnis rmtg-tool auf USB stick
- die zwei mrtg_* dateien nach /var/www/html/graph kopieren.
- pkg installieren
[root@ws09 ~]# rpm -q mrtg
mrtg-2.14.5-2
[root@ws09 ~]# cd /install/mrtg/
[root@ws09 mrtg]# mkdir /var/www/html/graph/
[root@ws09 mrtg]# cp /install/mrtg/* /var/www//html/graph/
[root@ws09 mrtg]# tail -2 /install/mrtg/crontab
*/5 * * * * root env LANG=C /usr/bin/mrtg /var/www/html/graph/mrtg_cfg_mem
[root@ws09 mrtg]# tail -2 /install/mrtg/crontab >> /etc/crontab
[root@ws09 mrtg]# mkdir /var/www/html/graph/mem
[root@ws09 mrtg]# env LANG=C /usr/bin/mrtg /var/www/html/graph/mrtg_cfg_mem ## zwei mal ausführen
17-07-2009 13:10:03, Rateup WARNING: /usr/bin/rateup could not read the primary log file for mem
17-07-2009 13:10:03, Rateup WARNING: /usr/bin/rateup The backup log file for mem was invalid as well
17-07-2009 13:10:03, Rateup WARNING: /usr/bin/rateup Can't remove mem.old updating log file
17-07-2009 13:10:03, Rateup WARNING: /usr/bin/rateup Can't rename mem.log to mem.old updating log file
You have new mail in /var/spool/mail/root
[root@ws09 mrtg]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
Aufruf in Web:
http://ws09.windmuehl.linux/graph/mem/mem.html
- Bonding / Truncking.
- Zusammenschluß von mehere Physikalische Netzwerkadapter zu einen logischen Adapter.
- Verdoppeln der möglichen Übertragungsraten.
- erhöhen der Ausfallsicherheit durch retundanz.
- Internet: http://www.docs.hp.com/en/B9903-90050/ch05s04.html