Welcome to the Linux Foundation Forum!

When was lvextend command run?


Hello Friends,
There is a requirement from Client to not run lvextend command if it was run in last 24 hrs.
I have tried the following and still havent figured out how to do it, any help will be highly appreciated:
1.] Have tried checking /var/log/messages, dmesg command logs.
2.] There is no /var/log/syslog so cannot check that. Also acnnot activate logging by modifying lvm2.conf file as there are many servers.
3.] history command only displays 10 commands and that too from current tty.

Please suggest how I can capture when a particular command especially "lvextend" was run last?

Thanking You,
Karthik R


  • mohdarif1857

    Check for last lvm commands ran in past in LVM metadata backup and archive files namely /etc/lvm/backup/* and /etc/lvm/archive/* files. If you find lvextend command in any of the files you will also find date/time when that command was ran.

    grep -A 3 "lvextend" /etc/lvm/{archive,backup}/*


Upcoming Training