TRACE-CMD-RESTORE(1)
๐ trace-cmd-restore(1) โ the libtracefs manual, but make it make sense
okay so bestie, this one's from the libtracefs manual set and it's genuinely a lifesaver. it's trace-cmd-restore, and yes the name is lowercase in the wild but we're not doing that here ๐
โจ NAME โจ
trace-cmd-restore โ restore a failed trace record. that's it. that's the whole vibe. you had a crash, the record didn't finish, and this lil icon brings it back to life ๐ซถ
๐ฆ SYNOPSIS ๐ฆ
trace-cmd restore [OPTIONS] [command] cpu-file [cpu-file ...]
๐ธ DESCRIPTION ๐ธ
so the trace-cmd(1) restore command will restore a crashed trace-cmd-record(1) file. like, imagine your record job justโฆ didn't make it ๐ญ if for some reason a trace-cmd record fails, it leaves behind the per-cpu data files and never creates the final trace.dat. that's the sad part. the restore command is the part where we fix it โ it appends those files together to create a working trace.dat file that you can actually read with trace-cmd-report(1). slay.
the way it works is: when trace-cmd record runs, it spawns off a process per CPU and writes to a per-cpu file usually called trace.dat.cpuX, where X represents the CPU number that it's tracing. if the -o option was used in the trace-cmd record, then the CPU data files will have that name instead of the trace.dat name. lowkey important to remember. and if a totally unexpected crash occurs before the tracing is finished, then the per-CPU files will still exist but there will not be any trace.dat file to read from. that's the exact moment trace-cmd restore steps in โ it lets you create a trace.dat file with the existing data files. main character energy fr ๐
โญ OPTIONS โญ
-cโ create a partialtrace.datfile from the machine, to be used with a fulltrace-cmd restoreat another time. this option is useful for embedded devices. if a server contains the cpu files of a crashedtrace-cmd record(ortrace-cmd listen),trace-cmd restorecan be executed on the embedded device with the-coption to get all the stored information of that embedded device. then the file created could be copied to the server to run thetrace-cmd restorethere with the cpu files. iconic cross-machine workflow ๐ง
if -o is not specified, then the file created will be called trace-partial.dat. this is because the file is not a full version of something that trace-cmd-report(1) could use. it's a partial, bestie, don't come for it ๐
-ttracing_dir โ used with-c, it overrides the location to read the events from. by default, tracing information is read from thedebugfs/tracingdirectory.-twill use that location instead. this can be useful if thetrace.datfile to create is from another machine. justtar -cvf events.tar debugfs/tracingand copy and untar that file locally, and use that directory instead. chef's kiss ๐-kkallsyms โ used with-c, it overrides where to read the kallsyms file from. by default,/proc/kallsymsis used.-kwill override the file to read the kallsyms from. this can be useful if thetrace.datfile to create is from another machine. just copy the/proc/kallsymsfile locally, and use-kto point to that file. no cap, super handy โจ-ooutput โ by default,trace-cmd restorewill create atrace.datfile (ortrace-partial.datif-cis specified). you can specify a different file to write to with the-ooption. name it whatever you want, live your truth ๐-iinput โ by default,trace-cmd restorewill read the information of the current system to create the initial data stored in thetrace.datfile. if the crash was on another machine, then that machine should have thetrace-cmd restorerun with the-coption to create thetrace.datpartial file. then that file can be copied to the current machine wheretrace-cmd restorewill use-ito load that file instead of reading from the current system. literally the whole point of the partial file lol ๐ฆ
๐ฅ EXAMPLES ๐ฅ
if a crash happened on another box, you could run:
$ trace-cmd restore -c -o box-partial.dat
then on the server that has the cpu files:
$ trace-cmd restore -i box-partial.dat trace.dat.cpu0 trace.dat.cpu1
and that would create a trace.dat file for the embedded box. ate. no crumbs. ๐
๐ SEE ALSO ๐
trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1)
go read those too, iykyk ๐
๐ AUTHOR ๐
Written by Steven Rostedt, <rostedt@goodmis.org[1]> โ ty king ๐ซถ
๐ RESOURCES ๐
https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
๐ COPYING ๐
Copyright (C) 2010 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).
๐ NOTES ๐
rostedt@goodmis.orgmailto:rostedt@goodmis.org
okay that's the whole page bestie, ily, go restore that crashed trace ๐โจ
this lil doc was brought to you by libtracefs, dated 03/09/2026 โ mwah, see u in the group chat ๐
๐ฆ where this page comes from
- arch rolling: trace-cmd 3.4-1 ยท GPL-2.0-only AND LGPL-2.1-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms