Move /var directories to to /mnt on an EC2 instance
I don't know what you keep in /var/www
, but the contents on my servers definitely can't be described as "ephemeral", which I understand to mean "could go away any time, and I don't much mind". If that's not what amazon means by "ephemeral", I apologise.
As for /var/log
, if you don't care about the log data at all, don't collect it in the first place.
If you do care about it, but can't afford to hold it in primary storage very long, then this isn't a mounting issue so much as a log management problem. I'd be inclined to use logrotate
, if it's available to you, and configure it to move old logs out to /mnt
every week or so. That way, the old logs are there (until the ephemeral storage goes away), but the current log is safe on primary storage.
A logrotate recipe like
/var/log/foo {
olddir /mnt
compress
weekly
rotate 1000
postrotate
/etc/rc.d/init.d/fooservice restart
endscript
}
might be of use, at least as a template.