跳至主要内容

博文

目前显示的是标签为“linux”的博文

clean up docker images daily and weekly

Here’s the crontab content I used @daily docker rmi `docker images -f dangling=true -q` @weekly docker rmi `docker images -f 'reference=100.98.97.206/*/*-ui:*' --format "{% raw %}{{.Repository}}:{{.Tag}}{% endraw %}"` reference document https://docs.docker.com/engine/reference/commandline/images/#filtering

emulate htop with top

The top program from procps-ng (debian, centos/el7 later) Ever being with htop for some time and miss the process tree and graphical CPU/memory usage? The top program from procps-ng (debian, centos/el7 later) can easily emulate the presentation of htop view. Start the top program, it looks like following with its default configuration: top - 09:20:54 up 307 days, 22:58, 4 users, load average: 0.80, 0.74, 0.75 Tasks: 486 total, 1 running, 485 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.6 us, 0.6 sy, 0.0 ni, 98.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 65796532 total, 808264 free, 22970744 used, 42017524 buff/cache KiB Swap: 16777212 total, 15433868 free, 1343344 used. 39944388 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 30561 clouder+ 20 0 16.0g 2.3g 23296 S 11.6 3.6 11037:25 java 703 yarn 20 0 2586468 429556 20704 S 1.0 0.7 258:14.48 java 10 root 20 0 0 0 0 S 0.7...

chcon can not apply partial context to unlabeld file excerpt: fix broken selinux label

The broken selinux label and way to fix Yesterday I work on a task of compress a qcow2 vm image. As usual I made a temp directory in the directory of the image, and fired the qemu-img convert and then virt-sparsify command to do the compression. Soon, after some seconds, an unusual error occurred. My task received a mysterious signal 9 and exited. As I am the only user of the machine at the time. A blind guess and some ls -lhz commands lead me to the broken selinux label problem. It turns out that directory up to the second level of the directory are all unlabeled. My first attempt with chcon -R -t virt_image_t <workdir> failed with some error messages looks like bellow: chcon: can't apply partial context to unlabeled file 'VERSION.png' chcon: can't apply partial context to unlabeled file '1.1_V12' chcon: can't apply partial context to unlabeled file 'pre-release' chcon: can't apply partial context to unlabeled file ...

Device excluded by a filter excerpt: pvcreate encounter an error on newly prepared hard drive

Device /dev/sdc excluded by a filter The title is one of the several issues I met when preparing new hard drives for my Linux Host. By looking at `/etc/lvm.conf` I am 100% sure that there's no filter setup. It turns out to be the Filesystem magic bits were remaining on my used harddrives which prevent the pvcreate command to run. Those magic bits won't be erased by `parted` tool. One must explicitly invoke `wipefs` command against the drive for magic bits cleanup. wipefs -a /dev/sdc Once did this, the `pvcreate` is happy processing the hard disk for physical volume creation.