Archives

Categories

some random Linux tips

  • echo 1 > /proc/sys/vm/block_dump
    The above command sets a sysctl to cause the kernel to log all disk writes. Below is a sample of the output from it. Beware that there is a lot of data.
    Jan 10 09:05:53 aeon kernel: kjournald(1048): WRITE block XXX152 on dm-6
    Jan 10 09:05:53 aeon kernel: kjournald(1048): WRITE block XXX160 on dm-6
    Jan 10 09:05:53 aeon kernel: kjournald(1048): WRITE block XXX168 on dm-6
    Jan 10 09:05:54 aeon kernel: kpowersave(5671): READ block XXX384 on dm-7
    Jan 10 09:05:54 aeon kernel: kpowersave(5671): READ block XXX400 on dm-7
    Jan 10 09:05:54 aeon kernel: kpowersave(5671): READ block XXX408 on dm-7
    Jan 10 09:05:54 aeon kernel: bash(5803): dirtied inode XXXXXX1943 (block_dump) on proc
  • Prefixing a bash command with ‘ ‘ will prevent a ! operator from running it. For example if you had just entered the command ” ls -al /” then “!l” would not repeat it but would instead match the preceeding command that started with a ‘l’. On SLES-10 a preceeding space also makes the command not appear in
    the history while on Debian/etch it does (both run Bash 3.1).
  • LD_PRELOAD=/lib/libmemusage.so ls > /dev/null

    The above LD_PRELOAD will cause a dump to stderr of data about all memory allocations performed by the program in question. Below is a sample of the output.

    Memory usage summary: heap total: 28543, heap peak: 20135, stack peak: 9844
             total calls   total memory   failed calls
     malloc|         85          28543              0
    realloc|         11              0              0   (in place: 11, dec: 11)
     calloc|          0              0              0
       free|         21          12107
    Histogram for block sizes:
        0-15             29  30% ==================================================
       16-31              5   5% ========
       32-47             10  10% =================
       48-63             14  14% ========================
       64-79              4   4% ======
       80-95              1   1% =
       96-111            20  20% ==================================
      112-127             2   2% ===
      208-223             1   1% =
      352-367             4   4% ======
      384-399             1   1% =
      480-495             1   1% =
     1536-1551            1   1% =
     4096-4111            1   1% =
     4112-4127            1   1% =
    12800-12815           1   1% =
    

Comments are closed.