'Linux' 카테고리의 다른 글
| Block SCSI generic (bsg) driver (0) | 2024.04.16 |
|---|---|
| lsusb -v 로 본 장치(HID MT, mouse) (0) | 2024.03.08 |
| btrfs fsck (0) | 2024.02.13 |
| 리눅스 파일 시스템 캐싱 (0) | 2024.01.09 |
| multitail / tail (2) | 2023.10.18 |
| Block SCSI generic (bsg) driver (0) | 2024.04.16 |
|---|---|
| lsusb -v 로 본 장치(HID MT, mouse) (0) | 2024.03.08 |
| btrfs fsck (0) | 2024.02.13 |
| 리눅스 파일 시스템 캐싱 (0) | 2024.01.09 |
| multitail / tail (2) | 2023.10.18 |
해볼까?
pfsense도 귀찮고..
그냥 필요한건 간단하게 NAT와 포트포워딩, DHCP 정도인데..
NAT
iptable masqurade
[링크 : https://ko.linux-console.net/?p=15300]
iptable - port forward
DHCP
dhcpd
방화벽
suricata
[링크 : https://www.hostinger.com/tutorials/how-to-install-suricata-on-ubuntu]
snort
| ssh 보안 취약점 패치 - 우분투 업데이트 (0) | 2024.07.08 |
|---|---|
| 정체 불명의 우분투 키보드 입력 지연 (TTS) (0) | 2024.06.28 |
| ubuntu pro? (2) | 2024.01.31 |
| debian nvme tool (0) | 2023.08.28 |
| edid-read (0) | 2023.08.17 |
btrfs는 fsck로 체크 못하고, btrfs 유틸리티의 check 명령을 통해서 확인해야 한다.
| # fsck /dev/mmcblk2p9 fsck from util-linux 2.37.4 If you wish to check the consistency of a BTRFS filesystem or repair a damaged filesystem, see btrfs(8) subcommand 'check'. # btrfs btrfs btrfs-convert btrfs-find-root btrfs-image btrfs-map-logical btrfs-select-super btrfsck btrfstune # btrfs check /dev/mmcblk2p9 Opening filesystem to check... Checking filesystem on /dev/mmcblk2p9 UUID: a6226cd4-fc4e-4e20-8861-5870feefb3da [1/7] checking root items [2/7] checking extents [3/7] checking free space tree [4/7] checking fs roots [5/7] checking only csums items (without verifying data) [6/7] checking root refs [7/7] checking quota groups skipped (not enabled on this FS) found 12189671424 bytes used, no error found total csum bytes: 11890008 total tree bytes: 14303232 total fs tree bytes: 180224 total extent tree bytes: 229376 btree space waste bytes: 1957387 file data blocks allocated: 12175368192 referenced 12171370496 |
man은 안되서 --help를 보는데 내용이 부실하긴 하다. restore와 rescue는 어떨 때 쓸 수 있으려나?
| # btrfs --help usage: btrfs [--help] [--version] [--format <format>] [-v|--verbose] [-q|--quiet] <group> [<group>...] <command> [<args>] btrfs balance start [options] <path> Balance chunks across the devices btrfs balance pause <path> Pause running balance btrfs balance cancel <path> Cancel running or paused balance btrfs balance resume <path> Resume interrupted balance btrfs balance status [-v] <path> Show status of running or paused balance btrfs check [options] <device> Check structural integrity of a filesystem (unmounted). btrfs device add [options] <device> [<device>...] <path> Add one or more devices to a mounted filesystem. btrfs device delete <device>|<devid> [<device>|<devid>...] <path> btrfs device remove <device>|<devid> [<device>|<devid>...] <path> Remove a device from a filesystem btrfs device scan [-d|--all-devices] <device> [<device>...] btrfs device scan -u|--forget [<device>...] Scan or forget (unregister) devices of btrfs filesystems btrfs device ready <device> Check and wait until a group of devices of a filesystem is ready for mount btrfs device stats [options] <path>|<device> Show device IO error statistics btrfs device usage [options] <path> [<path>..] Show detailed information about internal allocations in devices. btrfs filesystem df [options] <path> Show space usage information for a mount point btrfs filesystem du [options] <path> [<path>..] Summarize disk usage of each file. btrfs filesystem show [options] [<path>|<uuid>|<device>|label] Show the structure of a filesystem btrfs filesystem sync <path> Force a sync on a filesystem btrfs filesystem defragment [options] <file>|<dir> [<file>|<dir>...] Defragment a file or a directory btrfs filesystem resize [options] [devid:][+/-]<newsize>[kKmMgGtTpPeE]|[devid:]max <path> Resize a filesystem btrfs filesystem label [<device>|<mount_point>] [<newlabel>] Get or change the label of a filesystem btrfs filesystem usage [options] <path> [<path>..] Show detailed information about internal filesystem usage . btrfs inspect-internal inode-resolve [-v] <inode> <path> Get file system paths for the given inode btrfs inspect-internal logical-resolve [-Pvo] [-s bufsize] <logical> <path> Get file system paths for the given logical address btrfs inspect-internal subvolid-resolve <subvolid> <path> Get file system paths for the given subvolume ID. btrfs inspect-internal rootid <path> Get tree ID of the containing subvolume of path. btrfs inspect-internal min-dev-size [options] <path> Get the minimum size the device can be shrunk to btrfs inspect-internal dump-tree [options] <device> [<device> ..] Dump tree structures from a given device btrfs inspect-internal dump-super [options] device [device...] Dump superblock from a device in a textual form btrfs inspect-internal tree-stats [options] <device> Print various stats for trees btrfs property get [-t <type>] <object> [<name>] Get a property value of a btrfs object btrfs property set [-f] [-t <type>] <object> <name> <value> Set a property on a btrfs object btrfs property list [-t <type>] <object> Lists available properties with their descriptions for the given object btrfs qgroup assign [options] <src> <dst> <path> Assign SRC as the child qgroup of DST btrfs qgroup remove [options] <src> <dst> <path> Remove a child qgroup SRC from DST. btrfs qgroup create <qgroupid> <path> Create a subvolume quota group. btrfs qgroup destroy <qgroupid> <path> Destroy a quota group. btrfs qgroup show [options] <path> Show subvolume quota groups. btrfs qgroup limit [options] <size>|none [<qgroupid>] <path> Set the limits a subvolume quota group. btrfs quota enable <path> Enable subvolume quota support for a filesystem. btrfs quota disable <path> Disable subvolume quota support for a filesystem. btrfs quota rescan [-sw] <path> Trash all qgroup numbers and scan the metadata again with the current config. btrfs receive [options] <mount> btrfs receive --dump [options] Receive subvolumes from a stream btrfs replace start [-Bfr] <srcdev>|<devid> <targetdev> <mount_point> Replace device of a btrfs filesystem. btrfs replace status [-1] <mount_point> Print status and progress information of a running device replace operation btrfs replace cancel <mount_point> Cancel a running device replace operation. btrfs rescue chunk-recover [options] <device> Recover the chunk tree by scanning the devices one by one. btrfs rescue super-recover [options] <device> Recover bad superblocks from good copies btrfs rescue zero-log <device> Clear the tree log. Usable if it's corrupted and prevents mount. btrfs rescue fix-device-size <device> Re-align device and super block sizes. Usable if newer kernel refuse to mount it due to mismatch super size btrfs rescue create-control-device Create /dev/btrfs-control (see 'CONTROL DEVICE' in btrfs(5)) btrfs rescue clear-uuid-tree Delete uuid tree so that kernel can rebuild it at mount time btrfs restore [options] <device> <path> btrfs restore [options] -l <device> Try to restore files from a damaged filesystem (unmounted) btrfs scrub start [-BdqrRf] [-c ioprio_class -n ioprio_classdata] <path>|<device> Start a new scrub. If a scrub is already running, the new one fails. btrfs scrub cancel <path>|<device> Cancel a running scrub btrfs scrub resume [-BdqrR] [-c ioprio_class -n ioprio_classdata] <path>|<device> Resume previously canceled or interrupted scrub btrfs scrub status [-dR] <path>|<device> Show status of running or finished scrub btrfs send [-ve] [-p <parent>] [-c <clone-src>] [-f <outfile>] <subvol> [<subvol>...] Send the subvolume(s) to stdout. btrfs subvolume create [-i <qgroupid>] [<dest>/]<name> Create a subvolume btrfs subvolume delete [options] <subvolume> [<subvolume>...] btrfs subvolume delete [options] -i|--subvolid <subvolid> <path> Delete subvolume(s) btrfs subvolume list [options] <path> List subvolumes and snapshots in the filesystem. btrfs subvolume snapshot [-r] [-i <qgroupid>] <subvolume> { <subdir>/<name> | <subdir> } btrfs subvolume get-default <path> Get the default subvolume of a filesystem btrfs subvolume set-default <subvolume> btrfs subvolume set-default <subvolid> <path> Set the default subvolume of the filesystem mounted as default. btrfs subvolume find-new <path> <lastgen> List the recently modified files in a filesystem btrfs subvolume show [options] <path> Show more information about the subvolume (UUIDs, generations, times, snapshots) btrfs subvolume sync <path> [<subvol-id>...] Wait until given subvolume(s) are completely removed from the filesystem. btrfs help [--full] [--box] Display help information btrfs version Display btrfs-progs version Use --help as an argument for information on a specific group or command. Options for --format are: text, json |
| lsusb -v 로 본 장치(HID MT, mouse) (0) | 2024.03.08 |
|---|---|
| systemd 지연된 시작 (0) | 2024.02.29 |
| 리눅스 파일 시스템 캐싱 (0) | 2024.01.09 |
| multitail / tail (2) | 2023.10.18 |
| top 로그로 남기기 (0) | 2023.10.17 |
오늘 출근했더니 갑자기 업그레이드 뜨면서 ubuntu pro를 활성화 하겠냐는데
라이센스도 모르고 하니 일단은 다음에 알림으로 설정!

+
설정 누르니 소프트웨어 & 업데이트에서 Ubuntu Pro가 추가되었는데..

Enable Ubuntu Pro 누르니 아래와 같이 먼가 나온다. 가입은 필수인 것 같은데..

홈페이지 뒤져보니 개인은 무료, 기업에서도 30일 무료 라는데

[링크 : https://ubuntu.com/pro]
데스크 탑이라도 해도 유료로는 년 금액인 것 같긴한데
머.. 보안업데이트랑 신경써서 해준다니 어떤 의미로는 나빠보이진 않는 듯.
근데 우분투도 장시간 서버로 써보면 업데이트 많아서 불편(?) 한데, 서버를 더 자주 리부팅 하게 되는건 아니겠지?

| 정체 불명의 우분투 키보드 입력 지연 (TTS) (0) | 2024.06.28 |
|---|---|
| 우분투로 공유기 만들기 (2) | 2024.02.23 |
| debian nvme tool (0) | 2023.08.28 |
| edid-read (0) | 2023.08.17 |
| ubutnu file(파일) 에서 삼바 목록 안나오고 부적절한 인수 에러 (0) | 2023.07.24 |
요즘(?) 리눅스는 언젠가 부터 그냥 냅두면 메모리를 야곰야곰 먹으면서 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 conditions. Increasing 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. |
| 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 |
| 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 |
여러개의 로그에 동시 다발적으로 추가되는 내용을
하나의 파일로 합쳐서 보고 싶어서 고민때리고 있었는데
어... 라? tail에 파일 인자가 한개가 아니....다?!
| NAME tail - output the last part of files SYNOPSIS tail [OPTION]... [FILE]... |
| tail -f <file1> <file2> |
표준(?) tail에서는 지원안해서 multi tail 이라는 별도 유틸리티를 쓰면 된다는데
gnu tail은 지원한다고 하니 그냥 기억만 해두면 될 듯.
| $ multitail 명령어 'multitail' 을(를) 찾을 수 없습니다. 그러나 다음을 통해 설치할 수 있습니다: sudo apt install multitail |
| 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 |
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. |
| 리눅스 파일 시스템 캐싱 (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 |
원인불명(?)으로 랜이 엄청나게 깜박여서 확인겸
어떤 소켓이나 어떤 포트로 요청이 들어오나 찾는법을 검색해보는데
tcpdump를 실행하면 된다고 해서 깔아봄
| 2995 packets captured 3250 packets received by filter 239 packets dropped by kernel |
-n 줘서 resolve 안하면 drop이 줄어든다는데
도대체 머가 drop 되는진 어떻게 알 수 있을까?
[링크 : http://www.packetinside.com/2010/11/커널에서-drop-되는-패킷-수가-많다면.html]
| 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 |
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; } } |
| 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 |
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]
| 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 |