How to force a fsck of a file system, say the root, during the next rebooting of Linux? 2 possible ways: /forcefsck way for / # touch /forcefsck and reboot. Next time the / will be fsck’ed . systemd way Add these 2 kernel boot parameters: fsck.mode=force fsck.repair=yes What these 2 kernel parameters do: KERNEL
Read more
Tag: System
How to tune systems to achieve high performance in virtualization circumstances?
Posted onMost time, we need to tune system parameters to achieve better performance but what the general parameters to be tuned in Linux systems. I think you may want to add following parameters to Kernel boot (/etc/default/grub) parameters intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll intel_pstate=disable At the same time, you may also want to shutdown/open Pause Loop Exiting (PLE).
Read more
How to get processes’ I/O utilization percentage
Posted onTwo notices: 1, a process has only one main thread which is itself. 2, a process has many threads. Solution 1: Please use taskstats [1] related interfaces, and send TASKSTATS_TYPE_PID and TASKSTATS_TYPE_TGID commands to kernel to get a process’s ‘blkio_delay_total’ parameter for a process with one main thread and a process with threads separately. Solution
Read more
How to pause and resume the execution of a process on Linux?
Posted onHow to pause the execution of a process on Linux so that the CPU can be freed? Later, if the node is idle again, how to resume the execution? There are 2 signals related to stopping (pausing) and continuing (resuming) processes: Stop Default action is to stop the process. Cont Default action is to continue
Read more
How to get the highest temperature from all sensors in a server on Linux?
Posted onIt is useful to monitor a server node’s temporary. Among all the sensors’ temperatures, the higher one may be a very important one. How to get the highest temperature from all sensors in a server on Linux? You can use this command to get the the highest temperature from all sensors in a server on
Read more
How to estimate the memory usage of HDFS NameNode for a HDFS cluster?
Posted onHDFS stores the metadata of files and blocks in the memory of the NameNode. How to estimate the memory usage of HDFS NameNode for a HDFS cluster? Each file and each block has around 150 bytes of metadata on NameNode. So you may do the calculation based on this. For examples, assume block size is
Read more
Is Samba sync or async for writes?
Posted onBeing sync or async for data writing of a file system or a network file system affects the data integrity. Is Samba sync or async for writes? In summary, Samba writes are async by default. But the behavior is configurable. Here is a great summary by Eric Roseme. Samba defaults to asynchronous writes. smbd writes
Read more
How to print a line to STDERR and STDOUT in Java?
Posted onIn Java, how to print a string as a line to STDOUT? That is, the string and the newline character, nicely? And similarly, how to print the line to STDERR? In Java, you can print string in a new line by ‘System.out.println()’ to STDOUT: System.out.println(“my msg here”); In Java, print a string str to STDERR
Read more
Getting Hostname in Bash in Linux in 3 Ways
Posted onGetting the hostname of the node running a program can be useful in various scenarios, such as creating logs with the hostname, identifying which node a script is running on, or configuring a distributed system with different nodes. In Bash, there are several ways to retrieve the hostname of the machine, as mentioned in the
Read more
How to get the epoch timestamp in Java?
Posted onIn Java, how to get the epoch timestamp, the number of seconds passed since the epoch? In Java, you can get the current time in milliseconds and then calculate the epoch time: long ts = System.currentTimeMillis()/1000; Example: $ wget –quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar Welcome to JavaREPL version 428 (Java HotSpot(TM) 64-Bit
Read more
How to get an environment variable in Java?
Posted onIn Java, how to get the value (string) of an environment variable? You may call the System.getenv(name) library function in Java to get the environment variable value. public static String getenv(String name) Parameters: name – the name of the environment variable Returns: the string value of the variable, or null if the variable is not
Read more
Any good Java REPL tool/implementation?
Posted onAny good suggestions on a Java REPL implementation like ‘scala’ and ‘python’ or ‘php -a’? The java-repl tool https://github.com/albertlatacz/java-repl/ works nicely for most situations for me. It is released as a .jar. Hence, it is easy to download and run: $ wget –quiet https://github.com/albertlatacz/java-repl/releases/download/428/javarepl-428.jar -O /tmp/javarepo-428.jar && java -jar /tmp/javarepo-428.jar One usage example is as
Read more
How to set process with lowest priority?
Posted onIn system, sometimes, we need backstage threads with very very low priority since it cannot preempt any normal process asks for CPU. SCHED_IDLE class satisfies this requirement which has the priority lower than “nice=19” of CFS. Following code does this. 241 void set_idle_priority(void) { 242 struct sched_param param; 243 param.sched_priority = 0; 244 int s
Read more
How to do a good research in system field?
Posted onWe may need to check some materials about how to do good research in system field if you a Ph.D. focusing on system research. Some references: 1, How to write a good systems paper 2, How to be a good graduate student 3, Doing a System Ph.D. 4, Giving an Academic Talk Welcome to add
Read more
Libvirt crash when upgrade from version 1.2.2 to version 2.5.0
Posted onIf you install libvirt from ubuntu software library like this sudo apt-get install libvirt-bin The default version is 1.2.2 for Ubuntu Trusty. However, after you upgrade it to version 2.5.0 from its source codes (restart the libvirtd service), you will see following error if you want to install vm with virt-install. # ./installkvm1.sh Starting install…
Read more
How to output function stack in Linux Kernel
Posted onIn Linux Kernel, we usually trace/debug what kind of events will trigger the phenomena we find in the system. For example, what kind of event will trigger the fact that the timeslice of one process will be very short. In order to solve these kind of problems, we need to output the function stack. Currently,
Read more
What’s the difference between memory coherence and consistency?
Posted onIn memory hierarchical, it needs to be coherence and consistency. However, they are different things. What are the differences? Memory coherence: a memory system is coherent if any read of a data item returns the most recently written value of that data item (what values can be returned by a read). Memory consistency: A memory
Read more
Ubuntu’s GUI response is very slow
Posted onFor Dell PowerEdge T630 server, if you install latest Ubuntu desktop version (16.04) or (14.04), you will get a very slow GUI (X-window). $ inxi -G Graphics: Card: Matrox Systems G200eR2 X.org: 1.15.1 driver: vesa tty size: 205×58 Advanced Data: N/A out of X For Ubuntu 14.04.1, this problem can be solved by following steps.
Read more
How to collect VM exit numbers in KVM
Posted onSometimes, we may want to know the specific benchmark can cause what kind of VM exits. 1, Install perf. 2, # perf kvm stat record -a ^C 3, # perf kvm stat report This will report your VM exit numbers and what kind of operation lead to VM exit. You may need to compare many
Read more
How to install sshfs on CentOS 7?
Posted onsshfs is a nice tool. But it seems there is no support to it in a newly installed CentOS 7 Linux system: Not installed by default: # sshfs -bash: sshfs: command not found Seems not available from the repositories # yum install sshfs -y Loaded plugins: fastestmirror Repodata is over 2 weeks old. Install yum-cron?
Read more