/var/log auf tmpfs mit (Rück)Sicherung

Warum Debian und/oder eine seiner Spielarten? Was muss ich vorher wissen? Wo geht es nach der Installation weiter?
Antworten
rayman39
Beiträge: 64
Registriert: 23.04.2009 19:34:57

/var/log auf tmpfs mit (Rück)Sicherung

Beitrag von rayman39 » 25.10.2010 17:00:31

Hallo zuammen,

ich möchte in den boot / shutown - prozess gerne sowas einbauen um schreibzugriffe auf meine CF-Karte zu vermeiden:
  • /var/log als tmpfs im ram mounten
  • beim starten alle vorhandenen logs von /var/log_bak in die ramdisk nach /var/log kopieren.
  • beim shutdown alle neuen / geänderten dateien wieder zurückkopieren/überschreiben von /var/log nach /var/log_bak auf die cf-karte.

wo (runlevel/initscrip) hänge ich die beiden scripte am besten ein ?

Oder ist es praktikabler ein unionfs mini_fo o.ä. einzusetzen. wie würde für diesen fall ein Eintrag in der FStab aussehen?

Viele Grüße

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: /var/log auf tmpfs mit (Rück)Sicherung

Beitrag von rendegast » 25.10.2010 17:34:16

schreibzugriffe auf meine CF-Karte zu vermeiden:
auch RAMRUN, RAMLOCK in /etc/default/rcS

in fstab
tmpfs /tmp ...
(tmpfs /var/tmp ...)
tmpfs /var/log ...
siehe andere Beispiele.

Das Verschiebescript direkt nach mountall und vor anderen in Runlevel S,
respektive nach dem "Killall" und vor dem mountall beim Beenden in Runleveln 0 und 6.
(Ein bischen LSB-Header-Magie)

Aber vielleicht beobachtest Du erstmal, was der syslog so treibt,
respektive wie Meldungen zu minimieren sind.
Da das nach einer Weile wohl weniger Schreibzugriff bedeutet, als ein angefülltes /var/log/ (~50-100MB) jedesmal zu kopieren.
(Obwohl da auch Minimierungspotential mit rsync oder 'cp --update' wäre)
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

rayman39
Beiträge: 64
Registriert: 23.04.2009 19:34:57

Re: /var/log auf tmpfs mit (Rück)Sicherung

Beitrag von rayman39 » 25.10.2010 17:56:05

Danke. Die Sachen mit dem varrun/lock habe ich bereits.

ich würde nur diejenigen dateien zurückkopieren, die sich auch geändert haben. hoffe, dadurch schon die schreibzugriffe zu minimieren.
ich könnte natrülcih auch komplett auf (ausgewälte) logs verzichten und nur in die das tmpfs loggen

Also meine rc-Verzeichnisse sehen so aus:

/etc/rcS.d
lrwxrwxrwx 1 root root 24 23. Okt 20:16 S01mountkernfs.sh -> ../init.d/mountkernfs.sh
lrwxrwxrwx 1 root root 14 23. Okt 20:16 S02udev -> ../init.d/udev
lrwxrwxrwx 1 root root 20 24. Okt 13:27 S03mdadm-raid -> ../init.d/mdadm-raid
lrwxrwxrwx 1 root root 26 23. Okt 20:16 S03mountdevsubfs.sh -> ../init.d/mountdevsubfs.sh
lrwxrwxrwx 1 root root 18 23. Okt 20:16 S04bootlogd -> ../init.d/bootlogd
lrwxrwxrwx 1 root root 24 23. Okt 20:16 S05keyboard-setup -> ../init.d/keyboard-setup
lrwxrwxrwx 1 root root 16 24. Okt 15:34 S06hdparm -> ../init.d/hdparm
lrwxrwxrwx 1 root root 21 23. Okt 20:16 S06hostname.sh -> ../init.d/hostname.sh
lrwxrwxrwx 1 root root 25 24. Okt 13:18 S06hwclockfirst.sh -> ../init.d/hwclockfirst.sh
lrwxrwxrwx 1 root root 22 23. Okt 20:16 S07checkroot.sh -> ../init.d/checkroot.sh
lrwxrwxrwx 1 root root 26 23. Okt 20:16 S08cryptdisks-early -> ../init.d/cryptdisks-early
lrwxrwxrwx 1 root root 20 24. Okt 13:18 S09hwclock.sh -> ../init.d/hwclock.sh
lrwxrwxrwx 1 root root 24 23. Okt 20:16 S09ifupdown-clean -> ../init.d/ifupdown-clean
lrwxrwxrwx 1 root root 27 23. Okt 20:16 S09module-init-tools -> ../init.d/module-init-tools
lrwxrwxrwx 1 root root 17 23. Okt 20:16 S09mtab.sh -> ../init.d/mtab.sh
lrwxrwxrwx 1 root root 20 23. Okt 20:16 S10cryptdisks -> ../init.d/cryptdisks
lrwxrwxrwx 1 root root 20 23. Okt 20:16 S11checkfs.sh -> ../init.d/checkfs.sh
lrwxrwxrwx 1 root root 18 23. Okt 20:16 S12ifupdown -> ../init.d/ifupdown
lrwxrwxrwx 1 root root 21 23. Okt 20:16 S12mountall.sh -> ../init.d/mountall.sh
lrwxrwxrwx 1 root root 31 23. Okt 20:16 S13mountall-bootclean.sh -> ../init.d/mountall-bootclean.sh
lrwxrwxrwx 1 root root 26 23. Okt 20:16 S14mountoverflowtmp -> ../init.d/mountoverflowtmp
lrwxrwxrwx 1 root root 20 23. Okt 20:16 S15networking -> ../init.d/networking
lrwxrwxrwx 1 root root 16 23. Okt 20:16 S15procps -> ../init.d/procps
lrwxrwxrwx 1 root root 19 23. Okt 20:16 S15udev-mtab -> ../init.d/udev-mtab
lrwxrwxrwx 1 root root 17 24. Okt 13:17 S15urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 20 23. Okt 20:16 S15x11-common -> ../init.d/x11-common
lrwxrwxrwx 1 root root 21 23. Okt 20:16 S16mountnfs.sh -> ../init.d/mountnfs.sh
lrwxrwxrwx 1 root root 31 23. Okt 20:16 S17mountnfs-bootclean.sh -> ../init.d/mountnfs-bootclean.sh
lrwxrwxrwx 1 root root 27 23. Okt 20:16 S18console-screen.sh -> ../init.d/console-screen.sh
lrwxrwxrwx 1 root root 13 23. Okt 20:16 S19kbd -> ../init.d/kbd
lrwxrwxrwx 1 root root 23 23. Okt 20:16 S20console-setup -> ../init.d/console-setup
lrwxrwxrwx 1 root root 21 23. Okt 20:16 S21bootmisc.sh -> ../init.d/bootmisc.sh
lrwxrwxrwx 1 root root 14 23. Okt 20:16 S21fuse -> ../init.d/fuse
lrwxrwxrwx 1 root root 24 23. Okt 20:16 S21screen-cleanup -> ../init.d/screen-cleanup
lrwxrwxrwx 1 root root 30 23. Okt 20:16 S22stop-bootlogd-single -> ../init.d/stop-bootlogd-single
/etc/rc0.d
lrwxrwxrwx 1 root root 26 23. Okt 20:16 K01squeezeboxserver -> ../init.d/squeezeboxserver
lrwxrwxrwx 1 root root 13 23. Okt 20:16 K02atd -> ../init.d/atd
lrwxrwxrwx 1 root root 20 24. Okt 17:44 K02atieventsd -> ../init.d/atieventsd
lrwxrwxrwx 1 root root 15 23. Okt 20:16 K02exim4 -> ../init.d/exim4
lrwxrwxrwx 1 root root 26 24. Okt 17:57 K02fglrx-atieventsd -> ../init.d/fglrx-atieventsd
lrwxrwxrwx 1 root root 14 23. Okt 20:16 K02fuse -> ../init.d/fuse
lrwxrwxrwx 1 root root 17 24. Okt 14:52 K02hddtemp -> ../init.d/hddtemp
lrwxrwxrwx 1 root root 15 23. Okt 20:16 K02mdadm -> ../init.d/mdadm
lrwxrwxrwx 1 root root 20 23. Okt 20:16 K02partimaged -> ../init.d/partimaged
lrwxrwxrwx 1 root root 15 23. Okt 20:16 K02samba -> ../init.d/samba
lrwxrwxrwx 1 root root 14 24. Okt 14:54 K02slim -> ../init.d/slim
lrwxrwxrwx 1 root root 17 23. Okt 20:16 K02urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 18 23. Okt 20:16 K03sendsigs -> ../init.d/sendsigs
lrwxrwxrwx 1 root root 17 23. Okt 20:16 K04rsyslog -> ../init.d/rsyslog
lrwxrwxrwx 1 root root 20 24. Okt 13:18 K05hwclock.sh -> ../init.d/hwclock.sh
lrwxrwxrwx 1 root root 22 23. Okt 20:16 K05umountnfs.sh -> ../init.d/umountnfs.sh
lrwxrwxrwx 1 root root 20 23. Okt 20:16 K06networking -> ../init.d/networking
lrwxrwxrwx 1 root root 18 23. Okt 20:16 K07ifupdown -> ../init.d/ifupdown
lrwxrwxrwx 1 root root 18 23. Okt 20:16 K08umountfs -> ../init.d/umountfs
lrwxrwxrwx 1 root root 20 24. Okt 13:27 K09cryptdisks -> ../init.d/cryptdisks
lrwxrwxrwx 1 root root 26 24. Okt 13:27 K10cryptdisks-early -> ../init.d/cryptdisks-early
lrwxrwxrwx 1 root root 20 24. Okt 13:27 K11mdadm-raid -> ../init.d/mdadm-raid
lrwxrwxrwx 1 root root 20 24. Okt 13:27 K11umountroot -> ../init.d/umountroot
lrwxrwxrwx 1 root root 14 24. Okt 13:27 K12halt -> ../init.d/halt
/etc/rc5.d
lrwxrwxrwx 1 root root 18 24. Okt 14:52 S01bootlogs -> ../init.d/bootlogs
lrwxrwxrwx 1 root root 20 23. Okt 20:16 S01partimaged -> ../init.d/partimaged
lrwxrwxrwx 1 root root 17 23. Okt 20:16 S01rsyslog -> ../init.d/rsyslog
lrwxrwxrwx 1 root root 15 23. Okt 20:16 S01samba -> ../init.d/samba
lrwxrwxrwx 1 root root 14 24. Okt 14:54 S01slim -> ../init.d/slim
lrwxrwxrwx 1 root root 15 23. Okt 20:16 S02acpid -> ../init.d/acpid
lrwxrwxrwx 1 root root 13 23. Okt 20:16 S02atd -> ../init.d/atd
lrwxrwxrwx 1 root root 20 24. Okt 17:44 S02atieventsd -> ../init.d/atieventsd
lrwxrwxrwx 1 root root 14 23. Okt 20:16 S02cron -> ../init.d/cron
lrwxrwxrwx 1 root root 14 24. Okt 14:12 S02dbus -> ../init.d/dbus
lrwxrwxrwx 1 root root 15 23. Okt 20:16 S02exim4 -> ../init.d/exim4
lrwxrwxrwx 1 root root 26 24. Okt 17:57 S02fglrx-atieventsd -> ../init.d/fglrx-atieventsd
lrwxrwxrwx 1 root root 17 24. Okt 14:52 S02hddtemp -> ../init.d/hddtemp
lrwxrwxrwx 1 root root 21 24. Okt 13:26 S02loadcpufreq -> ../init.d/loadcpufreq
lrwxrwxrwx 1 root root 15 23. Okt 20:16 S02mdadm -> ../init.d/mdadm
lrwxrwxrwx 1 root root 15 23. Okt 20:16 S02rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root 23 23. Okt 20:16 S02smartmontools -> ../init.d/smartmontools
lrwxrwxrwx 1 root root 13 23. Okt 20:16 S02ssh -> ../init.d/ssh
lrwxrwxrwx 1 root root 22 24. Okt 13:26 S03cpufrequtils -> ../init.d/cpufrequtils
lrwxrwxrwx 1 root root 13 24. Okt 14:29 S03hal -> ../init.d/hal
lrwxrwxrwx 1 root root 18 23. Okt 20:16 S04rc.local -> ../init.d/rc.local
lrwxrwxrwx 1 root root 19 23. Okt 20:16 S04rmnologin -> ../init.d/rmnologin
lrwxrwxrwx 1 root root 26 23. Okt 20:16 S04squeezeboxserver -> ../init.d/squeezeboxserver
lrwxrwxrwx 1 root root 23 23. Okt 20:16 S04stop-bootlogd -> ../init.d/stop-bootlogd

Hinter welchem Script würde ich das dann jeweils einhängen? Gibt es dafür ein spezielles Script (das mei shellscript einhängt) oder erstelle ich die links selbst?

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: /var/log auf tmpfs mit (Rück)Sicherung

Beitrag von rendegast » 25.10.2010 18:12:57

Erstelle einen Header mit default-Start S und default-Stop 0 6.

Für den Start würde ich den Header nach mountoverflowtmp vor networking einstellen:
rcS.d/ hat geschrieben: lrwxrwxrwx 1 root root 21 23. Okt 20:16 S12mountall.sh -> ../init.d/mountall.sh
lrwxrwxrwx 1 root root 31 23. Okt 20:16 S13mountall-bootclean.sh -> ../init.d/mountall-bootclean.sh
lrwxrwxrwx 1 root root 26 23. Okt 20:16 S14mountoverflowtmp -> ../init.d/mountoverflowtmp
lrwxrwxrwx 1 root root 20 23. Okt 20:16 S15networking -> ../init.d/networking
Als Beispiele zum Vergleich wären mountall-bootclean.sh und mountoverflowtmp ganz gut.
rc0.d/ hat geschrieben: lrwxrwxrwx 1 root root 20 23. Okt 20:16 K06networking -> ../init.d/networking
lrwxrwxrwx 1 root root 18 23. Okt 20:16 K07ifupdown -> ../init.d/ifupdown
lrwxrwxrwx 1 root root 18 23. Okt 20:16 K08umountfs -> ../init.d/umountfs
Hier nach dem ifupdown, vor dem umountfs.
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

Antworten