A cute CLI trick for emergencies

Bryn M. Reeves bmr at redhat.com
Fri Dec 9 11:21:32 UTC 2011

On 12/09/2011 01:54 AM, jdow wrote:
> On 2011/12/08 16:56, Craig White wrote:
>> On Thu, 2011-12-08 at 09:27 -0600, Aaron Konstam wrote:
>>>> And thus the drive is /dev/sdf, with the data partition /dev/sdf1.
>>>> You may need to scroll back a bit if a lot of stuff is going on in
>>>> dmesg.
>>> Great, but could the displaying of the information be made more obscure?
>> ----
>> dmesg | grep usb
>> Craig
> After the kernel ring buffer has wrapped?
> Try this:
> grep usb /var/log/dmesg
> Then you have to decode it. And, of course, the drive on which "grep" lives
> AND the drive on which /var/log/dmesg lives, if different, will be spun up.

The /var/log/dmesg file is a snapshot taken during booting (when 
rc.sysinit runs) on systems using traditional SysV init (inc. upstart) 
so if a device was not present during boot (or had its drivers loaded 
after the snapshot was taken) it will not appear here.

It's not updated later and does not seem to be created on systems using 

Either look in /var/log/messages or specify log_buf_len=n[KMG] on the 
kernel command line to set a lager ring buffer (modern systems with 
plenty of RAM can comfortably increase this to 10s of MB rather than the 
128k default).


More information about the users mailing list