Sungju's Slow Life

Personal journal


linux

  • How to check memory usage in Linux – part 1. User space

    Here I am explaining how to check memory usage in the user space, especially from the command line. There are two perspective to see memory usage – System level and per-process level. System level memory usage check Per-process level memory usage check System level memory usage check free top /proc/meminfo /proc/buddyinfo /proc/pagetypeinfo vmstat /var/log/sa/ You… Continue reading

  • What’s virtual address limit of 32bit/64bit Linux kernel?

    RHEL 5 code 32bit: include/asm-i386/processor.h /* * User space process size: 3GB (default). */ #define TASK_SIZE (PAGE_OFFSET) 64bit: include/asm-x86_64/processor.h /* * User space process size. 47bits minus one guard page. */ #define TASK_SIZE64 (0x800000000000UL – 4096) /* This decides where the kernel will search for a free chunk of vm * space during mmap’s. */… Continue reading

  • How to reload udev rules

    If you made changes in udev rules, you might want to reboot to apply the changes. But, there’s a simpler method than system reboot. It depends which version you are using. I’ll put RHEL5 and RHEL6 commands which might cover most scenario. In RHEL5 $ yum install udev $ udevcontrol reload_rules $ /sbin/start_udev $ udevtrigger… Continue reading

  • vmware-tools installation failure in Fedora 18?

    If you are failing installing vmware-tools in Fedora 18 with the following message, it might be caused of the changes in Fedora 18 kernel-revel package. The path “” is not a valid path to the …. Here’s the simple command that will resolve the issue. It also works for latest Fedora 17 issue. $ cp… Continue reading

  • Jump into a vmcore analysis – Step 1

    If you have a vmcore needs to be analysed, you should have to download related kernel-debuginfo package unless your kernel does have all the debug information in the live kernel. You might easily check the kernel version of the vmcore by run ‘uname -r’, but safest way would be checking vmcore itself. You can use… Continue reading

  • How to keep record the commands executed by root

    If you want to keep record of the commands executed by root account, you can achieve that by using audit rules. First, add the below line in /etc/audit/audit.rules -a entry,always -S execve -F uid=0 http://pagead2.googlesyndication.com/pagead/show_ads.js And restart auditd to apply the changes $ chkconfig auditd on $ service auditd restart Continue reading

  • How to check which applications are using hugepages

    You can find how much is allocated and how much is actually used by HugePages by run the following command. $ grep -i huge /proc/meminfo AnonHugePages: 776192 kB HugePages_Total: 241 HugePages_Free: 113 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB But, there’s a time you also want to know which applications are actually used HugePages. You… Continue reading

  • How many threads are in the system

    If you want to check how many threads are in the system to compare it with the maximum allowed threads by the system (kernel.threads-max), you can use one of the below two methods. $ cat /proc/loadavg 0.74 0.93 1.04 3/393 31977 4th column in the above output is related to the current threads number. In… Continue reading

  • How to build a module with source codes in separate directories.

    If you want to use separate directories for source files and target modules, you can use below scheme. mod_main.c #include #include MODULE_LICENSE(“GPL”); static int __init mod_entry(void) { return 0; } static void __exit mod_exit(void) { return; } module_init(mod_entry); module_exit(mod_exit); sub_mod.c #include #include int sub_func(int i) { printk(“Hello %d”, i); return 0; } EXPORT_SYMBOL(sub_func); http://pagead2.googlesyndication.com/pagead/show_ads.js Makefile… Continue reading

  • Check how much is used up by a specific user

    You can use below command to check how much space is consumed by a specific user (‘testuser’ in this case). $ cd / $ find . -user testuser -type f -exec du -k {} ; | awk ‘{ s = s + $1 } END { print “Total used: “, s }’ Total used: 5322333… Continue reading

  • How to debug an application

    If you want to debug an application that is shipped with the fedora, you can use the following command. [root@localhost ~]# debuginfo-install gedit-3.4.2-1.fc17.x86_64 Loaded plugins: langpacks, presto, refresh-packagekit enabling fedora-debuginfo enabling updates-debuginfo –> Running transaction check —> Package atk-debuginfo.x86_64 0:2.4.0-1.fc17 will be installed —> Package cairo-debuginfo.x86_64 0:1.10.2-7.fc17 will be installed —> Package enchant-debuginfo.x86_64 1:1.6.0-4.fc17 will… Continue reading

  • How to check LVM usage history

    If your lvm storage has some problem, you can dump it with the following command. $ dd if= of=lvm_head.out bs=100M count=1 $ strings lvm_head.out > dump.txt And make the following awk script (lvm_history.awk) to check the history. BEGIN { new = 1 pecount = 0 } { if ($1 == “pe_count”) pecount = $3 if… Continue reading