I am trying to understand the SATA Host-Device Communication and for that I have put a lot of debug messages in the kernel driver code. Now messages are in such a huge amount that I am not able to see the initial messages of the device enumeration in the dmesg log. For the same I have modified CONFIG_LOG_BUF_SHIFT(=21) config variable to increase the ring buffer size from where dmesg takes the message but still I am facing the same issue.

So, Is there any method available by which I can log all the dmesg from the kernel boot in to a specific file?

Thanks for the Help in advance.


You can use:

cat /var/log/dmesg > file.txt

and use:

head /var/log/dmesg

if you want to see the first lines of dmesg.

See too 'man head' for more specifications. The '>' symbol redirect the ouput of 'cat' to the 'file.txt'

  • Thanks for the reply this method I know and tried but it didn't help I want all the messages from start of dmesg. e.g. from "[ 0.000000] Initializing cgroup subsys cpuset" – Hemant Feb 12 '16 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.