Things I don't want to look for twice..

Monthly Archives: May 2014

clustered LVM to non-clustered LVM

I had to re-configure clustered LVM to non-clustered LVM for some Lustre setup I’m working on. Thing is, clustered LVM can only be accessible if clvmd service is running. But I couldn’t start it, because I needed all cluster services down. After searching, I found that:

– to check if the LVM is clustered:

vgdisplay vgsrv1 --config 'global {locking_type = 0}' | grep Clustered
 WARNING: Locking disabled. Be careful! This could corrupt your metadata.
 Clustered yes

– to change it back to non-clustered LVM:

vgchange -cn vgsrv1 --config 'global {locking_type = 0}'

Now, to refresh your VG list type:

vgchange -ay

logrotate doesn’t rotate from file exists error

So, I had the following config:

/var/log/remote/*/php/*.log /var/log/remote/*/apache2/*.log { 
 rotate 7
 create 640 rsyslog rsyslog
 /etc/init.d/rsyslog restart > /dev/null

Paths were valid, ownership of folders was root.root, still, I had sample.log which wouldn’t get renamed to sample.log.1 and new file wasn’t created either. Have been sitting on this for days now. Decided to redo the config (was actually a bigger one, removed every comment, removed everything it wasn’t needed for my test and ran logrotate with the new config, forced. And eventually after carefully reading the logs (used logrotate -vf /path/to/conf) I found out that:

error: error creating output file /var/log/remote/something/apache2/error.log.1.gz: File exists

Ok, the file existed. So what? It had the necessary permissions to delete/replace it. But, of course, it didn’t. Moreover, after getting this error, creating other sample.log.1 files didn’t work either so rotation failed. So I deleted that empty file (yes, it was empty) and retried the logrotate on my test config. Of course, it worked. Surely I couldn’t find any documentation on this, so next time it happens, try to run verbosely and check for “file exists” errors. That will explain strange logrotate behavior.