'Linux'에 해당되는 글 777건

  1. 2024.01.09 리눅스 파일 시스템 캐싱
  2. 2023.10.18 multitail / tail 2
  3. 2023.10.17 top 로그로 남기기
  4. 2023.09.04 tcpdump
  5. 2023.09.01 dhcpd IP 할당 규칙
  6. 2023.08.30 시스템 audit 로그
  7. 2023.08.28 debian nvme tool
  8. 2023.08.17 edid-read
  9. 2023.08.08 .bashrc 설정 history
  10. 2023.07.27 lvmcache bcache
Linux2024. 1. 9. 16:18

요즘(?) 리눅스는 언젠가 부터 그냥 냅두면 메모리를 야곰야곰 먹으면서 file system을 캐싱하는데

page cache를 위해서 free 메모리를 자꾸 갉아먹는다.

[링크 : https://jujupapa.tistory.com/31]

 

slabtop이라는걸 통해서 캐싱되고 있는 페이지를 확인할 수 있다는데 봐도 무슨 소리이지 모르겠고..

slabtop
fopen /proc/slabinfo: 허가 거부

sudo cat /proc/slabinfo 
slabinfo - version: 2.1
# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>
nf_conntrack         856   1248    256   32    2 : tunables    0    0    0 : slabdata     39     39      0
ovl_inode             44     44    728   22    4 : tunables    0    0    0 : slabdata      2      2      0
i915_dependency      256    256    128   32    1 : tunables    0    0    0 : slabdata      8      8      0

sudo slabtop -o
 활성 / 총 개체 수 (사용 %) : 3102305 / 3121463 (99.4%)
 활성 / 총 slab 수 (사용 %)   : 87745 / 87745 (100.0%)
 활성 / 총 캐시 수 (사용 %) : 130 / 178 (73.0%)
 활성 / 총 크기 (사용 %)     : 748809.62K / 753765.53K (99.3%)
 최소 / 평균 / 최대 개체 수: 0.01K / 0.24K / 9.00K

  활성 개체    사용개체크기  SLAB 개체/SLAB 캐시  크기 이름 
994617 994553  99%    0.10K  25503       39    102012K buffer_head            
463407 463082  99%    0.19K  22067       21     88268K dentry                 
342720 342595  99%    0.05K   4032       85     16128K shared_policy_node     
268299 268294  99%    1.16K   9937       27    317984K ext4_inode_cache       

sudo slabtop
 M-m~Y~\M-l~DM-1 / M-lM-4~] M-jM-0~\M-lM-2M-4 M-l~H~X (M-l~BM-,M-l~ZM-) %) : 3099702 / 3121184 (99.3%)
 M-m~Y~\M-l~DM-1 / M-lM-4~] slab M-l~H~X (M-l~BM-,M-l~ZM-) %)   : 87736 / 87736 (100.0%)
 M-m~Y~\M-l~DM-1 / M-lM-4~] M-lM-:~PM-l~K~\ M-l~H~X (M-l~BM-,M-l~ZM-) %) : 130 / 178 (73.0%)
 M-m~Y~\M-l~DM-1 / M-lM-4~] M-m~AM-,M-jM-8M-0 (M-l~BM-,M-l~ZM-) %)     : 748420.12K / 753805.55K (99.3%)
 M-lM-5~\M-l~F~L / M-m~O~IM-jM-7M-  / M-lM-5~\M-k~L~@ M-jM-0~\M-lM-2M-4 M-l~H~X: 0.01K / 0.24K / 9.00K

  M-m~Y~\M-l~DM-1 M-jM-0~\M-lM-2M-4    M-l~BM-,M-l~ZM-)M-jM-0~\M-lM-2M-4M-m~AM-,M-jM-8M-0  SLAB M-jM-0~\M-lM-2M-4/SLAB M-lM-:~PM-l~K~\  M-m~AM-,M-jM-8M-0 M-l~]M-4M-kM-&~D 
995397 995397  99%    0.10K  25523       39    102092K buffer_head
463407 462914  99%    0.19K  22067       21     88268K dentry
342720 342468  99%    0.05K   4032       85     16128K shared_policy_node

[링크 : https://linux.die.net/man/1/slabtop]

 

glusterFS 쪽에서 나오는 문서.

아무튼 커널에 의해서 캐싱된 내용을 어떻게 유지할 지 등에 대한 설정이 sysfs에 존재한다.

vm.vfs_cache_pressure
This option controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.

At the default value of vfs_cache_pressure=100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel will never reclaim dentries and inodes due to memory pressure and this can easily lead to out-of-memory conditionsIncreasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.

With GlusterFS, many users with a lot of storage and many small files easily end up using a lot of RAM on the server side due to 'inode/dentry' caching, leading to decreased performance when the kernel keeps crawling through data-structures on a 40GB RAM system. Changing this value higher than 100 has helped many users to achieve fair caching and more responsiveness from the kernel.

[링크 : https://docs.gluster.org/en/main/Administrator-Guide/Linux-Kernel-Tuning/#linux-kernel-tuning-for-glusterfs]

 

 

To free pagecache: (페이지케쉬 클리어)
# echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes: (트리와 아이노드 클리어)
# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes: (1번과 2번 모두 클리어)
# echo 3 > /proc/sys/vm/drop_caches

[링크 : https://help.iwinv.kr/manual/read.html?idx=464]

'Linux' 카테고리의 다른 글

systemd 지연된 시작  (0) 2024.02.29
btrfs fsck  (0) 2024.02.13
multitail / tail  (2) 2023.10.18
top 로그로 남기기  (0) 2023.10.17
tcpdump  (0) 2023.09.04
Posted by 구차니
Linux2023. 10. 18. 10:33

여러개의 로그에 동시 다발적으로 추가되는 내용을

하나의 파일로 합쳐서 보고 싶어서 고민때리고 있었는데

 

어... 라? tail에 파일 인자가 한개가 아니....다?!

NAME
       tail - output the last part of files

SYNOPSIS
       tail [OPTION]... [FILE]...

 

tail -f <file1> <file2>

[링크 : https://unix.stackexchange.com/questions/149017/how-to-tail-multiple-files-using-tail-0f-in-linux-aix]

 

표준(?) tail에서는 지원안해서 multi tail 이라는 별도 유틸리티를 쓰면 된다는데 

gnu tail은 지원한다고 하니 그냥 기억만 해두면 될 듯.

$ multitail
명령어 'multitail' 을(를) 찾을 수 없습니다. 그러나 다음을 통해 설치할 수 있습니다:
sudo apt install multitail

'Linux' 카테고리의 다른 글

btrfs fsck  (0) 2024.02.13
리눅스 파일 시스템 캐싱  (0) 2024.01.09
top 로그로 남기기  (0) 2023.10.17
tcpdump  (0) 2023.09.04
dhcpd IP 할당 규칙  (0) 2023.09.01
Posted by 구차니
Linux2023. 10. 17. 19:44

top이 ncurse로 만들어져서

원하는 내용만 파일로 로그 남기기가 쉽지 않다

 

아래처럼 하면 1초에 1번 top을 실행해서 top.log에 쭈욱 쌓아둘수 있다.

$ top -b -d 1 > top.log

 

batch의 b

       -b  :Batch-mode operation
            Starts top in Batch mode, which could be useful for sending output
            from  top  to other programs or to a file.  In this mode, top will
            not accept input and runs until the iterations  limit  you've  set
            with the `-n' command-line option or until killed.

[링크 : https://qkr3232.tistory.com/136]

'Linux' 카테고리의 다른 글

리눅스 파일 시스템 캐싱  (0) 2024.01.09
multitail / tail  (2) 2023.10.18
tcpdump  (0) 2023.09.04
dhcpd IP 할당 규칙  (0) 2023.09.01
시스템 audit 로그  (0) 2023.08.30
Posted by 구차니
Linux2023. 9. 4. 10:14

원인불명(?)으로 랜이 엄청나게 깜박여서 확인겸

어떤 소켓이나 어떤 포트로 요청이 들어오나 찾는법을 검색해보는데

tcpdump를 실행하면 된다고 해서 깔아봄

 

2995 packets captured
3250 packets received by filter
239 packets dropped by kernel

[링크 : https://stackoverflow.com/questions/21937162/how-to-find-out-the-number-of-transmitted-received-bytes-for-a-socket]

 

-n 줘서 resolve 안하면 drop이 줄어든다는데

도대체 머가 drop 되는진 어떻게 알 수 있을까?

[링크 : http://www.packetinside.com/2010/11/커널에서-drop-되는-패킷-수가-많다면.html]

'Linux' 카테고리의 다른 글

multitail / tail  (2) 2023.10.18
top 로그로 남기기  (0) 2023.10.17
dhcpd IP 할당 규칙  (0) 2023.09.01
시스템 audit 로그  (0) 2023.08.30
.bashrc 설정 history  (0) 2023.08.08
Posted by 구차니
Linux2023. 9. 1. 15:39

mac의 oui에 따라서 ip 대역을 다르게 할당하는 방법인.. 듯?

class "kvm" {
   match if binary-to-ascii(16,8,":",substring(hardware, 1, 2)) = "56:11";
}

class "local" {
   match if binary-to-ascii(16,8,":",substring(hardware, 1, 2)) = "52:54";
}

host meme {
 fixed-address 10.1.0.254;
}

host server247 {
  hardware ethernet 52:54:00:2f:ea:07;
  fixed-address 10.1.0.247;
}

subnet 10.1.0.224 netmask 255.255.255.224 {
  option routers 10.1.0.225;
  pool {
     allow members of "kvm";
     range 10.1.0.226 10.1.0.235;
  }
  pool {
     allow members of "local";
     range 10.1.0.236 10.1.0.240;
  }
  pool {
     # Don't use this pool. It is really just a range to reserve
     # for fixed addresses defined per host, above.
     allow known-clients;
     range 10.1.0.241 10.1.0.253;
  }
}

[링크 : https://serverfault.com/questions/79748/assign-dhcp-ips-for-specific-mac-prefixes]

 

예 14.3. DHCP를 사용하여 고정 IP 주소

host apex {
   option host-name "apex.example.com";
   hardware ethernet 00:A0:78:8E:9E:AA;
   fixed-address 192.168.1.4;
}

 

예 14.6. “그룹 선언” 에서 시연한 대로 그룹 선언은 선언 그룹에 전역 매개 변수를 적용하는 데 사용됩니다. 예를 들어 공유 네트워크, 서브넷 및 호스트를 그룹화할 수 있습니다.
예 14.6. 그룹 선언

group {
   option routers                  192.168.1.254;
   option subnet-mask              255.255.255.0;
   option domain-search              "example.com";
   option domain-name-servers       192.168.1.1;
   option time-offset              -18000;     # Eastern Standard Time
   host apex {
      option host-name "apex.example.com";
      hardware ethernet 00:A0:78:8E:9E:AA;
      fixed-address 192.168.1.4;
   }
   host raleigh {
      option host-name "raleigh.example.com";
      hardware ethernet 00:A1:DD:74:C3:F2;
      fixed-address 192.168.1.6;
   }
}

[링크 : https://access.redhat.com/documentation/ko-kr/red_hat_enterprise_linux/7/html/networking_guide/sec-dhcp-configuring-server]

'Linux' 카테고리의 다른 글

top 로그로 남기기  (0) 2023.10.17
tcpdump  (0) 2023.09.04
시스템 audit 로그  (0) 2023.08.30
.bashrc 설정 history  (0) 2023.08.08
lvmcache bcache  (0) 2023.07.27
Posted by 구차니
Linux2023. 8. 30. 10:59

audit이 자꾸 먼가 떠서 무슨 내용인지 보려는데 무슨 소리인지 ㅠㅠ

[   11.843605] audit: type=1006 audit(1693798687.793:2): pid=487 uid=0 old-auid1
[   11.856080] audit: type=1300 audit(1693798687.793:2): arch=c00000b7 syscall=)
[   11.882615] audit: type=1327 audit(1693798687.793:2): proctitle="(systemd)"

 

type을 기호로 보여주는건 없나?

 

/* The netlink messages for the audit system is divided into blocks:
 * 1000 - 1099 are for commanding the audit system
 * 1100 - 1199 user space trusted application messages
 * 1200 - 1299 messages internal to the audit daemon
 * 1300 - 1399 audit event messages
 * 1400 - 1499 SE Linux use
 * 1500 - 1599 kernel LSPP events
 * 1600 - 1699 kernel crypto events
 * 1700 - 1799 kernel anomaly records
 * 1800 - 1899 kernel integrity events
 * 1900 - 1999 future kernel use
 * 2000 is for otherwise unclassified kernel audit messages (legacy)
 * 2001 - 2099 unused (kernel)
 * 2100 - 2199 user space anomaly records
 * 2200 - 2299 user space actions taken in response to anomalies
 * 2300 - 2399 user space generated LSPP events
 * 2400 - 2499 user space crypto events
 * 2500 - 2999 future user space (maybe integrity labels and related events)
 *
 * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
 * exclusively user space. 1300-2099 is kernel --> user space 
 * communication.
 */

#define AUDIT_LOGIN                1006        /* Define the login id and information */

[링크 : https://sites.uclouvain.be/SystInfo/usr/include/linux/audit.h.html]

 

[링크 : https://access.redhat.com/documentation/ko-kr/red_hat_enterprise_linux/7/html/security_guide/sec-understanding_audit_log_files]

[링크 : https://access.redhat.com/documentation/ko-kr/red_hat_enterprise_linux/7/html/security_guide/chap-system_auditing]

'Linux' 카테고리의 다른 글

tcpdump  (0) 2023.09.04
dhcpd IP 할당 규칙  (0) 2023.09.01
.bashrc 설정 history  (0) 2023.08.08
lvmcache bcache  (0) 2023.07.27
sysfs ethernet link status  (0) 2023.05.17
Posted by 구차니
Linux/Ubuntu2023. 8. 28. 12:27

프리징이 조금씩 걸리는 느낌이라 불안해서 상태보는 걸 찾는 중인데..

nvme 라는 다른 유틸리티로 봐야 하는 듯.. smartctl 로는 안되나?

 

$ sudo apt-get install nvme-cli
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다... 완료
상태 정보를 읽는 중입니다... 완료        
다음 새 패키지를 설치할 것입니다:
  nvme-cli
0개 업그레이드, 1개 새로 설치, 0개 제거 및 3개 업그레이드 안 함.
474 k바이트 아카이브를 받아야 합니다.
이 작업 후 1,136 k바이트의 디스크 공간을 더 사용하게 됩니다.
받기:1 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 nvme-cli amd64 1.16-3ubuntu0.1 [474 kB]
내려받기 474 k바이트, 소요시간 2초 (229 k바이트/초)
Selecting previously unselected package nvme-cli.
(데이터베이스 읽는중 ...현재 255415개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../nvme-cli_1.16-3ubuntu0.1_amd64.deb ...
Unpacking nvme-cli (1.16-3ubuntu0.1) ...
nvme-cli (1.16-3ubuntu0.1) 설정하는 중입니다 ...
Created symlink /etc/systemd/system/default.target.wants/nvmefc-boot-connections.service → /lib/systemd/system/nvmefc-boot-connections.service.
Created symlink /etc/systemd/system/default.target.wants/nvmf-autoconnect.service → /lib/systemd/system/nvmf-autoconnect.service.
nvmf-connect.target is a disabled or a static unit, not starting it.
Processing triggers for man-db (2.10.2-1) ...


$ sudo nvme list
Node                  SN                   Model                                    Namespace Usage                      Format           FW Rev  
--------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1          S649NL0W000000F      Samsung SSD 980 1TB                      1         229.90  GB /   1.00  TB    512   B +  0 B   3B4QFXO7



$ sudo nvme smart-log /dev/nvme0
Smart Log for NVME device:nvme0 namespace-id:ffffffff
critical_warning : 0
temperature : 41 C (314 Kelvin)
available_spare : 100%
available_spare_threshold : 10%
percentage_used : 0%
endurance group critical warning summary: 0
data_units_read : 483,823
data_units_written : 1,853,867
host_read_commands : 5,443,068
host_write_commands : 31,140,950
controller_busy_time : 94
power_cycles : 48
power_on_hours : 72
unsafe_shutdowns : 9
media_errors : 0
num_err_log_entries : 0
Warning Temperature Time : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1           : 41 C (314 Kelvin)
Temperature Sensor 2           : 40 C (313 Kelvin)
Thermal Management T1 Trans Count : 0
Thermal Management T2 Trans Count : 0
Thermal Management T1 Total Time : 0
Thermal Management T2 Total Time : 0

[링크 : https://linuxhint.com/check-ssd-health-ubuntu/]

[링크 : https://itslinuxfoss.com/test-ssd-hdd-health-in-linux/]

'Linux > Ubuntu' 카테고리의 다른 글

우분투로 공유기 만들기  (2) 2024.02.23
ubuntu pro?  (2) 2024.01.31
edid-read  (0) 2023.08.17
ubutnu file(파일) 에서 삼바 목록 안나오고 부적절한 인수 에러  (0) 2023.07.24
htop graph style  (0) 2023.07.07
Posted by 구차니
Linux/Ubuntu2023. 8. 17. 16:29

리눅스에서 edid를 보는 또 다른 유틸리티. edid-decode 는 순수하게(?) 해석만 한다면

해당 패키지는 get-edid로 모니터로 부터 edid를 수집하고, parse-edid로 해석을 해준다

 

$ sudo get-edid > /tmp/edid
$ parse-edid < /tmp/edid

[링크 : https://unix.stackexchange.com/questions/114359/how-to-get-edid-for-a-single-monitor]

[링크 : https://packages.debian.org/sid/utils/read-edid]

'Linux > Ubuntu' 카테고리의 다른 글

ubuntu pro?  (2) 2024.01.31
debian nvme tool  (0) 2023.08.28
ubutnu file(파일) 에서 삼바 목록 안나오고 부적절한 인수 에러  (0) 2023.07.24
htop graph style  (0) 2023.07.07
mono-complete  (0) 2023.07.05
Posted by 구차니
Linux2023. 8. 8. 12:09

귀찮으니 정리해서 하나 저장해 놔야지 -_-

export HISTTIMEFORMAT="%y/%m/%d %T "
export PROMPT_COMMAND='history -a'
export PROMPT_COMMAND='echo -e "$(tty)\t$(history 1)" >> ~/bash-history-$(date "+%Y-%m-%d").log' 

'Linux' 카테고리의 다른 글

dhcpd IP 할당 규칙  (0) 2023.09.01
시스템 audit 로그  (0) 2023.08.30
lvmcache bcache  (0) 2023.07.27
sysfs ethernet link status  (0) 2023.05.17
리눅스 커맨드 라인에서 몇줄씩 건너뛰고 출력하기  (0) 2023.03.30
Posted by 구차니
Linux2023. 7. 27. 18:58

lvmcache는 logical volume에 대해서 ssd 캐시를 적용하고

bcache는 블럭 디바이스에 직접 ssd 캐시를 적용한다.

lvm을 좋아하진 않으니.. bcache를 나중에 써봐야지

 

[링크 : https://wiki.archlinux.org/title/bcache]

[링크 : https://wiki.archlinux.org/title/LVM#Cache]

 

'Linux' 카테고리의 다른 글

시스템 audit 로그  (0) 2023.08.30
.bashrc 설정 history  (0) 2023.08.08
sysfs ethernet link status  (0) 2023.05.17
리눅스 커맨드 라인에서 몇줄씩 건너뛰고 출력하기  (0) 2023.03.30
bash completion  (0) 2023.03.27
Posted by 구차니