[arch-general] back up /var/log before shutdown
lisaev at umail.iu.edu
Wed Jun 20 10:57:25 EDT 2012
On Wed, 20 Jun 2012 10:36:17 +0200
Arno Gaboury <arnaud.gaboury at gmail.com> wrote:
> Dear all,
> My /, /boot and /usr are on a BTRFS /(except /boot on ext2) on a ssd.
> I want to add this line in my fstab to avoid too many writings on my ssd :
> *tmpfs /var/log tmpfs nodev,nosuid,noexec 0 0*
> So each time I reboot, my /var/log will be emptied, which could be a
> problem in case of serious issue on my box. I was then thinking of a way
> to backup this folder before I shutdown. I found this trick in the Arch
> add this in my */etc/rc.local.shutdown*:
> |*echo "Copying LOGs..."
> now=`date +"%Y%m%d_%Hh%M"`
> mkdir -p /logs_backup/$now
> cp -Rp /var/log/* ~/backup/logs_backup/$now/*
> My ~ folder is on another HD.
> Will this script be enough to do the job?
> TY for advising.
Well, SSD's limited number of write cycles is largerly a myth these days (see
www.toshiba.com/taec/news/media_resources/docs/SSDmyths.pdf). Of course it
depends on your particular model/brand but practically, an SSD will most
likely outlive your machine anyways. So I wouldn't worry about /var/log too
However, optimizing log writes is a good idea even on an HDD. I think putting
/var/log to RAM (as well as putting there firefox/thunderbird profiles) is
stupid and is asking for trouble. A much better approach is to properly
configure syslog-ng or rsyslog, specifically:
1. You don't have to write same log into messages.log, kernel.log etc...
2. If you have a univ. wifi with RADIUS, you most likely obtain lease every 15
min. this log (with level debug) goes into /var/log/dhcpcd.log.
3. Firewall logging is useful for network monitoring/debugging,
but /var/log/iptables.log will grow huge on a public network.
In cases 2 and 3 you can tell syslog to put the corresponding files
into /tmp/log (I assume /tmp is already tmpfs) since this info is not really
needed in the long term.
GnuPG key: 0x164B5A6D
Fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 490 bytes
Desc: not available
More information about the arch-general