<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>yoni_d.log</title>
        <link>https://velog.io/</link>
        <description>study log</description>
        <lastBuildDate>Wed, 19 Apr 2023 02:55:32 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <copyright>Copyright (C) 2019. yoni_d.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/yoni_d" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[리눅스 교육 정리]]></title>
            <link>https://velog.io/@yoni_d/%EB%A6%AC%EB%88%85%EC%8A%A4-%EA%B5%90%EC%9C%A1-%EC%A0%95%EB%A6%AC</link>
            <guid>https://velog.io/@yoni_d/%EB%A6%AC%EB%88%85%EC%8A%A4-%EA%B5%90%EC%9C%A1-%EC%A0%95%EB%A6%AC</guid>
            <pubDate>Wed, 19 Apr 2023 02:55:32 GMT</pubDate>
            <description><![CDATA[<h3 id="리눅스-교육-무엇을-배웠나">리눅스 교육 무엇을 배웠나</h3>
<p>ls -a, ls -l 등과 같은 기본적인 리눅스 명령어부터 &gt;,&gt;&gt;,&lt; 등과 같은 파일 입출력 리다이렉션의 동작 방식까지 기초적인 내용으로 교육을 시작하였습니다.</p>
<p>더하여, vi 편집기 사용 방법에 대해 배웠는데 vi에 익숙해졌다고 생각했는데도 몰랐던 단축기에 대해 많이 알 수 있었으며, sed, cut, awk, grep 등 이미 알던 리눅스 명령어에 대해서도 더 자세히 확인해 볼 수 있었습니다.</p>
<p>이외에, user와 group을 추가해보고 ls -l 명령어를 수행하면 확인할 수 있는 파일 및 디렉토리 퍼미션 정보에 대해 자세히 알아보았으며 소유권 수정을 해보는 등의 실습을 진행하였습니다. 더하여, 패스워드 설정까지 진행해보았습니다.
<a href="https://velog.io/@yoni_d/group-user">참고-user,group</a></p>
<p>시스템 프로세스 관리에 필요한 현재 process 및 system 관련 정보를 확인해보고, 우선순위 값에 영향을 주는 nice값을 조절해보았습니다. 그리고 background, foreground process로 실행시키는 법과 kill할 수 있는 방법 등에 대해 배웠습니다. 
<a href="https://velog.io/@yoni_d/process">참고-process,memory</a></p>
<p>이후에는 Virtual Machine을 통해 디스크 파티션, mount, openssh 설정을 위한 ssh-Keygen 설정을 진행했습니다. 이 때 key에 대해 암호가 설정되어 있을 경우, 암호 입력을 생략하고 자동 등록할 수 있도록 하는 방법도 알게 되었습니다.
<a href="https://velog.io/@yoni_d/Virtual-Machine-Linux-install">참고-vm설치,ssh관리</a></p>
<p>그 후, journal log 확인 및 영구적으로 저장하는 법, logrotate에 대한 내용을 학습하였습니다.
<a href="https://velog.io/@yoni_d/log-%EA%B4%80%EB%A6%AC">참고-log</a></p>
<p>이후에 Network와 관련하여 lan카드 정보를 확인 및 network configuration을 확인해보았습니다. Network 설정을 파일로도 할 수 있지만 nmcli 및 nmtui를 통해 할 수 있음을 배우고 직접 실습해보았습니다. 
<a href="https://velog.io/@yoni_d/Network">참고1-network</a>
<a href="https://velog.io/@yoni_d/network-%EC%84%A4%EC%A0%95">참고2-network</a></p>
<p>다음으로 저희가 사용하는 crontab 사용 법에 대해 배워보았으며 Linux package를 관리하는 RPM과 yum의 차이를 알고 직접 사용해보며 history, undo 옵션에 대해서도 익힐 수 있었습니다. 
<a href="https://velog.io/@yoni_d/at-batch-crontab">참고1-crontab</a>
<a href="https://velog.io/@yoni_d/Install-and-Update-software-package">참고2-rpm,yum</a></p>
<p>이후에는 계속해서 디스크 파티션 및 파일 시스템 구성에 대해 배웠습니다. 디스크를 파티셔닝하고, swap을 활성화하고 LVM의 활용방법을 익혔습니다. 
<a href="https://velog.io/@yoni_d/partitioning-disk">참고1-diskpartition</a>
<a href="https://velog.io/@yoni_d/swap">참고2-LVM</a></p>
<p>더하여 NFS를 통한 파일 공유 및 AutoFS를 통한 자동 mount 방법에 대해서도 알아보았습니다. 
<a href="https://velog.io/@yoni_d/NFS">참고-nfs</a>
<a href="https://velog.io/@yoni_d/AutoFS">참고2-autofs</a></p>
<p>그 후, 리눅스 부팅 과정에 대해 학습하고, 부트로더 설정 파일을 확인해보며 부트로더의 장애가 발생했을 때 어떻게 해야하는지에 대해 배웠습니다. 그리고 systemd의 Runlevel-Target에 대해 학습하고 실습을 진행하였습니다.
<a href="https://velog.io/@yoni_d/Linux-Booting">참고-리눅스부팅</a></p>
<p>마지막으로 방화벽 설정에 필요한 Netfilter에 대해 배우고, iptable 활용방법에 대해 익혔습니다. 그리고 SELinux의 개념과 보안 접근 모델에 대해 배우며 전체 교육을 마무리 하였습니다.
<a href="https://velog.io/@yoni_d/%EB%B0%A9%ED%99%94%EB%B2%BD">참고1-방화벽</a>
<a href="https://velog.io/@yoni_d/SELinux">참고2-selinux</a></p>
<p>Day1, Day2 까지만 해도 이미 아는 리눅스 명령어에 대해 배워서 기초적인 내용만 배울 줄 알았는데, 후반부로 갈수록 전혀 처음 접하는 내용이 많았고, 유익한 시간이었습니다!</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[SELinux ]]></title>
            <link>https://velog.io/@yoni_d/SELinux</link>
            <guid>https://velog.io/@yoni_d/SELinux</guid>
            <pubDate>Tue, 18 Apr 2023 07:24:47 GMT</pubDate>
            <description><![CDATA[<h2 id="selinux-security-framwork">SELinux Security Framwork</h2>
<ul>
<li>Allow administrator to specify security policy </li>
</ul>
<h3 id="동작과정">동작과정</h3>
<ul>
<li>유저/프로세스<ul>
<li>1) 이들은 SELinux를 통해 <strong>퍼미션</strong> 확인</li>
<li>2) 추가적으로 이들은 SELinux를 통해 <strong>security context</strong>(like label) 확인</li>
<li><strong>퍼미션</strong>, <strong>security context</strong> 두 개가 정상적이라면 파일/디렉토리에 접근하게됨.</li>
</ul>
</li>
<li>SELinux &lt;-&gt; policy</li>
</ul>
<h4 id="security-context">security context</h4>
<ul>
<li>identity:role:type:security_level<ul>
<li>security context type 변경 : <strong>restorecon</strong></li>
<li>chcon</li>
</ul>
</li>
</ul>
<h3 id="보안-접근-모델">보안 접근 모델</h3>
<ul>
<li><p>DAC : Discretionary Access Control</p>
<ul>
<li>접근 주체 신분기반 접근권한 부여 </li>
<li>소유자가 임의로 접근 판단</li>
</ul>
</li>
<li><p>MAC: Mandatory Access Control</p>
<ul>
<li>주체, 객체 등급기반 접근권한 부여</li>
</ul>
</li>
<li><p>RAC : Role-Based Access Control</p>
<ul>
<li>주체, 객체 역할 기반 권한 부여 기반 접근 판단</li>
</ul>
</li>
</ul>
<p>cp initial-setup-ks.cfg /var/www/html/1.html
mv initial-setup-ks.cfg /var/www/html/2.html
ll /var/www/html</p>
<p>systemctl start httpd
ifconfig eth0 : 192.168.122.253</p>
<p><a href="http://192.168.122.253/1.html">http://192.168.122.253/1.html</a>
<a href="http://192.168.122.253/2.html">http://192.168.122.253/2.html</a></p>
<p>ps -eZ | grep httpd</p>
<p>ll -Z /var/www/html</p>
<p>restorecon -vFR /var/www/html</p>
<h4 id="selinux-modes">SElinux Modes</h4>
<ol>
<li>getenforce</li>
<li>setenforce<pre><code class="language-shell">[root@station14 images]# getenforce
Enforcing
[root@station14 images]# setenforce 1
[root@station14 images]# getenforce
Enforcing
[root@station14 images]# setenforce 0
[root@station14 images]# getenforce
Permissive
</code></pre>
</li>
</ol>
<pre><code>- /etc/sysconfig/selinux를 수정해야됨.
  -  disable &lt;-&gt; permissive, enforcing 은 재부팅 필요

![](https://velog.velcdn.com/images/yoni_d/post/fd5f41f8-9957-4e42-9428-cff696ee2edd/image.png)


#### Booleans
- sestatus -b
- getsebool -a
```shell
[root@station14 images]# sestatus -b
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Policy booleans:
abrt_anon_write                             off
abrt_handle_event                           off
abrt_upload_watch_anon_write                on
antivirus_can_scan_system                   off
antivirus_use_jit                           off
auditadm_exec_content                       on
authlogin_nsswitch_use_ldap                 off
authlogin_radius                            off
authlogin_yubikey                           off
awstats_purge_apache_log_files              off
boinc_execmem                               on
cdrecord_read_content                       off
...

&gt; ftp 관련 정책들을 보여줘
[root@station14 images]# getsebool -a | grep ftp
ftpd_anon_write --&gt; off
ftpd_connect_all_unreserved --&gt; off
ftpd_connect_db --&gt; off
ftpd_full_access --&gt; off
ftpd_use_cifs --&gt; off
ftpd_use_fusefs --&gt; off
ftpd_use_nfs --&gt; off
ftpd_use_passive_mode --&gt; off
httpd_can_connect_ftp --&gt; off
httpd_enable_ftp_server --&gt; off
tftp_anon_write --&gt; off

</code></pre><pre><code class="language-shell">[root@station14 images]# iptables -F
[root@station14 images]# iptables -P INPUT ACCEPT
[root@station14 images]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destinatimeson         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination    

su - 일반유저 -&gt; touch bye.txt -&gt; ftp localhost -&gt; 암호 -&gt; cd /tmp -&gt; put bye.txt

&gt;오류 해결해보기
cat /var/log/messages


[root@localhost ~]# setsebool -P ftpd_full_access  1

[root@localhost ~]# getsebool -a | grep ftp
ftpd_anon_write --&gt; off
ftpd_connect_all_unreserved --&gt; off
ftpd_connect_db --&gt; off
ftpd_full_access --&gt; on            --this check! (접근 허용하겠다.)
ftpd_use_cifs --&gt; off
ftpd_use_fusefs --&gt; off
ftpd_use_nfs --&gt; off
ftpd_use_passive_mode --&gt; off
httpd_can_connect_ftp --&gt; off
httpd_enable_ftp_server --&gt; off
tftp_anon_write --&gt; off
tftp_home_dir --&gt; off


</code></pre>
<h4 id="permissive-domains">Permissive Domains</h4>
]]></description>
        </item>
        <item>
            <title><![CDATA[방화벽]]></title>
            <link>https://velog.io/@yoni_d/%EB%B0%A9%ED%99%94%EB%B2%BD</link>
            <guid>https://velog.io/@yoni_d/%EB%B0%A9%ED%99%94%EB%B2%BD</guid>
            <pubDate>Tue, 18 Apr 2023 06:55:10 GMT</pubDate>
            <description><![CDATA[<h2 id="firewall">Firewall</h2>
<ul>
<li><p>Kernel은 Module 구조로 되어있음 (떼었다가 붙였다가 가능)</p>
<ul>
<li>H/W driver </li>
<li>file system</li>
<li>Security -&gt; firewall, SELinux, PAM </li>
<li>Network</li>
</ul>
</li>
<li><p>Netfilter : 커널 안에 내장되어 있음</p>
</li>
<li><p>FirewallD 서비스 </p>
<ul>
<li>FirewallD를 정지시키고 Netfilter를 활성화 </li>
<li>iptables를 활성화 시키려면 mask를 사용해야 함.</li>
</ul>
</li>
</ul>
<pre><code class="language-shell">@@@ Virtual Machine
systemctl stop firewalld
systemctl disable firewalld
systemctl mask firewalld 
systemctl start firewalld

yum search iptables
yum -y install iptables-services

systemctl enable iptables
systemctl start iptables
systemctl status iptables

</code></pre>
<h3 id="netfilter">Netfilter</h3>
<p>방화벽 : 외부의 불법적 접근을 차단하기 위함</p>
<ul>
<li><p><strong>구성 Table</strong> (3개로 구성)</p>
<ul>
<li><p>filter table (기본 table)</p>
<ul>
<li>필터링을 짓는 서비스</li>
</ul>
</li>
<li><p>nat table</p>
<ul>
<li>사설 &lt;-&gt; 공인 ip 변환</li>
</ul>
</li>
<li><p>mangle table</p>
<ul>
<li>패킷의 속성에 변화를 주겠다.</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Chain</strong> (각 table 안에는 chain이 존재)</p>
<ul>
<li>chain 안에 rule 들이 들어가있음. </li>
<li>chian 의 목적 : rule들을 묶어주기 위한 구조(메커니즘)</li>
<li>chain 종류<ul>
<li>input : 외부에서 내부 시스템으로 들어오는 데이터를 허용할 것인가, 차단할 것인가</li>
<li>forward</li>
<li>output : 시스템에서 외부로 나가는 데이터를 허용할 것인가, 차단할 것인가</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4 id="정책policy">정책(policy)</h4>
<ul>
<li>정책을 무엇으로 갖고갈 것이냐에 따라 rule 설정이 달라진다.</li>
<li>close 정책 : 일반적으로 기본 정책으로 채택<ul>
<li>일반적으로 다 닫고, 허용할 것만 열어둔다.</li>
</ul>
</li>
<li>open 정책<ul>
<li>기본적으로 다 열어두고, 차단을 지정함.</li>
<li>까먹고 차단해야할 것을 차단하지 못한다면 큰 문제 발생</li>
</ul>
</li>
</ul>
<h4 id="기본정책--j">기본정책 (-j)</h4>
<ul>
<li>DROP : 패킷 차단 후 아무런 응답을 보내지 않음.</li>
<li>REJECT : 패킷 차단 후 차단했다는 응답을 보냄. (DROP이 더 좋음)</li>
<li>ACCEPT</li>
<li>LOG: 패킷이 들어오는 순간 로그로 남기겠다.</li>
</ul>
<h3 id="using-the-iptables-command">Using the iptables Command</h3>
<pre><code class="language-shell">
&gt; input chain에 있는 rule을 지우겠다.
iptable -D INPUT 4 (필터테이블이 기본이므로 -t옵션 안적어도됨.)

&gt; Listing rules 
iptables -nL ==line-numbers
iptables -L -t nat 
iptables -L -t managle (-t 테이블이름) -- 테이블 지정안하면 필터테이블(기본테이블)
iptables- nL (숫자로 나옴, n옵션없으면 이름으로만 나옴)


&gt; rule 추가 명령어
&gt; 특정 위치에 rule 꼽아 넣기
iptables -I INPUT 42

&gt; 맨 끝에 rule append
iptables -A INPUT

&gt; drop 정책으로 갖고 가겠다.
iptables -P INPUT DROP

&gt; policy DROP 으로 변경됨
iptables -nL ==line-numbers
</code></pre>
<h4 id="match-specs">MATCH SPECS</h4>
<ul>
<li>IP 주소 (-s: source, -d:dest)<ul>
<li>-s 생략시, 모든 컴퓨터의 모든 네트워크</li>
<li>본인 컴퓨터가 네트워크 방화벽일 때 d 써줌</li>
</ul>
</li>
<li>Interface (-i,-o)<ul>
<li>-i : 특정 LAN 카드로 들어오는거 차단 여부</li>
<li>-o : 특정 LAN 카드로 나가는거 차단여부</li>
<li>일반적인 host 방화벽에서는 해당 옵션 잘 안씀</li>
</ul>
</li>
<li>protocol <ul>
<li>목적지 dport가 중요</li>
<li>특정 port로 들어오는 것만 허용하겠다.</li>
</ul>
</li>
<li>Port Type : TCP UDP ICMP (-p)<ul>
<li>ping : ICMP 프로토콜 사용<ul>
<li>ping B : A =&gt; icmp_echo_request  (output chain을 통해 나감)</li>
<li>B =&gt; icmp_echo_reply (input chain)</li>
<li>output chain은 잘 동작하나, input chain은 동작 안함. 따라서 rule 설정해보자</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><img src="https://velog.velcdn.com/images/yoni_d/post/931008de-bfd6-49af-8754-cc0444cef017/image.png" alt=""></p>
<pre><code class="language-shell">&gt; 예시
해당 컴퓨터에 DNS서버가 있다면, DNS 서버에 들어오도록 허용 (DNS 는 udp, 목적지 port :53)
iptables -A INPUT -p udp --dport 53 -j ACCEPT</code></pre>
<p><img src="https://velog.velcdn.com/images/yoni_d/post/1bf119e2-e269-40ed-b9df-97f11e1b6a75/image.png" alt=""></p>
<h3 id="connection-tracking-상태-추적기">Connection Tracking (상태 추적기)</h3>
<ul>
<li><p>output chain을 통해 잘 나가는데, input chain을 통해 들어오는 것이 룰 차단 되어있어서 그럼</p>
<ul>
<li>ssh, yum 등,, 응답이 안들어옴</li>
</ul>
</li>
<li><p>따라서 , 해당 기능을 사용하여 나갔다가 들어오는 것을 상태를 보고 판단하고자 한다.</p>
</li>
<li><p>종류</p>
<ul>
<li>NEW</li>
<li><strong>ESTABLISHED</strong> -&gt; 허용하겠다. (밖으로 나갔다가 들어오는)</li>
<li><strong>RELATED</strong> -&gt; 허용하겠다. (FTP 서버의 경우, 인증과 실제 데이터에 대한 포트를 2개 사용함)</li>
<li>INVALID </li>
</ul>
</li>
<li><p>즉, 데이터가 나갔다가 들어오는 것들에 대해서는 허용하겠다.
-&gt; 맨 윗줄에 기입하여 허용 여부 판단 (<strong>=&gt; input chain에 -I옵션을 통해 1번 줄에 룰 설정</strong>)</p>
<ul>
<li>iptables -I INPUT 1 -m state --state ESTABLISHED,RELATED</li>
<li>그후, yum -y install httpd  실행 시 잘 동작함.<ul>
<li>나갔다가 들어오는 상태 (ESTABLISHED, RELATED)에 대해 모두 허용하는 rule 설정을 했기 때문에
<img src="https://velog.velcdn.com/images/yoni_d/post/a7804d29-05ca-4d6b-b601-baeadc7bc459/image.png" alt=""></li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="permission">Permission</h3>
<ul>
<li>Permission 3가지 : 1)소유자 2)그룹 3)나머지 시스템상 유저
But, 특정한 Permission을 따로 설정해서 부여하고 싶다. (특정한 그룹을 선택해서 Permission을 따로 주고 싶다.)</li>
<li><blockquote>
<p>즉 Permission의 확장판 같은 느낌 : <strong>ACL</strong></p>
</blockquote>
</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[Linux Booting]]></title>
            <link>https://velog.io/@yoni_d/Linux-Booting</link>
            <guid>https://velog.io/@yoni_d/Linux-Booting</guid>
            <pubDate>Tue, 18 Apr 2023 02:33:32 GMT</pubDate>
            <description><![CDATA[<h3 id="system-boot-method">System Boot Method</h3>
<h4 id="v-init">V init</h4>
<ul>
<li>커널에 의해 init 프로그램이 제일 먼저 실행 (pid=1)<ul>
<li>init process: 순차처리</li>
</ul>
</li>
<li>부팅 속도가 빨라지지 않음 -&gt; Upstart로 변경</li>
</ul>
<h4 id="upstart">Upstart</h4>
<ul>
<li>마찬가지로 init process 사용</li>
<li>사실 이전과 큰 차이가 없다.</li>
</ul>
<h4 id="systemd">Systemd</h4>
<ul>
<li><p>CentOS 7,8버전에 해당</p>
</li>
<li><p>init process가 아닌, systemd process를 통해서 다른 process를 관리 처리하겠다고 변경</p>
</li>
<li><p>순차처리가 아닌, 병렬처리(Parallel) -&gt;  부팅 속도 빨라짐</p>
<ul>
<li>즉, systemd가 여러 process를 병렬로 처리하여 속도의 향상 </li>
<li>만약 의존성 관계가 있으면 tree형태로 처리<pre><code class="language-shell">[root@station14 ~]# pstree -p
systemd(1)─┬─NetworkManager(871)─┬─dhclient(938)
       │                     ├─{NetworkManager}(913)
       │                     └─{NetworkManager}(915)
       ├─abrt-watch-log(821)
       ├─abrt-watch-log(857)
       ├─abrtd(819)
       ├─accounts-daemon(830)─┬─{accounts-daemon}(841)
       │                      └─{accounts-daemon}(844)
       ├─acpid(868)
       ├─at-spi-bus-laun(1895)─┬─dbus-daemon(1900)───{dbus-daemon}(1901)
       │                       ├─{at-spi-bus-laun}(1896)
       │                       ├─{at-spi-bus-laun}(1897)
       │                       └─{at-spi-bus-laun}(1899)
       ├─at-spi2-registr(1903)─┬─{at-spi2-registr}(1904)
       │                       └─{at-spi2-registr}(1905)
       ├─atd(1146)
       ├─auditd(775)─┬─audispd(788)─┬─sedispatch(795)
       │             │              └─{audispd}(796)
       │             └─{auditd}(787)
       ├─automount(7447)─┬─{automount}(7448)
       │                 ├─{automount}(7449)
       │                 ├─{automount}(7452)
       │                 ├─{automount}(7455)
       │                 ├─{automount}(7456)
       │                 └─{automount}(7457)
       ├─avahi-daemon(839)───avahi-daemon(845)
       ├─caribou(1993)─┬─{caribou}(1996)
       │               └─{caribou}(1999)
       ├─chronyd(846)
       ├─colord(1485)─┬─{colord}(1488)
       │              └─{colord}(1490)
       ├─crond(1144)
       ├─cupsd(1121)
       ├─dbus-daemon(1724)───{dbus-daemon}(1725)
       ├─dbus-daemon(810)───{dbus-daemon}(813)
       ├─dbus-launch(1723)
       ├─dconf-service(2384)─┬─{dconf-service}(2385)
       │                     └─{dconf-service}(2386)
       ├─dnsmasq(1353)───dnsmasq(1354)
       ├─evolution-calen(2155)─┬─{evolution-calen}(2160)
       │                       ├─{evolution-calen}(2162)
       │                       ├─{evolution-calen}(2163)
       │                       ├─{evolution-calen}(2164)
       │                       └─{evolution-calen}(2167)
       ├─evolution-sourc(1964)─┬─{evolution-sourc}(1965)
       │                       └─{evolution-sourc}(1966)
       ├─gconfd-2(2318)
       ├─gdm(1143)─┬─Xorg(1398)─┬─{Xorg}(1399)
       │           │            ├─{Xorg}(1400)
       │           │            └─{Xorg}(1401)
       │           ├─gdm-session-wor(1696)─┬─gnome-session(1716)─┬─abrt-applet(2043)─┬─{abrt-applet+
       │           │                       │                     │                   └─{abrt-applet+
       │           │                       │                     ├─gnome-settings-(1912)─┬─{gnome-s+
       │           │                       │                     │                       ├─{gnome-s+
       │           │                       │                     │                       ├─{gnome-s+
       │           │                       │                     │                       └─{gnome-s+
       │           │                       │                     ├─gnome-shell(1928)─┬─firefox(2261+
       │           │                       │                     │                   ├─ibus-daemon(+
       │           │                       │                     │                   ├─{gnome-shell+
       │           │                       │                     │                   ├─{gnome-shell+
       │           │                       │                     │                   ├─{gnome-shell+
       │           │                       │                     │                   ├─{gnome-shell+
       │           │                       │                     │                   └─{gnome-shell+
       │           │                       │                     ├─gnome-software(2052)─┬─{gnome-so+
       │           │                       │                     │                      ├─{gnome-so+
       │           │                       │                     │                      └─{gnome-so+
       │           │                       │                     ├─nautilus(2026)─┬─{nautilus}(2028+
       │           │                       │                     │                ├─{nautilus}(2029+
       │           │                       │                     │                └─{nautilus}(2068+
       │           │                       │                     ├─seapplet(2032)
       │           │                       │                     ├─ssh-agent(1883)
       │           │                       │                     ├─tracker-extract(2046)─┬─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       └─{tracker+
       │           │                       │                     ├─tracker-miner-a(2047)─┬─{tracker+
       │           │                       │                     │                       └─{tracker+
       │           │                       │                     ├─tracker-miner-f(2050)─┬─{tracker+
       │           │                       │                     │                       ├─{tracker+
       │           │                       │                     │                       └─{tracker+
       │           │                       │                     ├─tracker-miner-u(2051)─┬─{tracker+
       │           │                       │                     │                       └─{tracker+
       │           │                       │                     ├─{gnome-session}(1906)
       │           │                       │                     ├─{gnome-session}(1907)
       │           │                       │                     └─{gnome-session}(1908)
       │           │                       ├─{gdm-session-wor}(1697)
       │           │                       └─{gdm-session-wor}(1698)
       │           ├─{gdm}(1179)
       │           ├─{gdm}(1180)
       │           └─{gdm}(1397)
       ├─gnome-keyring-d(1706)─┬─{gnome-keyring-d}(1707)
       │                       ├─{gnome-keyring-d}(1920)
       │                       ├─{gnome-keyring-d}(1921)
       │                       └─{gnome-keyring-d}(1922)
       ├─gnome-shell-cal(1957)─┬─{gnome-shell-cal}(1960)
       │                       ├─{gnome-shell-cal}(1962)
       │                       ├─{gnome-shell-cal}(1977)
       │                       ├─{gnome-shell-cal}(1978)
       │                       └─{gnome-shell-cal}(2153)
       ├─gnome-terminal-(16364)─┬─bash(16372)───pstree(7971)
       │                        ├─gnome-pty-helpe(16371)
       │                        ├─{gnome-terminal-}(16365)
       │                        ├─{gnome-terminal-}(16366)
       │                        └─{gnome-terminal-}(16367)
       ├─goa-daemon(1969)─┬─{goa-daemon}(1970)
       │                  ├─{goa-daemon}(1972)
       │                  └─{goa-daemon}(1973)
       ├─goa-identity-se(1976)─┬─{goa-identity-se}(1981)
       │                       ├─{goa-identity-se}(1982)
       │                       └─{goa-identity-se}(1983)
       ├─gpm(823)
       ├─gsd-printer(1932)─┬─{gsd-printer}(1933)
       │                   └─{gsd-printer}(1934)
       ├─gssproxy(869)─┬─{gssproxy}(885)
       │               ├─{gssproxy}(886)
       │               ├─{gssproxy}(887)
       │               ├─{gssproxy}(888)
       │               └─{gssproxy}(889)
       ├─gvfs-afc-volume(2011)─┬─{gvfs-afc-volume}(2012)
       │                       ├─{gvfs-afc-volume}(2013)
       │                       └─{gvfs-afc-volume}(2015)
       ├─gvfs-goa-volume(2017)─┬─{gvfs-goa-volume}(2018)
       │                       └─{gvfs-goa-volume}(2019)
       ├─gvfs-gphoto2-vo(2022)─┬─{gvfs-gphoto2-vo}(2023)
       │                       └─{gvfs-gphoto2-vo}(2025)
       ├─gvfs-mtp-volume(2006)─┬─{gvfs-mtp-volume}(2007)
       │                       └─{gvfs-mtp-volume}(2009)
       ├─gvfs-udisks2-vo(2001)─┬─{gvfs-udisks2-vo}(2002)
       │                       └─{gvfs-udisks2-vo}(2003)
       ├─gvfsd(1792)─┬─{gvfsd}(1793)
       │             └─{gvfsd}(1794)
       ├─gvfsd-fuse(1797)─┬─{gvfsd-fuse}(1800)
       │                  ├─{gvfsd-fuse}(1801)
       │                  ├─{gvfsd-fuse}(1804)
       │                  ├─{gvfsd-fuse}(1805)
       │                  └─{gvfsd-fuse}(1811)
       ├─gvfsd-metadata(6761)─┬─{gvfsd-metadata}(6762)
       │                      └─{gvfsd-metadata}(6763)
       ├─gvfsd-recent(2717)─┬─{gvfsd-recent}(2718)
       │                    └─{gvfsd-recent}(2719)
       ├─gvfsd-trash(2094)─┬─{gvfsd-trash}(2097)
       │                   └─{gvfsd-trash}(2098)
       ├─ibus-x11(1951)─┬─{ibus-x11}(1958)
       │                └─{ibus-x11}(1959)
       ├─irqbalance(817)
       ├─ksmtuned(882)───sleep(7962)
       ├─libvirtd(1131)─┬─{libvirtd}(1184)
       │                ├─{libvirtd}(1185)
       │                ├─{libvirtd}(1186)
       │                ├─{libvirtd}(1187)
       │                ├─{libvirtd}(1188)
       │                ├─{libvirtd}(1189)
       │                ├─{libvirtd}(1190)
       │                ├─{libvirtd}(1191)
       │                ├─{libvirtd}(1192)
       │                ├─{libvirtd}(1193)
       │                ├─{libvirtd}(1204)
       │                ├─{libvirtd}(1205)
       │                ├─{libvirtd}(1206)
       │                ├─{libvirtd}(1207)
       │                ├─{libvirtd}(1208)
       │                └─{libvirtd}(2862)
       ├─lsmd(836)
       ├─lvmetad(571)
       ├─master(1275)─┬─cleanup(7944)
       │              ├─local(7946)
       │              ├─pickup(7941)
       │              ├─qmgr(1277)
       │              └─trivial-rewrite(7945)
       ├─mcelog(870)
       ├─mission-control(1986)─┬─{mission-control}(1990)
       │                       ├─{mission-control}(1994)
       │                       └─{mission-control}(1995)
       ├─packagekitd(1554)─┬─{packagekitd}(1560)
       │                   └─{packagekitd}(1561)
       ├─polkitd(801)─┬─{polkitd}(808)
       │              ├─{polkitd}(814)
       │              ├─{polkitd}(815)
       │              ├─{polkitd}(816)
       │              └─{polkitd}(820)
       ├─qemu-kvm(7074)─┬─{qemu-kvm}(7099)
       │                ├─{qemu-kvm}(7100)
       │                ├─{qemu-kvm}(7101)
       │                └─{qemu-kvm}(7970)
       ├─rngd(838)
       ├─rsyslogd(1117)─┬─{rsyslogd}(1133)
       │                └─{rsyslogd}(1134)
       ├─rtkit-daemon(809)─┬─{rtkit-daemon}(858)
       │                   └─{rtkit-daemon}(859)
       ├─smartd(798)
       ├─sshd(1118)
       ├─systemd-journal(550)
       ├─systemd-logind(800)
       ├─systemd-machine(7075)
       ├─systemd-udevd(590)
       ├─tracker-store(2038)─┬─{tracker-store}(2042)
       │                     ├─{tracker-store}(2044)
       │                     ├─{tracker-store}(2045)
       │                     ├─{tracker-store}(2054)
       │                     ├─{tracker-store}(2055)
       │                     ├─{tracker-store}(2056)
       │                     └─{tracker-store}(2057)
       ├─tuned(1119)─┬─{tuned}(1215)
       │             ├─{tuned}(1216)
       │             ├─{tuned}(1217)
       │             └─{tuned}(1218)
       ├─udisksd(1576)─┬─{udisksd}(1579)
       │               ├─{udisksd}(1581)
       │               ├─{udisksd}(1602)
       │               └─{udisksd}(1606)
       ├─upowerd(1454)─┬─{upowerd}(1455)
       │               └─{upowerd}(1456)
       ├─virt-manager(2752)─┬─{virt-manager}(2756)
       │                    ├─{virt-manager}(2757)
       │                    ├─{virt-manager}(2758)
       │                    ├─{virt-manager}(2759)
       │                    ├─{virt-manager}(7103)
       │                    └─{virt-manager}(7104)
       ├─virtlogd(2776)───{virtlogd}(2778)
       ├─wpa_supplicant(1546)
       └─xinetd(1122)</code></pre>
</li>
</ul>
<h3 id="systemd-1">systemd</h3>
<ul>
<li>system 뿐만 아니라 service까지 관리</li>
<li>daemon</li>
<li>systemd 를 관리하는 컨트롤러 : systemctl</li>
<li>systemd의 핵심 키워드 :<ul>
<li>1) target : run level</li>
<li>2) unit : script</li>
</ul>
</li>
</ul>
<h4 id="runlevel">runlevel</h4>
<ul>
<li>비슷한 작업을 하는 unit들(script들)의 묶음 : <strong>target</strong></li>
<li>즉, runlevel == target</li>
<li>Runlevel-Target<ul>
<li>0-poweroff.target -&gt; halt</li>
<li>1-rescue.target -&gt; Single-user mode</li>
<li>2-multi-user.target -&gt; Full multi-user without networking</li>
<li>3-multi-user.target -&gt; Full multi-user with text mode login</li>
<li>4-multi-user.target -&gt; custom or local</li>
<li>5-graphical.target -&gt; Full multi-user with graphical login</li>
<li>6-reboot.target -&gt; reboot<pre><code class="language-shell">[root@localhost]# who -r
  run-level 5  2023-04-17 11:17
[root@localhost]# runlevel
N 5
</code></pre>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>runlevel 3으로 변경
[root@localhost]# init 3
[root@localhost]# runlevel
5 3</p>
</blockquote>
<blockquote>
<p>runlevel 1으로 변경
[root@localhost]# init 1
[root@localhost]# runlevel
3 1</p>
</blockquote>
<p>[root@localhost]# runlevel
[root@localhost]# systemctl isolate graphical.target
[root@localhost]# who -r</p>
<pre><code>   run-level 5  2023-04-18 11:01    last=1</code></pre></li>
</ul>
<blockquote>
<p>default boot target 확인 가능
 [root@localhost] systemctl get-default </p>
</blockquote>
<blockquote>
<p>default boot target 설정 가능
 [root@localhost] systemctl set-default multi-user.target</p>
</blockquote>
<blockquote>
<p>재부팅해보자 (reboot, or init 6 입력)</p>
</blockquote>
<pre><code>
#### 부트로더  : 커널 &amp; 램디스크 로딩
- **GRUB** 
1. 커널 &amp; 램디스크를 메모리로 로딩
2. systemd가 
3. systemd에 의해 나머지 process들이 병렬로 처리

- **단계**
  - **부트로더 설정파일**
    - linux16 행 -&gt; 커널 관련 설정
      - utf-8뒤에 **rd.break** 추가 : 커널 램디스크 로딩되자마자 멈춘다.
    - initrd16 행 -&gt; 램디스크 관련 설경

  - **root 디렉토리 변경  **
    - mount -o rw,remount /sysroot   
    - chroot /sysroot 
    - ls --- 평소에 보던 root 디렉토리가 출력됨.
  - passwd -- 비밀번호 변경

  - **장애처리 복구 **
    - vi /etc/fstab -&gt; LVM관련 실습 코드 삭제 (부팅 지연된 이유:LVM 다 삭제했는데 fstab에는 남아있어서 부팅하기 전에 계속 시도하는 것)

  - **세팅했던 내용이 적용될 수 있도록 해당 파일 꼭 작성 필요함.**
    - touch /.autorelabel

#### 부팅과 서비스   
- **Listing and Service (system 부팅 시 service 활성화되는지 아닌지 목록 확인)**
  - systemctl list-unit-files --type=service  
    - static -&gt; 특정 서비스에 종속되어 있는 것

- **Start and Stop Service**
  - service 서비스명 start|stop|status
  - /etc/init.d/스크립트명

- **Enabling and Disablig a service**
  - chkconfig 서비스명 on|off
  - ntsysv
  - setup



### Booting Linux on PC
1. 전원 ON
2. ROM : BIOS/UEFI
3. 부트로더의 커널, 램디스크 로딩
  - 부팅매체 : 하드디스크 드라이브 (HDD)
    -  MBR, GPT -&gt; **부트로더**(lilo, **GRUB**(v1.x,v2.x))
      - 부트로더의 역할 : 커널 &amp; 램디스크를 메모리로 로딩 (-&gt; systemd, init)
4. systemd 실행 후, 여러 프로세스 병렬 처리  

#### 부트로더가 깨졌을 때
grub2-install /dev/vda 
실행 시, 부트로더 다시 install

#### 부트로더 다시 설정해야할 때
- 가정
  - LAN 카드이름 : eth(x) -&gt; en(o|s|pxsx)
   - 카드 이름이 바뀌어서 변경해야할 경우?

1. 템플릿 파일 편집: /etc/defaults/grub 
2. grub2-mkconifg를 통해
3. /boot/grub2grub.cfg(BIOS/MBR boot) 또는 /boot/efi/EFI/distro.grub.cfg(UEFI/GPT boot) 에 반영
```shell

vi /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg

&gt; 재부팅 후 ifconfig로 inet6 부분 삭제 확인

&gt; 커널에 전달된 명령어 조회 가능
cat /proc/cmdline </code></pre><h4 id="ram-disk">RAM disk</h4>
<pre><code class="language-shell">
[root@station14 ~]# ls -l /boot
total 119432
-rw-r--r--. 1 root root   137701 Jun 30  2017 config-3.10.0-514.26.1.el7.x86_64
drwxr-xr-x. 2 root root       27 Apr  8 05:27 grub
drwx------. 6 root root      111 Apr  8 05:41 grub2
-rw-------. 1 root root 64540882 Apr  8 05:37 initramfs-0-rescue-2544d59d80f44d02b6ae0264364abe2e.img
-rw-------. 1 root root 33206678 Apr  8 05:41 initramfs-3.10.0-514.26.1.el7.x86_64.img
-rw-r--r--. 1 root root 10210059 Apr  8 05:36 initrd-plymouth.img
-rw-r--r--. 1 root root   277955 Jun 30  2017 symvers-3.10.0-514.26.1.el7.x86_64.gz
-rw-------. 1 root root  3114429 Jun 30  2017 System.map-3.10.0-514.26.1.el7.x86_64
-rwxr-xr-x. 1 root root  5397328 Apr  8 05:37 vmlinuz-0-rescue-2544d59d80f44d02b6ae0264364abe2e
-rwxr-xr-x. 1 root root  5397328 Jun 30  2017 vmlinuz-3.10.0-514.26.1.el7.x86_64

[root@station14 ~]# rm -f /boot/initramfs-3.10.0-514.26.1.el7.x86_64.img 

[root@station14 ~]# dracut --regenerate-all

[root@station14 ~]# ls -l /boot/
total 117028
-rw-r--r--. 1 root root   137701 Jun 30  2017 config-3.10.0-514.26.1.el7.x86_64
drwxr-xr-x. 2 root root       27 Apr  8 05:27 grub
drwx------. 6 root root      111 Apr  8 05:41 grub2
-rw-------. 1 root root 64540882 Apr  8 05:37 initramfs-0-rescue-2544d59d80f44d02b6ae0264364abe2e.img
-rw-------. 1 root root 30745655 Apr 18 14:00 initramfs-3.10.0-514.26.1.el7.x86_64.img
-rw-r--r--. 1 root root 10210059 Apr  8 05:36 initrd-plymouth.img
-rw-r--r--. 1 root root   277955 Jun 30  2017 symvers-3.10.0-514.26.1.el7.x86_64.gz
-rw-------. 1 root root  3114429 Jun 30  2017 System.map-3.10.0-514.26.1.el7.x86_64
-rwxr-xr-x. 1 root root  5397328 Apr  8 05:37 vmlinuz-0-rescue-2544d59d80f44d02b6ae0264364abe2e
-rwxr-xr-x. 1 root root  5397328 Jun 30  2017 vmlinuz-3.10.0-514.26.1.el7.x86_64

[root@station14 ~]# mkdir /tmp/ram

[root@station14 ~]# cd /tmp/ram/

[root@station14 ram]# /lib/dracut/skipcpio /boot/initramfs-3.10.0-514.26.1.el7.x86_64.img | zcat | cpio -icdmu
131313 blocks

[root@station14 ram]# ls
bin  etc   lib    proc  run   shutdown  sysroot  usr
dev  init  lib64  root  sbin  sys       tmp      var

&gt; target들 간의 연간관계 확인
[root@station14 ram]# systemctl list-dependencies
default.target
● ├─accounts-daemon.service
● ├─gdm.service
● ├─network.service
● ├─rtkit-daemon.service
● ├─systemd-readahead-collect.service
● ├─systemd-readahead-replay.service
● ├─systemd-update-utmp-runlevel.service
● └─multi-user.target
●   ├─abrt-ccpp.service
●   ├─abrt-oops.service
●   ├─abrt-vmcore.service
●   ├─abrt-xorg.service
●   ├─abrtd.service
●   ├─acpid.service
●   ├─atd.service
●   ├─auditd.service
●   ├─autofs.service
●   ├─avahi-daemon.service
●   ├─brandbot.path
●   ├─chronyd.service
●   ├─crond.service
●   ├─cups.path
lines 1-23...skipping...
</code></pre>
<h4 id="local-bootup-script-support">local bootup script support</h4>
<pre><code class="language-shell">[root@station14 ram]# cat -n /etc/rc.local 
     1    #!/bin/bash
     2    # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
     3    #
     4    # It is highly advisable to create own systemd services or udev rules
     5    # to run scripts during boot instead of using this file.
     6    #
     7    # In contrast to previous versions due to parallel execution during boot
     8    # this script will NOT be run after all other services.
     9    #
    10    # Please note that you must run &#39;chmod +x /etc/rc.d/rc.local&#39; to ensure
    11    # that this script will be executed during boot.
    12    
    13    touch /var/lock/subsys/local


[root@station14 ram]# vi /etc/rc.local 
      1 #!/bin/bash
      2 # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
      3 #
      4 # It is highly advisable to create own systemd services or udev rules
      5 # to run scripts during boot instead of using this file.
      6 #
      7 # In contrast to previous versions due to parallel execution during boot
      8 # this script will NOT be run after all other services.
      9 #
     10 # Please note that you must run &#39;chmod +x /etc/rc.d/rc.local&#39; to ensure
     11 # that this script will be executed during boot.
     12 
     13 touch /var/lock/subsys/local
     14 rdate -s time.bora.net    -- 부팅할 때 time.bora.net과 시간동기화

[root@station14 ram]# chmod +x /etc/rc.d/rc.local 

[root@station14 ram]# ll /etc/rc.local 
lrwxrwxrwx. 1 root root 13 Apr  8 05:28 /etc/rc.local -&gt; rc.d/rc.local</code></pre>
<h4 id="부팅-장애-발생-시킨-후-장애-해결해보기">부팅 장애 발생 시킨 후, 장애 해결해보기</h4>
<pre><code class="language-shell">@@Physical computer
[root@station14 ~]# cd /var/lib/libvirt/images/
[root@station14 images]# ll
total 6385268
-rw-------. 1 root root  1074135040 Apr 17 10:52 vm1-1.qcow2
-rw-------. 1 root root  1074135040 Apr 17 09:59 vm1-2.qcow2
-rw-------. 1 root root  1074135040 Apr 17 11:11 vm1-3.qcow2
-rw-------. 1 root root  1074135040 Apr 17 11:11 vm1-4.qcow2
-rw-------. 1 qemu qemu  1074135040 Apr 18 14:18 vm1-5.qcow2
-rw-------. 1 qemu qemu  1074135040 Apr 18 14:18 vm1-6.qcow2
-rw-------. 1 qemu qemu  1074921472 Apr 18 14:18 vm1-7.qcow2
-rw-------. 1 qemu qemu  1074135040 Apr 18 14:18 vm1-8.qcow2
-rw-------. 1 qemu qemu 22654550016 Apr 18 14:19 vm1.qcow2
[root@station14 images]# wget http://59.29.224.181/CentOS.iso
--2023-04-18 14:20:02--  http://59.29.224.181/CentOS.iso
Connecting to 59.29.224.181:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1020264448 (973M) [application/octet-stream]
Saving to: ‘CentOS.iso’

100%[============================================================&gt;] 1,020,264,448 4.28MB/s   in 2m 42s 

2023-04-18 14:22:43 (6.01 MB/s) - ‘CentOS.iso’ saved [1020264448/1020264448]


@@ Virtual Machine
&gt; 부트로더 손상시키기 
dd if=/dev/zero of=/dev/vda bs=64 count=1

</code></pre>
<p><img src="https://velog.velcdn.com/images/yoni_d/post/8b156d29-8a3e-462d-b4f6-bef4c4a590f3/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/33cb55ac-9c40-4d41-bd38-085b464851d8/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/1a4017cb-d7a4-4b57-9a50-21a2ad9f9de4/image.png" alt=""></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[AutoFS]]></title>
            <link>https://velog.io/@yoni_d/AutoFS</link>
            <guid>https://velog.io/@yoni_d/AutoFS</guid>
            <pubDate>Tue, 18 Apr 2023 01:19:50 GMT</pubDate>
            <description><![CDATA[<h3 id="nfs-vs-cifs">NFS vs CIFS</h3>
<p>nfs = unix, linux
cifs = windows</p>
<h3 id="file-sharing-via-nfs">File Sharing via NFS</h3>
<ul>
<li><p>공유 파일 시스템</p>
</li>
<li><p>버전이 여러개 존재</p>
<ul>
<li><p>NFS v1/v2 : UDP 프로토콜</p>
<ul>
<li>1:다</li>
<li>빠르다</li>
<li>복구 기능 X, 대용량 파일 전송 불가 WAN환경에서 적합 X)</li>
</ul>
</li>
<li><p>NFS v3 : TCP 기반 </p>
<ul>
<li>64-bit file 지원</li>
<li>2Gb이상의 파일 전송 가능, </li>
<li>WAN 환경 적합</li>
<li>but 보안관련 문제 존재</li>
<li>port 번호 여러개 쓰임 -&gt;  방화벽 여러개 열어야 함. (불편)</li>
</ul>
</li>
<li><p>NFS v4 : TCP 기반</p>
<ul>
<li>보안 관련 문제 보완</li>
<li>TCP port 2049 하나로 통합</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="nfs-clients">NFS clients</h3>
<ul>
<li>showmount -e server(nfs server ip)<ul>
<li>mount -t nfs nfs서버ip:/공유디렉토리 마운트포인트<pre><code class="language-shell"></code></pre>
</li>
</ul>
</li>
</ul>
<p>@@Physical computer</p>
<blockquote>
<p>nfs utils 패키지 있는지 확인
[root@station14 ~]# rpm -qa | grep nfs
libnfsidmap-0.25-15.el7.x86_64
nfs4-acl-tools-0.3.3-15.el7.x86_64
nfs-utils-1.3.0-0.33.el7_3.x86_64</p>
</blockquote>
<blockquote>
<p>실습 서버가 공유하고 있는 공유 디렉토리 목록 출력
[root@station14 ~]# showmount -e 59.29.224.181
Export list for 59.29.224.181:
/export/courserepos *
/export/autoyast    *
/export/home        *
/export/tmp         *
/export/netinstall  *
/export/kickstart   *</p>
</blockquote>
<blockquote>
<p>/data1이라는 서브 디렉토리 생성
[root@station14 ~]# mkdir /data1</p>
</blockquote>
<blockquote>
<p>공유 디렉토리에 /data1 마운트
[root@station14 ~]# mount -t nfs 59.29.224.181:/export/netinstall /data1</p>
</blockquote>
<blockquote>
<p>df -h 확인
[root@station14 ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root              8.0G  4.6G  3.5G  57% /
devtmpfs                          7.8G     0  7.8G   0% /dev
tmpfs                             7.8G   54M  7.8G   1% /dev/shm
tmpfs                             7.8G  712K  7.8G   1% /run
tmpfs                             7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                         494M  151M  344M  31% /boot
/dev/mapper/vg0-tmp              1014M   34M  981M   4% /tmp
/dev/mapper/vg0-var               2.0G  671M  1.4G  33% /var
/dev/sda3                         100G  4.9G   96G   5% /var/lib/libvirt/images
tmpfs                             1.6G   12K  1.6G   1% /run/user/0
59.29.224.181:/export/netinstall  931G   14G  917G   2% /data1  --this check!!</p>
</blockquote>
<blockquote>
<p>/data1 디렉토리에 mount된 모습
[root@station14 ~]# ls /data1
CENTOS7  configs  postinstalldata  README.txt</p>
</blockquote>
<pre><code>
#### 자동 mount 방법
- **/etc/fstab** 파일에 등록 -&gt; 다음번 부팅할 때, 자동으로 마운트된다.
  - 첫번째 컬럼 : 59.29.224.181:/공유디렉토리명
  - 두번째 컬럼: /data1
  - 세번째 컬럼 : nfs 
  - 네번째 컬럼 : mount옵션 -&gt; default
  - 다섯번째 컬럼 : 백업안하므로 -&gt; 0
  - 여섯번째 컬럼 : 파일시스템체크할것인가? 내것도 아니므로 체크 x -&gt;0

  -  **문제점**: 재부팅할 때 /data1에 마운트할 것이라고 시도를 하는데, nfs 서버에 응답이 없을 경우 계속 시도를 해서 결국 시스템 부팅이 안되는 문제 발생.
    - **AutoFS**를 설정하여 마운트하는 것이 일반적! 
    - 부팅할 때 마운트하는게 아니라, 필요할 때 자동으로 마운트

- **AutoFS**
  - /etc/fstab처럼 부팅할 때 마운트하는게 아니라, 필요할 때 자동으로 마운트해줌.
  - 사용하지 않는 경우에는 자동으로 unmount하는 기능도 포함.


### 재실습!!!!!!
```shell
@@@VM -nfs server

[root@localhost ~]# vi /etc/exports
/nfsdata 192.168.122.0/24(rw,sync)



&gt; nfs-server 상태 확인
[root@localhost ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

&gt; nfs server start
[root@localhost ~]# systemctl start nfs-server

[root@localhost ~]# mkdir /nfsdata

[root@localhost ~]# cp /etc/*.conf /nfsdata

[root@localhost ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: active (exited) since Mon 2023-04-17 16:57:15 KST; 2min 4s ago
  Process: 8028 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 8026 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
 Main PID: 8028 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Apr 17 16:57:15 localhost.localdomain systemd[1]: Starting NFS server and services...
Apr 17 16:57:15 localhost.localdomain exportfs[8026]: exportfs: Failed to stat /nfsdata: No such file or d...ory
Apr 17 16:57:15 localhost.localdomain systemd[1]: Started NFS server and services.
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]# systemctl restart nfs-server

[root@localhost ~]# showmount -e localhost
Export list for localhost:
/nfsdata 192.168.122.0/24


@@@ physical computer - nfs client 역할
&gt; data2 디렉토리 생성 후 vm에서 공유하는 디렉토리를 마운트 (재부팅 후에도 자동으로 마운트되도록 설정)
[root@station14 ~]# mkdir /data2

[root@station14 ~]# showmount -e vm의 ip

[root@station14 ~]# mkdir /data2

[root@station14 ~]# vi /etc/fstab
vm의ip:/nfsdata    /data2    nfs    defaults    0    0

[root@station14 ~]# mount -a

[root@station14 ~]# df -h



@@@ physical computer -nfs client
&gt; cifs-utils와 samba있는지 검색
[root@station14 ~]#rpm -qa | grep 새-e samba -e cifs

[root@station14 ~]# smbclient -L 59.29.224.20 

[root@station14 ~]# mkdir /data3

[root@station14 ~]# moount -t cifs -o user=administrator //59.29.224.20/windata /data3

[root@station14 ~]# df -h 

[root@station14 ~]# ls /data3
</code></pre><h2 id="autofs-configuration">AutoFS Configuration</h2>
<h3 id="etcautomaster">/etc/auto.master</h3>
<ul>
<li>메인 설정 파일</li>
<li>direct map 방식 or indirect map 방식으로 자동 mount할 것인지 <ul>
<li>direct -&gt; 세부 설정 파일이 절대경로로 시작 (/test -옵션션)</li>
<li>indirect -&gt; 세부 설정 파일이 상대경로로 시작</li>
</ul>
</li>
</ul>
<h3 id="autofs-설정해보기">AutoFS 설정해보기</h3>
<ul>
<li><p><strong>nfs server</strong></p>
<ul>
<li>/export/home</li>
</ul>
</li>
<li><p><strong>cifs</strong></p>
</li>
<li><p><strong>Physical computer</strong></p>
<ul>
<li><p>direct 방식 사용 (/-    /etc/aaa.auto)</p>
<ul>
<li>aaa.auto 세부 설정 파일 확인 -&gt; /winfile :루트 밑에 winfile에 유저나 프로세스가 접근하면 자동으로 마운트</li>
<li>aaa.auto 세부 설정 파일 : /winfile  -fstype=cifs,credentials=/root/z.txt //59.29.224.20/windata</li>
</ul>
</li>
<li><p>indirect 방식 사용 (/myuser /etc/bbb.auto)</p>
<ul>
<li>/myuser라는 특정 디렉토리에 접근하면, bbb.auto 세부 설정 파일을 참조하면 상대경로로 쓰여진 서브디렉토리 dsuser1, dsuser2, dsuser3 에 접근하면 자동으로 nfs server(59.29.224.181의 /export/home/dsuser1)에 자동으로 mount해달라. (즉, 특정 디렉토리 및으로 접근하면 바로 접근해달라)</li>
<li>bbb.auto 세부 설정 파일: (/myuser 아래 서브 디렉토리)
   1 dsuser1  -rw,sync       59.29.224.181:/export/home/dsuser1
   2 dsuser2  -rw,sync       59.29.224.181:/export/home/dsuser2
   3 dsuser3  -rw,sync       59.29.224.181:/export/home/dsuser3
   4 dsuser4  -rw,sync       59.29.224.181:/export/home/dsuser4</li>
</ul>
</li>
</ul>
</li>
<li><p>/winfile, /myuser 없으면 -&gt;  autofs가 자동으로 만들어줌    </p>
<pre><code class="language-shell">&gt; autofs 있는지 확인
[root@station14 ~]# rpm -qa | grep autofs
libsss_autofs-1.14.0-43.el7_3.18.x86_64
autofs-5.0.7-56.el7.x86_64
</code></pre>
</li>
</ul>
<blockquote>
<p>마운트해제
[root@station14 ~]# umount /data1</p>
</blockquote>
<p>[root@station14 ~]# vi /etc/auto.master
     29 /-      /etc/aaa.auto
     30 /myuser /etc/bbb.auto</p>
<blockquote>
<p>direct
[root@station14 ~]# vi /etc/aaa.auto
      1 /winfile  -fstype=cifs,credentials=/root/z.txt ://59.29.224.20/windata</p>
</blockquote>
<p>[root@station14 ~]# vi /root/z.txt
     1 username=administrator
     2 password=</p>
<blockquote>
<p>indiarect
[root@station14 ~]# vi /etc/bbb.auto
     1 files    -rw,sync       59.29.224.181:/export/netinstall</p>
</blockquote>
<p>[root@station14 ~]# systemctl restart autofs</p>
<blockquote>
<p>/winfile, /myuser 없으면 -&gt;  autofs가 자동으로 만들어줌<br>[root@station14 ~]# ls /
bin   data1  dev  home   lib    media  mnt  net  oracledb  root  sbin  sys  usr  winfile boot  data2  etc  labfiles  lib64  misc   myuser  opt  proc      run   srv   tmp  var</p>
</blockquote>
<p>[root@station14 winfile]# ll /winfile
total 1496
-rwxr-xr-x. 1 root root  245248 Apr 14  2008 AcSpecfc.dll
-rwxr-xr-x. 1 root root   80856 Apr 14  2008 ding.wav
-rwxr-xr-x. 1 root root 1202774 Apr 14  2008 sysmain.sdb</p>
<p>[root@station14 winfile]# df -h
Filesystem              Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root    8.0G  4.6G  3.5G  57% /
devtmpfs                7.8G     0  7.8G   0% /dev
tmpfs                   7.8G   62M  7.8G   1% /dev/shm
tmpfs                   7.8G  708K  7.8G   1% /run
tmpfs                   7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1               494M  151M  344M  31% /boot
/dev/mapper/vg0-tmp    1014M   34M  981M   4% /tmp
/dev/mapper/vg0-var     2.0G  676M  1.4G  34% /var
/dev/sda3               100G  5.8G   95G   6% /var/lib/libvirt/images
tmpfs                   1.6G   12K  1.6G   1% /run/user/0
//59.29.224.20/windata  932G  4.8G  927G   1% /winfile</p>
<p>[root@station14 myuser]# ll /myuser/files
total 8
drwxr-xr-x. 8 root root  254 Apr  7 07:27 CENTOS7
drwxr-xr-x. 2 root root 4096 Apr  7 07:33 configs
drwxr-xr-x. 4 root root  105 Apr  7 07:32 postinstalldata
-rw-r--r--. 1 root root  154 Jan  6  2017 README.txt</p>
<blockquote>
<p>/myuser/files에 마운트됨.
[root@station14 myuser]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root              8.0G  4.6G  3.5G  57% /
devtmpfs                          7.8G     0  7.8G   0% /dev
tmpfs                             7.8G   62M  7.8G   1% /dev/shm
tmpfs                             7.8G  708K  7.8G   1% /run
tmpfs                             7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                         494M  151M  344M  31% /boot
/dev/mapper/vg0-tmp              1014M   34M  981M   4% /tmp
/dev/mapper/vg0-var               2.0G  676M  1.4G  34% /var
/dev/sda3                         100G  5.8G   95G   6% /var/lib/libvirt/images
tmpfs                             1.6G   12K  1.6G   1% /run/user/0
59.29.224.181:/export/netinstall  931G   14G  917G   2% /myuser/files</p>
</blockquote>
<pre><code>

### System Boot Method
#### V init
- 커널에 의해 init 프로그램이 제일 먼저 실행 (pid=1)
  - init process: 순차처리
- 부팅 속도가 빨라지지 않음 -&gt; Upstart로 변경

#### Upstart
- 마찬가지로 init process 사용
- 사실 이전과 큰 차이가 없다.

#### Systemd
- CentOS 7,8버전에 해당
- init process가 아닌, systemd process를 통해서 다른 process를 관리 처리하겠다고 변경
- 순차처리가 아닌, 병렬처리(Parallel) -&gt;  부팅 속도 빨라짐
  - 즉, systemd가 여러 process를 병렬로 처리하여 속도의 향상 
  - 만약 의존성 관계가 있으면 tree형태로 처리
  ```shell
  [root@station14 ~]# pstree -p
  systemd(1)─┬─NetworkManager(871)─┬─dhclient(938)
           │                     ├─{NetworkManager}(913)
           │                     └─{NetworkManager}(915)
           ├─abrt-watch-log(821)
           ├─abrt-watch-log(857)
           ├─abrtd(819)
           ├─accounts-daemon(830)─┬─{accounts-daemon}(841)
           │                      └─{accounts-daemon}(844)
           ├─acpid(868)
           ├─at-spi-bus-laun(1895)─┬─dbus-daemon(1900)───{dbus-daemon}(1901)
           │                       ├─{at-spi-bus-laun}(1896)
           │                       ├─{at-spi-bus-laun}(1897)
           │                       └─{at-spi-bus-laun}(1899)
           ├─at-spi2-registr(1903)─┬─{at-spi2-registr}(1904)
           │                       └─{at-spi2-registr}(1905)
           ├─atd(1146)
           ├─auditd(775)─┬─audispd(788)─┬─sedispatch(795)
           │             │              └─{audispd}(796)
           │             └─{auditd}(787)
           ├─automount(7447)─┬─{automount}(7448)
           │                 ├─{automount}(7449)
           │                 ├─{automount}(7452)
           │                 ├─{automount}(7455)
           │                 ├─{automount}(7456)
           │                 └─{automount}(7457)
           ├─avahi-daemon(839)───avahi-daemon(845)
           ├─caribou(1993)─┬─{caribou}(1996)
           │               └─{caribou}(1999)
           ├─chronyd(846)
           ├─colord(1485)─┬─{colord}(1488)
           │              └─{colord}(1490)
           ├─crond(1144)
           ├─cupsd(1121)
           ├─dbus-daemon(1724)───{dbus-daemon}(1725)
           ├─dbus-daemon(810)───{dbus-daemon}(813)
           ├─dbus-launch(1723)
           ├─dconf-service(2384)─┬─{dconf-service}(2385)
           │                     └─{dconf-service}(2386)
           ├─dnsmasq(1353)───dnsmasq(1354)
           ├─evolution-calen(2155)─┬─{evolution-calen}(2160)
           │                       ├─{evolution-calen}(2162)
           │                       ├─{evolution-calen}(2163)
           │                       ├─{evolution-calen}(2164)
           │                       └─{evolution-calen}(2167)
           ├─evolution-sourc(1964)─┬─{evolution-sourc}(1965)
           │                       └─{evolution-sourc}(1966)
           ├─gconfd-2(2318)
           ├─gdm(1143)─┬─Xorg(1398)─┬─{Xorg}(1399)
           │           │            ├─{Xorg}(1400)
           │           │            └─{Xorg}(1401)
           │           ├─gdm-session-wor(1696)─┬─gnome-session(1716)─┬─abrt-applet(2043)─┬─{abrt-applet+
           │           │                       │                     │                   └─{abrt-applet+
           │           │                       │                     ├─gnome-settings-(1912)─┬─{gnome-s+
           │           │                       │                     │                       ├─{gnome-s+
           │           │                       │                     │                       ├─{gnome-s+
           │           │                       │                     │                       └─{gnome-s+
           │           │                       │                     ├─gnome-shell(1928)─┬─firefox(2261+
           │           │                       │                     │                   ├─ibus-daemon(+
           │           │                       │                     │                   ├─{gnome-shell+
           │           │                       │                     │                   ├─{gnome-shell+
           │           │                       │                     │                   ├─{gnome-shell+
           │           │                       │                     │                   ├─{gnome-shell+
           │           │                       │                     │                   └─{gnome-shell+
           │           │                       │                     ├─gnome-software(2052)─┬─{gnome-so+
           │           │                       │                     │                      ├─{gnome-so+
           │           │                       │                     │                      └─{gnome-so+
           │           │                       │                     ├─nautilus(2026)─┬─{nautilus}(2028+
           │           │                       │                     │                ├─{nautilus}(2029+
           │           │                       │                     │                └─{nautilus}(2068+
           │           │                       │                     ├─seapplet(2032)
           │           │                       │                     ├─ssh-agent(1883)
           │           │                       │                     ├─tracker-extract(2046)─┬─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       └─{tracker+
           │           │                       │                     ├─tracker-miner-a(2047)─┬─{tracker+
           │           │                       │                     │                       └─{tracker+
           │           │                       │                     ├─tracker-miner-f(2050)─┬─{tracker+
           │           │                       │                     │                       ├─{tracker+
           │           │                       │                     │                       └─{tracker+
           │           │                       │                     ├─tracker-miner-u(2051)─┬─{tracker+
           │           │                       │                     │                       └─{tracker+
           │           │                       │                     ├─{gnome-session}(1906)
           │           │                       │                     ├─{gnome-session}(1907)
           │           │                       │                     └─{gnome-session}(1908)
           │           │                       ├─{gdm-session-wor}(1697)
           │           │                       └─{gdm-session-wor}(1698)
           │           ├─{gdm}(1179)
           │           ├─{gdm}(1180)
           │           └─{gdm}(1397)
           ├─gnome-keyring-d(1706)─┬─{gnome-keyring-d}(1707)
           │                       ├─{gnome-keyring-d}(1920)
           │                       ├─{gnome-keyring-d}(1921)
           │                       └─{gnome-keyring-d}(1922)
           ├─gnome-shell-cal(1957)─┬─{gnome-shell-cal}(1960)
           │                       ├─{gnome-shell-cal}(1962)
           │                       ├─{gnome-shell-cal}(1977)
           │                       ├─{gnome-shell-cal}(1978)
           │                       └─{gnome-shell-cal}(2153)
           ├─gnome-terminal-(16364)─┬─bash(16372)───pstree(7971)
           │                        ├─gnome-pty-helpe(16371)
           │                        ├─{gnome-terminal-}(16365)
           │                        ├─{gnome-terminal-}(16366)
           │                        └─{gnome-terminal-}(16367)
           ├─goa-daemon(1969)─┬─{goa-daemon}(1970)
           │                  ├─{goa-daemon}(1972)
           │                  └─{goa-daemon}(1973)
           ├─goa-identity-se(1976)─┬─{goa-identity-se}(1981)
           │                       ├─{goa-identity-se}(1982)
           │                       └─{goa-identity-se}(1983)
           ├─gpm(823)
           ├─gsd-printer(1932)─┬─{gsd-printer}(1933)
           │                   └─{gsd-printer}(1934)
           ├─gssproxy(869)─┬─{gssproxy}(885)
           │               ├─{gssproxy}(886)
           │               ├─{gssproxy}(887)
           │               ├─{gssproxy}(888)
           │               └─{gssproxy}(889)
           ├─gvfs-afc-volume(2011)─┬─{gvfs-afc-volume}(2012)
           │                       ├─{gvfs-afc-volume}(2013)
           │                       └─{gvfs-afc-volume}(2015)
           ├─gvfs-goa-volume(2017)─┬─{gvfs-goa-volume}(2018)
           │                       └─{gvfs-goa-volume}(2019)
           ├─gvfs-gphoto2-vo(2022)─┬─{gvfs-gphoto2-vo}(2023)
           │                       └─{gvfs-gphoto2-vo}(2025)
           ├─gvfs-mtp-volume(2006)─┬─{gvfs-mtp-volume}(2007)
           │                       └─{gvfs-mtp-volume}(2009)
           ├─gvfs-udisks2-vo(2001)─┬─{gvfs-udisks2-vo}(2002)
           │                       └─{gvfs-udisks2-vo}(2003)
           ├─gvfsd(1792)─┬─{gvfsd}(1793)
           │             └─{gvfsd}(1794)
           ├─gvfsd-fuse(1797)─┬─{gvfsd-fuse}(1800)
           │                  ├─{gvfsd-fuse}(1801)
           │                  ├─{gvfsd-fuse}(1804)
           │                  ├─{gvfsd-fuse}(1805)
           │                  └─{gvfsd-fuse}(1811)
           ├─gvfsd-metadata(6761)─┬─{gvfsd-metadata}(6762)
           │                      └─{gvfsd-metadata}(6763)
           ├─gvfsd-recent(2717)─┬─{gvfsd-recent}(2718)
           │                    └─{gvfsd-recent}(2719)
           ├─gvfsd-trash(2094)─┬─{gvfsd-trash}(2097)
           │                   └─{gvfsd-trash}(2098)
           ├─ibus-x11(1951)─┬─{ibus-x11}(1958)
           │                └─{ibus-x11}(1959)
           ├─irqbalance(817)
           ├─ksmtuned(882)───sleep(7962)
           ├─libvirtd(1131)─┬─{libvirtd}(1184)
           │                ├─{libvirtd}(1185)
           │                ├─{libvirtd}(1186)
           │                ├─{libvirtd}(1187)
           │                ├─{libvirtd}(1188)
           │                ├─{libvirtd}(1189)
           │                ├─{libvirtd}(1190)
           │                ├─{libvirtd}(1191)
           │                ├─{libvirtd}(1192)
           │                ├─{libvirtd}(1193)
           │                ├─{libvirtd}(1204)
           │                ├─{libvirtd}(1205)
           │                ├─{libvirtd}(1206)
           │                ├─{libvirtd}(1207)
           │                ├─{libvirtd}(1208)
           │                └─{libvirtd}(2862)
           ├─lsmd(836)
           ├─lvmetad(571)
           ├─master(1275)─┬─cleanup(7944)
           │              ├─local(7946)
           │              ├─pickup(7941)
           │              ├─qmgr(1277)
           │              └─trivial-rewrite(7945)
           ├─mcelog(870)
           ├─mission-control(1986)─┬─{mission-control}(1990)
           │                       ├─{mission-control}(1994)
           │                       └─{mission-control}(1995)
           ├─packagekitd(1554)─┬─{packagekitd}(1560)
           │                   └─{packagekitd}(1561)
           ├─polkitd(801)─┬─{polkitd}(808)
           │              ├─{polkitd}(814)
           │              ├─{polkitd}(815)
           │              ├─{polkitd}(816)
           │              └─{polkitd}(820)
           ├─qemu-kvm(7074)─┬─{qemu-kvm}(7099)
           │                ├─{qemu-kvm}(7100)
           │                ├─{qemu-kvm}(7101)
           │                └─{qemu-kvm}(7970)
           ├─rngd(838)
           ├─rsyslogd(1117)─┬─{rsyslogd}(1133)
           │                └─{rsyslogd}(1134)
           ├─rtkit-daemon(809)─┬─{rtkit-daemon}(858)
           │                   └─{rtkit-daemon}(859)
           ├─smartd(798)
           ├─sshd(1118)
           ├─systemd-journal(550)
           ├─systemd-logind(800)
           ├─systemd-machine(7075)
           ├─systemd-udevd(590)
           ├─tracker-store(2038)─┬─{tracker-store}(2042)
           │                     ├─{tracker-store}(2044)
           │                     ├─{tracker-store}(2045)
           │                     ├─{tracker-store}(2054)
           │                     ├─{tracker-store}(2055)
           │                     ├─{tracker-store}(2056)
           │                     └─{tracker-store}(2057)
           ├─tuned(1119)─┬─{tuned}(1215)
           │             ├─{tuned}(1216)
           │             ├─{tuned}(1217)
           │             └─{tuned}(1218)
           ├─udisksd(1576)─┬─{udisksd}(1579)
           │               ├─{udisksd}(1581)
           │               ├─{udisksd}(1602)
           │               └─{udisksd}(1606)
           ├─upowerd(1454)─┬─{upowerd}(1455)
           │               └─{upowerd}(1456)
           ├─virt-manager(2752)─┬─{virt-manager}(2756)
           │                    ├─{virt-manager}(2757)
           │                    ├─{virt-manager}(2758)
           │                    ├─{virt-manager}(2759)
           │                    ├─{virt-manager}(7103)
           │                    └─{virt-manager}(7104)
           ├─virtlogd(2776)───{virtlogd}(2778)
           ├─wpa_supplicant(1546)
           └─xinetd(1122)</code></pre><h3 id="systemd">systemd</h3>
<ul>
<li><p>system 뿐만 아니라 service까지 관리</p>
</li>
<li><p>daemon</p>
</li>
<li><p>systemd 를 관리하는 컨트롤러 : systemctl</p>
</li>
<li><p>systemd의 핵심 키워드 :</p>
<ul>
<li>1) target : run level</li>
<li>2) unit : script</li>
</ul>
<h4 id="runlevel">runlevel</h4>
<ul>
<li>비슷한 작업을 하는 unit들(script들)의 묶음 : <strong>target</strong></li>
<li>즉, runlevel == target</li>
<li>Runlevel-Target</li>
<li>0-poweroff.target -&gt; halt</li>
<li>1-rescue.target -&gt; Single-user mode</li>
<li>2-multi-user.target -&gt; Full multi-user without networking</li>
<li>3-multi-user.target -&gt; Full multi-user with text mode login</li>
<li>4-multi-user.target -&gt; custom or local</li>
<li>5-graphical.target -&gt; Full multi-user with graphical login</li>
<li>6-reboot.target -&gt; reboot<pre><code class="language-shell">[root@localhost]# who -r
   run-level 5  2023-04-17 11:17
[root@localhost]# runlevel
N 5
</code></pre>
</li>
</ul>
<blockquote>
<p>runlevel 3으로 변경
[root@localhost]# init 3
[root@localhost]# runlevel
5 3</p>
</blockquote>
<blockquote>
<p>runlevel 1으로 변경
[root@localhost]# init 1
[root@localhost]# runlevel
3 1</p>
</blockquote>
<p>[root@localhost]# runlevel
[root@localhost]# systemctl isolate graphical.target
[root@localhost]# who -r</p>
<pre><code> run-level 5  2023-04-18 11:01    last=1</code></pre></li>
</ul>
<blockquote>
<p>default boot target 확인 가능
 [root@localhost] systemctl get-default </p>
</blockquote>
<blockquote>
<p>default boot target 설정 가능
 [root@localhost] systemctl set-default multi-user.target</p>
</blockquote>
<blockquote>
<p>재부팅해보자 (reboot, or init 6 입력)</p>
</blockquote>
<p> ```</p>
<h4 id="부트로더---커널--램디스크-로딩">부트로더  : 커널 &amp; 램디스크 로딩</h4>
<ul>
<li><strong>GRUB</strong> </li>
</ul>
<ol>
<li>커널 &amp; 램디스크를 메모리로 로딩</li>
<li>systemd가 </li>
<li>systemd에 의해 나머지 process들이 병렬로 처리</li>
</ol>
<p><strong>- 부트로더 설정파일</strong></p>
<ul>
<li>linux16 행 -&gt; 커널 관련 설정<ul>
<li>utf-8뒤에 <strong>rd.break</strong> 추가 : 커널 램디스크 로딩되자마자 멈춘다.</li>
</ul>
</li>
<li>initrd16 행 -&gt; 램디스크 관련 설경</li>
</ul>
<p>*<em>- root 디렉토리 변경  *</em></p>
<ul>
<li>mount -o rw,remount /sysroot   </li>
<li>chroot /sysroot </li>
<li>ls --- 평소에 보던 root 디렉토리가 출력됨.<ul>
<li>passwd -- 비밀번호 변경</li>
</ul>
</li>
</ul>
<p>*<em>- 장애처리 복구 *</em></p>
<ul>
<li>vi /etc/fstab -&gt; LVM관련 실습 코드 삭제 (부팅 지연된 이유:LVM 다 삭제했는데 fstab에는 남아있어서 부팅하기 전에 계속 시도하는 것)</li>
</ul>
<p><strong>- 세팅했던 내용이 적용될 수 있도록 해당 파일 꼭 작성 필요함.</strong></p>
<ul>
<li>touch /.autorelabel</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[NFS]]></title>
            <link>https://velog.io/@yoni_d/NFS</link>
            <guid>https://velog.io/@yoni_d/NFS</guid>
            <pubDate>Mon, 17 Apr 2023 07:32:43 GMT</pubDate>
            <description><![CDATA[<h3 id="nfs-vs-cifs">NFS vs CIFS</h3>
<p>nfs = unix, linux
cifs = windows</p>
<h3 id="file-sharing-via-nfs">File Sharing via NFS</h3>
<ul>
<li><p>공유 파일 시스템</p>
</li>
<li><p>버전이 여러개 존재</p>
<ul>
<li><p>NFS v1/v2 : UDP 프로토콜</p>
<ul>
<li>1:다</li>
<li>빠르다</li>
<li>복구 기능 X, 대용량 파일 전송 불가 WAN환경에서 적합 X)</li>
</ul>
</li>
<li><p>NFS v3 : TCP 기반 </p>
<ul>
<li>64-bit file 지원</li>
<li>2Gb이상의 파일 전송 가능, </li>
<li>WAN 환경 적합</li>
<li>but 보안관련 문제 존재</li>
<li>port 번호 여러개 쓰임 -&gt;  방화벽 여러개 열어야 함. (불편)</li>
</ul>
</li>
<li><p>NFS v4 : TCP 기반</p>
<ul>
<li>보안 관련 문제 보완</li>
<li>TCP port 2049 하나로 통합</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="nfs-clients">NFS clients</h3>
<ul>
<li>showmount -e server(nfs server ip)<ul>
<li>mount -t nfs nfs서버ip:/공유디렉토리 마운트포인트<pre><code class="language-shell"></code></pre>
</li>
</ul>
</li>
</ul>
<p>@@Physical computer</p>
<blockquote>
<p>nfs utils 패키지 있는지 확인
[root@station14 ~]# rpm -qa | grep nfs
libnfsidmap-0.25-15.el7.x86_64
nfs4-acl-tools-0.3.3-15.el7.x86_64
nfs-utils-1.3.0-0.33.el7_3.x86_64</p>
</blockquote>
<blockquote>
<p>실습 서버가 공유하고 있는 공유 디렉토리 목록 출력
[root@station14 ~]# showmount -e 59.29.224.181
Export list for 59.29.224.181:
/export/courserepos *
/export/autoyast    *
/export/home        *
/export/tmp         *
/export/netinstall  *
/export/kickstart   *</p>
</blockquote>
<blockquote>
<p>/data1이라는 서브 디렉토리 생성
[root@station14 ~]# mkdir /data1</p>
</blockquote>
<blockquote>
<p>공유 디렉토리에 /data1 마운트
[root@station14 ~]# mount -t nfs 59.29.224.181:/export/netinstall /data1</p>
</blockquote>
<blockquote>
<p>df -h 확인
[root@station14 ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root              8.0G  4.6G  3.5G  57% /
devtmpfs                          7.8G     0  7.8G   0% /dev
tmpfs                             7.8G   54M  7.8G   1% /dev/shm
tmpfs                             7.8G  712K  7.8G   1% /run
tmpfs                             7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                         494M  151M  344M  31% /boot
/dev/mapper/vg0-tmp              1014M   34M  981M   4% /tmp
/dev/mapper/vg0-var               2.0G  671M  1.4G  33% /var
/dev/sda3                         100G  4.9G   96G   5% /var/lib/libvirt/images
tmpfs                             1.6G   12K  1.6G   1% /run/user/0
59.29.224.181:/export/netinstall  931G   14G  917G   2% /data1  --this check!!</p>
</blockquote>
<blockquote>
<p>/data1 디렉토리에 mount된 모습
[root@station14 ~]# ls /data1
CENTOS7  configs  postinstalldata  README.txt</p>
</blockquote>
<pre><code>
#### 자동 mount 방법
- **/etc/fstab** 파일에 등록 -&gt; 다음번 부팅할 때, 자동으로 마운트된다.
  - 첫번째 컬럼 : 59.29.224.181:/공유디렉토리명
  - 두번째 컬럼: /data1
  - 세번째 컬럼 : nfs 
  - 네번째 컬럼 : mount옵션 -&gt; default
  - 다섯번째 컬럼 : 백업안하므로 -&gt; 0
  - 여섯번째 컬럼 : 파일시스템체크할것인가? 내것도 아니므로 체크 x -&gt;0

  -  **문제점**: 재부팅할 때 /data1에 마운트할 것이라고 시도를 하는데, nfs 서버에 응답이 없을 경우 계속 시도를 해서 결국 시스템 부팅이 안되는 문제 발생.
    - **AutoFS**를 설정하여 마운트하는 것이 일반적! 
    - 부팅할 때 마운트하는게 아니라, 필요할 때 자동으로 마운트

- **AutoFS**
  - /etc/fstab처럼 부팅할 때 마운트하는게 아니라, 필요할 때 자동으로 마운트해줌.
  - 사용하지 않는 경우에는 자동으로 unmount하는 기능도 포함.


### 재실습!!!!!!
```shell
@@@VM -nfs server

[root@localhost ~]# vi /etc/exports
/nfsdata 192.168.122.0/24(rw,sync)



&gt; nfs-server 상태 확인
[root@localhost ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

&gt; nfs server start
[root@localhost ~]# systemctl start nfs-server

[root@localhost ~]# mkdir /nfsdata

[root@localhost ~]# cp /etc/*.conf /nfsdata

[root@localhost ~]# systemctl status nfs-server
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: active (exited) since Mon 2023-04-17 16:57:15 KST; 2min 4s ago
  Process: 8028 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 8026 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
 Main PID: 8028 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Apr 17 16:57:15 localhost.localdomain systemd[1]: Starting NFS server and services...
Apr 17 16:57:15 localhost.localdomain exportfs[8026]: exportfs: Failed to stat /nfsdata: No such file or d...ory
Apr 17 16:57:15 localhost.localdomain systemd[1]: Started NFS server and services.
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]# systemctl restart nfs-server

[root@localhost ~]# showmount -e localhost
Export list for localhost:
/nfsdata 192.168.122.0/24


@@@ physical computer - nfs client 역할
&gt; data2 디렉토리 생성 후 vm에서 공유하는 디렉토리를 마운트 (재부팅 후에도 자동으로 마운트되도록 설정)
[root@station14 ~]# mkdir /data2

[root@station14 ~]# showmount -e vm의 ip

[root@station14 ~]# mkdir /data2

[root@station14 ~]# vi /etc/fstab
vm의ip:/nfsdata    /data2    nfs    defaults    0    0

[root@station14 ~]# mount -a

[root@station14 ~]# df -h



@@@ physical computer -nfs client
&gt; cifs-utils와 samba있는지 검색
[root@station14 ~]#rpm -qa | grep 새-e samba -e cifs

[root@station14 ~]# smbclient -L 59.29.224.20 

[root@station14 ~]# mkdir /data3

[root@station14 ~]# moount -t cifs -o user=administrator //59.29.224.20/windata /data3

[root@station14 ~]# df -h 

[root@station14 ~]# ls /data3
</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[LVM]]></title>
            <link>https://velog.io/@yoni_d/swap</link>
            <guid>https://velog.io/@yoni_d/swap</guid>
            <pubDate>Mon, 17 Apr 2023 00:55:09 GMT</pubDate>
            <description><![CDATA[<h3 id="swap">swap</h3>
<ol>
<li>device swap  &lt;- 지금은 이것만 사용<ul>
<li>파티셔닝을 하고, 파티셔닝된 디스크에 mkswap을 통해 swap을 만든다.</li>
<li>그 후, swapon을 통해 swap을 활성화 한다.</li>
</ul>
</li>
<li>file swap</li>
<li>psudo swap</li>
</ol>
<pre><code class="language-shell">@@VM
[root@localhost ~]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      xfs               243550a7-03de-42be-a6f4-726a8ea2a6ce   /white
├─sda2                                                               
├─sda5      ext4              571a7ee6-2340-4337-8741-10aae94af0fb   /black
└─sda6                                                               
sdb                                                                  
└─sdb2                                                               
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]

[root@localhost ~]# mkswap /dev/sdb2
Setting up swapspace version 1, size = 291836 KiB
no label, UUID=7fe3d0ac-3d51-4f17-868d-c3d428306179

[root@localhost ~]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      xfs               243550a7-03de-42be-a6f4-726a8ea2a6ce   /white
├─sda2                                                               
├─sda5      ext4              571a7ee6-2340-4337-8741-10aae94af0fb   /black
└─sda6                                                               
sdb                                                                  
└─sdb2      swap              7fe3d0ac-3d51-4f17-868d-c3d428306179   
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]

[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
[root@localhost ~]# swapon /dev/sdb2 
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
/dev/sdb2                                  partition    291836    0    -2



&gt; 물리컴퓨터
[root@station14 ~]# ssh yoni@192.168.122.108
The authenticity of host &#39;192.168.122.108 (192.168.122.108)&#39; can&#39;t be established.
ECDSA key fingerprint is d3:2b:d4:c6:8a:41:dd:d3:ea:00:87:33:f7:69:94:4e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added &#39;192.168.122.108&#39; (ECDSA) to the list of known hosts.
Welcome

yoni@192.168.122.108&#39;s password: 
Last login: Thu Apr 13 14:03:05 2023 from localhost
[yoni@localhost ~]$ cd /white
[yoni@localhost white]$ ll
total 0
[yoni@localhost white]$ 

&gt; VM
[root@localhost ~]# umount /white
umount: /white: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

[root@localhost ~]# fuser -cu /white
/white:               2496c(yoni)

[root@localhost ~]# ps -ef | grep 2496
yoni      2496  2495  0 10:11 pts/1    00:00:00 -bash
root      2588  2144  0 10:14 pts/0    00:00:00 grep --color=auto 2496

[root@localhost ~]# lsof /white/
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
bash    2496 yoni  cwd    DIR    8,1        6   64 /white

&gt; kill-9 pid or fuser -kcu /white (kill시킴)
[root@localhost ~]# fuser -kcu /white
/white:               2496c(yoni)


&gt; umount 후 확인
[root@localhost ~]# umount /white
[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  4.7G   13G  28% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  8.9M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
/dev/sda5            190M  1.6M  175M   1% /black
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   16K  396M   1% /run/user/0


&gt; label 붙이기
[root@localhost ~]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      xfs               243550a7-03de-42be-a6f4-726a8ea2a6ce   
├─sda2                                                               
├─sda5      ext4              571a7ee6-2340-4337-8741-10aae94af0fb   /black
└─sda6                                                               
sdb                                                                  
└─sdb2      swap              7fe3d0ac-3d51-4f17-868d-c3d428306179   [SWAP]
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP능

[root@localhost ~]# xfs_admin -L white_disk /dev/sda1
writing all SBs
new label = &quot;white_disk&quot;
[root@localhost ~]# lsblk -f
NAME        FSTYPE      LABEL      UUID                                   MOUNTPOINT
sda                                                                       
├─sda1      xfs         white_disk 243550a7-03de-42be-a6f4-726a8ea2a6ce   
├─sda2                                                                    
├─sda5      ext4                   571a7ee6-2340-4337-8741-10aae94af0fb   /black
└─sda6                                                                    
sdb                                                                       
└─sdb2      swap                   7fe3d0ac-3d51-4f17-868d-c3d428306179   [SWAP]
vda                                                                       
├─vda1      xfs                    0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member            CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs                    999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap                   faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]

[root@localhost ~]# e2label /dev/sda5 b_disk
[root@localhost ~]# lsblk -f
NAME        FSTYPE      LABEL      UUID                                   MOUNTPOINT
sda                                                                       
├─sda1      xfs         white_disk 243550a7-03de-42be-a6f4-726a8ea2a6ce   
├─sda2                                                                    
├─sda5      ext4        b_disk     571a7ee6-2340-4337-8741-10aae94af0fb   /black
└─sda6                                                                    
sdb                                                                       
└─sdb2      swap                   7fe3d0ac-3d51-4f17-868d-c3d428306179   [SWAP]
vda                                                                       
├─vda1      xfs                    0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member            CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs                    999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap                   faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]

&gt; mount 장치명 디렉토리 대신, mount 라벨명 디렉토리 가능
[root@localhost ~]# mount LABEL=white_disk /white

[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  4.7G   13G  28% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  8.9M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
/dev/sda5            190M  1.6M  175M   1% /black
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   16K  396M   1% /run/user/0
/dev/sda1            297M   16M  282M   6% /white


&gt; 파일 시스템의 속성
root@localhost ~]# xfs_info /dev/sda1
meta-data=/dev/sda1              isize=512    agcount=4, agsize=19200 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=76800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


&gt; tune2fs : 파일시스템 튜닝
– 특정 파일시스템의 수퍼블록정보 확인하기
– dumpe2fs 명령어를 사용한 것과 동일한 결과를 출력함.

[root@localhost ~]# tune2fs -l /dev/sda5
tune2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   b_disk
Last mounted on:          &lt;not available&gt;
Filesystem UUID:          571a7ee6-2340-4337-8741-10aae94af0fb
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              51200
Block count:              204800
Reserved block count:     10240
Free blocks:              192685
Free inodes:              51189
First block:              1
Block size:               1024
Fragment size:            1024
Group descriptor size:    64
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2048
Inode blocks per group:   256
Flex block group size:    16
Filesystem created:       Fri Apr 14 16:44:01 2023
Last mount time:          Mon Apr 17 09:57:01 2023
Last write time:          Mon Apr 17 10:21:18 2023
Mount count:              4
Maximum mount count:      -1
Last checked:             Fri Apr 14 16:44:01 2023
Check interval:           0 (&lt;none&gt;)
Lifetime writes:          11 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:              128
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      a6b9914f-0200-411a-9f6a-b621027224d4
Journal backup:           inode blocks


&gt; umount 상태에서 파일 시스템 체크 가능
[root@localhost ~]# xfs_repair /dev/sda1
xfs_repair: /dev/sda1 contains a mounted filesystem
xfs_repair: /dev/sda1 contains a mounted and writable filesystem

fatal error -- couldn&#39;t initialize XFS library
[root@localhost ~]# umount /dev/sda1
[root@localhost ~]# xfs_repair /dev/sda1
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
        - scan filesystem freespace and inode maps...
        - found root inode chunk
Phase 3 - for each AG...
        - scan and clear agi unlinked lists...
        - process known inodes and perform inode discovery...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
        - process newly discovered inodes...
Phase 4 - check for duplicate blocks...
        - setting up duplicate extent list...
        - check for inodes claiming duplicate blocks...
        - agno = 0
        - agno = 1
        - agno = 2
        - agno = 3
Phase 5 - rebuild AG headers and trees...
        - reset superblock...
Phase 6 - check inode connectivity...
        - resetting contents of realtime bitmap and summary inodes
        - traversing filesystem ...
        - traversal finished ...
        - moving disconnected inodes to lost+found ...
Phase 7 - verify and correct link counts...
done
[root@localhost ~]# umount /dev/sda5
[root@localhost ~]# e2fsck /dev/sda5
e2fsck 1.42.9 (28-Dec-2013)
b_disk: clean, 11/51200 files, 12115/204800 blocks

&gt; XFS filesystem 명령어
xfs_repair : 파일 시스템 체크
xfs_growfs : 파일 시스템 사이즈 늘릴 때

&gt; 파티션을 나누는 행위 -&gt; 확장 가능성이 떨어짐
백업 후 unmount, 파티션 뿌수고 (fdisk, parted 등), 파티션 확장, mount, 다시 복구 등... 
=&gt; LVM을 통해 유용하게 디스크를 관리하자!
</code></pre>
<h3 id="lvm">LVM</h3>
<h4 id="lvm의-핵심-키워드">LVM의 핵심 키워드</h4>
<ul>
<li>*<em>PV (Physical Volumes) *</em><ul>
<li>찰흙 덩어리 하나</li>
<li>즉, 물리적인 디스크 덩어리</li>
<li>이 PV를 모아 모아서, 커다란 덩어리로 만들 수 있음 =&gt; VG</li>
</ul>
</li>
<li><strong>VG (Volume Groups)</strong><ul>
<li>PV를 조합하여 VG 큰 덩어리</li>
</ul>
</li>
<li><strong>LV (Logical Volumes)</strong><ul>
<li>VG에서 얼마만큼 떼어내서 디스크 영역을 만드는 것이 LV</li>
</ul>
</li>
<li><strong>Extent</strong> <ul>
<li>초콜렛에서 잘라 먹기 편하도록 금이 가있음</li>
<li>즉, LVM의 관리 및 용량 할당의 최소 단위를 의미함 </li>
<li>Extent의 기본 값: 4MB (옛날 디스크 기본 값으로, 요즘은 주로 2^n 값을 사용)</li>
<li>VG(volume groups) 만들 때, 사용한다. (세팅한다.)</li>
<li>Logical Volume 쪽에서 바라보면, Logical Extents</li>
<li>Physical Volume 쪽에서 바라보면, Physical Extents</li>
</ul>
</li>
</ul>
<pre><code class="language-shell">[root@localhost ~]# lsblk
NAME        MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda           8:0    0   1G  0 disk 
sdb           8:16   0   1G  0 disk 
sdc           8:32   0   1G  0 disk 
vda         252:0    0  20G  0 disk 
├─vda1      252:1    0   1G  0 part /boot
└─vda2      252:2    0  19G  0 part 
  ├─cl-root 253:0    0  17G  0 lvm  /
  └─cl-swap 253:1    0   2G  0 lvm  [SWAP]

[root@localhost ~]# pvs
  PV         VG Fmt  Attr PSize  PFree
  /dev/vda2  cl lvm2 a--  19.00g    0 

[root@localhost ~]# pvcreate /dev/sda /dev/sdb
  Physical volume &quot;/dev/sda&quot; successfully created.
  Physical volume &quot;/dev/sdb&quot; successfully created.

[root@localhost ~]# pvs
  PV         VG Fmt  Attr PSize  PFree
  /dev/sda      lvm2 ---   1.00g 1.00g
  /dev/sdb      lvm2 ---   1.00g 1.00g
  /dev/vda2  cl lvm2 a--  19.00g    0 

[root@localhost ~]# pvdisplay /dev/sda
  &quot;/dev/sda&quot; is a new physical volume of &quot;1.00 GiB&quot;
  --- NEW Physical volume ---
  PV Name               /dev/sda
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq


&gt; vgs :  volume group 스캔   
[root@localhost ~]# vgs
  VG #PV #LV #SN Attr   VSize  VFree
  cl   1   2   0 wz--n- 19.00g    0 

&gt; volume group create (test 라는 group에 sda와 sdb 덩어리를 이용해 VG 만들어 보자)
[root@localhost ~]# vgcreate test /dev/sda /dev/sdb
  Volume group &quot;test&quot; successfully created

[root@localhost ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  cl     1   2   0 wz--n- 19.00g    0 
  test   2   0   0 wz--n-  1.99g 1.99g

&gt; sda PV 를 확인해보면, test라는 VG에 할당됨을 확인 가능.
extent는 VG가 할당될 떄 할당됨. deafault가 4MB인 것 확인 가능.
[root@localhost ~]# pvdisplay /dev/sda
  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               test
  PV Size               1.00 GiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              255
  Free PE               255
  Allocated PE          0
  PV UUID               6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq

&gt; test라는 VG 삭제 해보자
[root@localhost ~]# vgremove test
  Volume group &quot;test&quot; successfully removed
[root@localhost ~]# vgs
  VG #PV #LV #SN Attr   VSize  VFree
  cl   1   2   0 wz--n- 19.00g    0 

&gt; vgcolor라는 VG 다시 생성해보는데 extent사이즈를 16MB로 해보자.
[root@localhost ~]# vgcreate -s 16M vgcolor /dev/sda /dev/sdb
  Volume group &quot;vgcolor&quot; successfully created

[root@localhost ~]# vgs
  VG      #PV #LV #SN Attr   VSize  VFree
  cl        1   2   0 wz--n- 19.00g    0 
  vgcolor   2   0   0 wz--n-  1.97g 1.97g

[root@localhost ~]# pvdisplay /dev/sda
  --- Physical volume ---
  PV Name               /dev/sda
  VG Name               vgcolor
  PV Size               1.00 GiB / not usable 16.00 MiB
  Allocatable           yes 
  PE Size               16.00 MiB
  Total PE              63
  Free PE               63
  Allocated PE          0
  PV UUID               6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq

&gt; VG (volume group)에 대한 자세한 정보 출력
[root@localhost ~]# vgdisplay vgcolor
  --- Volume group ---
  VG Name               vgcolor
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.97 GiB
  PE Size               16.00 MiB
  Total PE              126
  Alloc PE / Size       0 / 0   
  Free  PE / Size       126 / 1.97 GiB
  VG UUID               g2HQ8f-DUvm-g3B0-k7ea-LgvE-bM9E-0ZnGQ4


&gt; vgcolor VG에서 원하는 만큼 떼어내서 Logical volume을 만들어보자.
</code></pre>
<h3 id="lv-logical-volume">LV (logical volume)</h3>
<ul>
<li><p>lvcreat -L</p>
<ul>
<li>850G와 같이 명확한 용량 사이즈 지정</li>
</ul>
</li>
<li><p>lvcreate -l</p>
<ul>
<li>% 지정 가능 (VG 용량 중 몇 % 를 LV로 만들겠다)</li>
<li>extent 개수 지정 가능</li>
<li>850G와 같은 용량 사이즈 지정 가능</li>
</ul>
</li>
</ul>
<h4 id="vg에서-원하는-만큼-떼어내서-logical-volume을-만들어보자">VG에서 원하는 만큼 떼어내서 Logical volume을 만들어보자.</h4>
<pre><code class="language-shell"> &gt; vgcolor VG에서 원하는 만큼 떼어내서 red라는 Logical volume을 만들어보자.
[root@localhost ~]# lvcreate -L 150M -n red vgcolor
  Rounding up size to full physical extent 160.00 MiB
  Logical volume &quot;red&quot; created.

[root@localhost ~]# lvs
  LV   VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root cl      -wi-ao----  17.00g                                                    
  swap cl      -wi-ao----   2.00g                                                    
  red  vgcolor -wi-a----- 160.00m      -----this one!!

&gt; extent 20개 이므로, 16*20 = 320M  
[root@localhost ~]# lvcreate -l 20 -n blue vgcolor
  Logical volume &quot;blue&quot; created.

[root@localhost ~]# lvs
  LV   VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root cl      -wi-ao----  17.00g                                                    
  swap cl      -wi-ao----   2.00g                                                    
  blue vgcolor -wi-a----- 320.00m      -----this one!!                                               
  red  vgcolor -wi-a----- 160.00m  

&gt; %로 LV 할당해보자 (남아있는 VG중 20%)
root@localhost ~]# lvcreate -l 20%FREE vgcolor
  Logical volume &quot;lvol0&quot; created.

[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-a----- 320.00m                                                    
  lvol0 vgcolor -wi-a----- 304.00m     -----this one!!                                               
  red   vgcolor -wi-a----- 160.00m  


</code></pre>
<h4 id="two-ways-of-reference-a-logical-volume">Two ways of reference a Logical Volume</h4>
<p>1) computer : /dev/mapper/VGname-LVname
2) human : /dev/VGname/LVname</p>
<pre><code class="language-shell">&gt; lvdisplay를 통해 LV에 대한 자세한 정보 확인

&gt; 1번
[root@localhost ~]# lvdisplay /dev/mapper/vgcolor-red
  --- Logical volume ---
  LV Path                /dev/vgcolor/red
  LV Name                red
  VG Name                vgcolor
  LV UUID                zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 11:48:06 +0900
  LV Status              available
  # open                 0
  LV Size                160.00 MiB
  Current LE             10
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

&gt; 2번
[root@localhost ~]# lvdisplay /dev/vgcolor/red
  --- Logical volume ---
  LV Path                /dev/vgcolor/red
  LV Name                red
  VG Name                vgcolor
  LV UUID                zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 11:48:06 +0900
  LV Status              available
  # open                 0
  LV Size                160.00 MiB
  Current LE             10
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

[root@localhost ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Thu Apr 13 10:19:58 2023
#
# Accessible filesystems, by reference, are maintained under &#39;/dev/disk&#39;
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=0cab009d-2c67-4dc9-a881-c5efde97ed56 /boot                   xfs     defaults        0 0
/dev/mapper/cl-swap     swap                    swap    defaults        0 0

</code></pre>
<h3 id="etcfstab">/etc/fstab</h3>
<h4 id="fields">fields</h4>
<p><strong>1. Block device or remote directory</strong> : 파일 시스템 장치명
<strong>2. Mount point(directory)</strong> : 파일 시스템이 마운트 될 디렉토리 지정
<strong>3. Filesystem type (xfs | ext4 | swap)</strong> :  마운트 될 파일 시스템 종류
<strong>4. Extra mount option (defaults)</strong> : 파일 시스템 속성 설정
<strong>5. dump flag (0|1) *<em>: 0일 경우 백업하지 않음. 1일 경우 백업하는 파일 시스템
*</em>6. fsck order (0|1|2)</strong> : 루트 파일 시스템 점검 여부 
(0: 부팅시 파일 시스템 점검 x, 1: 루트 파일 시스템으로 부팅 시 파일 시스템 점검, 2: 루트 파일 시스템 이외의 파일시스템으로서 부팅시 파일 시스템을 점검)</p>
<h4 id="example">example</h4>
<pre><code class="language-shell">[root@localhost etc]# vi /etc/fstab
  #
  # /etc/fstab
  # Created by anaconda on Thu Apr 13 10:19:58 2023
  #
  # Accessible filesystems, by reference, are maintained under &#39;/dev/disk&#39;
  # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
  #
  /dev/mapper/cl-root     /                       xfs     defaults        0 0
  UUID=0cab009d-2c67-4dc9-a881-c5efde97ed56 /boot                   xfs     defaults        0 0
  /dev/mapper/cl-swap     swap                    swap    defaults        0 0
  /dev/sda1               /white                  xfs     defaults        0 0
  /dev/sda5               /black                  ext4    defaults        0 1</code></pre>
<h4 id="red-blue-lvol0-각각-lv에-대해-마운트-및-파일시스템-설정">red, blue, lvol0 각각 LV에 대해 마운트 및 파일시스템 설정</h4>
<pre><code class="language-shell">[root@localhost ~]# mkfs -t xfs /dev/vgcolor/red
meta-data=/dev/vgcolor/red       isize=512    agcount=4, agsize=10240 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=40960, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@localhost ~]# mkfs -t ext4 /dev/vgcolor/blue
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
81920 inodes, 327680 blocks
16384 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33947648
40 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
    8193, 24577, 40961, 57345, 73729, 204801, 221185

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@localhost ~]# mkswap /dev/vgcolor/lvol0
Setting up swapspace version 1, size = 311292 KiB
no label, UUID=797747f9-0b22-44a5-a387-508153880d81



[root@localhost ~]# lsblk -f
NAME            FSTYPE      LABEL UUID                                   MOUNTPOINT
sda             LVM2_member       6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq 
├─vgcolor-red   xfs               94645283-d87d-498c-ad3a-9254c2164e91   
├─vgcolor-blue  ext4              9a5d046e-6d37-4af4-baaf-352f5f113f62   
└─vgcolor-lvol0 swap              797747f9-0b22-44a5-a387-508153880d81   
sdb             LVM2_member       52XEkN-oWZY-anS8-W323-oPEd-0rnn-v0IX0O 
sdc                                                                      
vda                                                                      
├─vda1          xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2          LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root     xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap     swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]



[root@localhost ~]# vi /etc/fstab   
# /etc/fstab
# Created by anaconda on Thu Apr 13 10:19:58 2023
#
# Accessible filesystems, by reference, are maintained under &#39;/dev/disk&#39;
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=0cab009d-2c67-4dc9-a881-c5efde97ed56 /boot                   xfs     defaults        0 0
/dev/mapper/cl-swap     swap                    swap    defaults        0 0
/dev/mapper/vgcolor-red      /red               xfs     defaults        0 0
/dev/mapper/vgcolor-blue     /blue              ext4    defaults        0 0
/dev/mapper/vgcolor-lvol0    swap               swap    defaults        0 0


# /etc/fstab
# Created by anaconda on Thu Apr 13 10:19:58 2023
#
# Accessible filesystems, by reference, are maintained under &#39;/dev/disk&#39;
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=0cab009d-2c67-4dc9-a881-c5efde97ed56 /boot                   xfs     defaults        0 0
/dev/mapper/cl-swap     swap                    swap    defaults        0 0
/dev/vgcolor/red       /red             xfs     defaults        0 0
/dev/vgcolor/blue      /blue            ext4    defaults        0 0
/dev/vgcolor/lvol0     swap             swap    defaults        0 0


&gt; mount 디렉토리 생성
[root@localhost ~]# mkdir /red /blue

&gt; /red, /blue에 mount
[root@localhost ~]# mount -a

&gt; mount 확인
[root@localhost ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl-root        17G  3.8G   14G  23% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G  144K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.9M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                1014M  157M  858M  16% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M  8.0K  396M   1% /run/user/0
/dev/mapper/vgcolor-red   157M  8.2M  149M   6% /red   --------this one!!
/dev/mapper/vgcolor-blue  302M  2.1M  280M   1% /blue  --------this one!!

&gt;swapon 활성화
[root@localhost ~]# swapon -a
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
/dev/dm-4                                  partition    311292    0    -2
</code></pre>
<h4 id="volume-group에-여유-공간이-부족하다면">Volume Group에 여유 공간이 부족하다면?</h4>
<pre><code class="language-shell">&gt; red/에 bigfile 디렉토리를 만들겠다. 이때, block size가 10M인 것을 12개 파일을 urandom 난수 발생기를 통해 랜덤하게 만들겠다.

&gt; 하지만 사이즈 여유공간이 부족하다면?
[root@localhost ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl-root        17G  3.8G   14G  23% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G  144K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.9M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                1014M  157M  858M  16% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red   157M  129M   29M  82% /red
/dev/mapper/vgcolor-blue  302M  2.1M  280M   1% /blue


&gt; Volume Group에 충분한 여유공간이 있으면, 떼서 주면 된다.
But, 없다면 Volume Group에 Physical Volume을 기존 Volume Group에 더 붙이면 된다.(추가하면 된다.)


&gt; vgcolor VG에 여유공간(vFREE) 확인해보니 1.20G 존재하나, 부족하다고 가정하고 늘려보자.
[root@localhost ~]# vgs
  VG      #PV #LV #SN Attr   VSize  VFree
  cl        1   2   0 wz--n- 19.00g    0 
  vgcolor   2   3   0 wz--n-  1.97g 1.20g


&gt; PV 확인 후, sdc PV 생성
[root@localhost ~]# pvs
  PV         VG      Fmt  Attr PSize    PFree   
  /dev/sda   vgcolor lvm2 a--  1008.00m  224.00m
  /dev/sdb   vgcolor lvm2 a--  1008.00m 1008.00m
  /dev/vda2  cl      lvm2 a--    19.00g       0 

[root@localhost ~]# pvcreate /dev/sdc
  Physical volume &quot;/dev/sdc&quot; successfully created.
[root@localhost ~]# pvs
  PV         VG      Fmt  Attr PSize    PFree   
  /dev/sda   vgcolor lvm2 a--  1008.00m  224.00m
  /dev/sdb   vgcolor lvm2 a--  1008.00m 1008.00m
  /dev/sdc           lvm2 ---     1.00g    1.00g
  /dev/vda2  cl      lvm2 a--    19.00g       0 

&gt; vgcolor VG를 확장하겠다. (sdc를 이용하여)
[root@localhost ~]# pvcreate /dev/sdc
  Physical volume &quot;/dev/sdc&quot; successfully created.

[root@localhost ~]# pvs
  PV         VG      Fmt  Attr PSize    PFree   
  /dev/sda   vgcolor lvm2 a--  1008.00m  224.00m
  /dev/sdb   vgcolor lvm2 a--  1008.00m 1008.00m
  /dev/sdc           lvm2 ---     1.00g    1.00g
  /dev/vda2  cl      lvm2 a--    19.00g       0 

[root@localhost ~]# vgextend vgcolor /dev/sdc
  Volume group &quot;vgcolor&quot; successfully extended

[root@localhost ~]# pvs
  PV         VG      Fmt  Attr PSize    PFree   
  /dev/sda   vgcolor lvm2 a--  1008.00m  224.00m
  /dev/sdb   vgcolor lvm2 a--  1008.00m 1008.00m
  /dev/sdc   vgcolor lvm2 a--  1008.00m 1008.00m
  /dev/vda2  cl      lvm2 a--    19.00g       0 

[root@localhost ~]# vgs
  VG      #PV #LV #SN Attr   VSize  VFree
  cl        1   2   0 wz--n- 19.00g    0 
  vgcolor   3   3   0 wz--n-  2.95g 2.19g

&gt; 이번엔 LV를 늘려보자. (size로 늘릴 수도 있고(-L), extent 개수로 늘릴 수도 있다.(-l))
[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-ao---- 320.00m                                                    
  lvol0 vgcolor -wi-ao---- 304.00m                                                    
  red   vgcolor -wi-ao---- 160.00m 

&gt; 주의: 최종 증가되는 사이즈, 최종 증가되는 extent 개수를 기입해야함.

&gt; red LV를 640M 사이즈로 늘림 (-L옵션) or lvextend -l 40 /dev/vgcolor/red(40*16M)
[root@localhost ~]# lvextend -L 640M /dev/vgcolor/red
  Size of logical volume vgcolor/red changed from 160.00 MiB (10 extents) to 640.00 MiB (40 extents).
  Logical volume vgcolor/red successfully resized.

[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-ao---- 320.00m                                                    
  lvol0 vgcolor -wi-ao---- 304.00m                                                    
  red   vgcolor -wi-ao---- 640.00m      


&gt; 이번에는 blue LV를 늘려보자.
[root@localhost ~]# lvextend -l 40 /dev/vgcolor/blue
  Size of logical volume vgcolor/blue changed from 320.00 MiB (20 extents) to 640.00 MiB (40 extents).
  Logical volume vgcolor/blue successfully resized.

[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-ao---- 640.00m                                                    
  lvol0 vgcolor -wi-ao---- 304.00m                                                    
  red   vgcolor -wi-ao---- 640.00m  


&gt; df -h 확인: logical volume 사이즈만 늘렸지, 파일 시스템 사이즈를 늘린게 아니므로, 그대로이다.(즉, logical volume이 늘어났다고 그만큼 데이터가 저장될 수 없다. 파일 시스템도 그만큼 늘려주어야 한다.)
[root@localhost ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl-root        17G  3.9G   14G  23% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G  144K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.9M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                1014M  157M  858M  16% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red   157M  129M   29M  82% /red    ----this check!!
/dev/mapper/vgcolor-blue  302M  2.1M  280M   1% /blue



&gt; xfs 파일 포맷 확장 (/red)
[root@localhost ~]# xfs_growfs /dev/vgcolor/red
meta-data=/dev/mapper/vgcolor-red isize=512    agcount=4, agsize=10240 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=40960, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 40960 to 163840

&gt; ext4 파일 포맷 확장(/blue)
[root@localhost ~]# resize2fs /dev/vgcolor/blue
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vgcolor/blue is mounted on /blue; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 5
The filesystem on /dev/vgcolor/blue is now 655360 blocks long.

&gt; 마운트이 되어 있는 상태에서, 파일 시스템 용량 확장 가능 -&gt; df -h로 확장된 용량 확인
[root@localhost ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl-root        17G  3.9G   14G  23% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G  144K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.9M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                1014M  157M  858M  16% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red   637M  129M  509M  21% /red        ----this check!!
/dev/mapper/vgcolor-blue  612M  2.3M  577M   1% /blue       ----this check!!
</code></pre>
<h4 id="반대로-파일시스템-용량을-줄이려면">반대로, 파일시스템 용량을 줄이려면?</h4>
<pre><code class="language-shell">
&gt; 먼저 , umount 진행
[root@localhost ~]# umount /blu인

&gt; umount된 것 확인
[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/cl-root       17G  3.9G   14G  23% /
devtmpfs                 2.0G     0  2.0G   0% /dev
tmpfs                    2.0G  144K  2.0G   1% /dev/shm
tmpfs                    2.0G  8.9M  2.0G   1% /run
tmpfs                    2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1               1014M  157M  858M  16% /boot
tmpfs                    396M  4.0K  396M   1% /run/user/42
tmpfs                    396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red  637M  129M  509M  21% /red


&gt; resize 시, 파일 시스템에 문제 있는지 없는지 강제로 먼저 체크를 해야 한다고 나옴.
[root@localhost ~]# resize2fs /dev/vgcolor/blue 480M
resize2fs 1.42.9 (28-Dec-2013)
Please run &#39;e2fsck -f /dev/vgcolor/blue&#39; first.

[root@localhost ~]# e2fsck -f /dev/vgcolor/blue
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/vgcolor/blue: 11/163840 files (0.0% non-contiguous), 31187/655360 blocks

&gt; 
[root@localhost ~]# resize2fs /dev/vgcolor/blue 480M
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/vgcolor/blue to 491520 (1k) blocks.
The filesystem on /dev/vgcolor/blue is now 491520 blocks long.

[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/cl-root       17G  3.9G   14G  23% /
devtmpfs                 2.0G     0  2.0G   0% /dev
tmpfs                    2.0G  144K  2.0G   1% /dev/shm
tmpfs                    2.0G  8.9M  2.0G   1% /run
tmpfs                    2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1               1014M  157M  858M  16% /boot
tmpfs                    396M  4.0K  396M   1% /run/user/42
tmpfs                    396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red  637M  129M  509M  21% /red

[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-a----- 640.00m                                                    
  lvol0 vgcolor -wi-ao---- 304.00m                                                    
  red   vgcolor -wi-ao---- 640.00m                                                    

&gt; blue LV 사이즈 줄임  
[root@localhost ~]# lvreduce -L 480M /dev/vgcolor/blue
  WARNING: Reducing active logical volume to 480.00 MiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vgcolor/blue? [y/n]: y
  Size of logical volume vgcolor/blue changed from 640.00 MiB (40 extents) to 480.00 MiB (30 extents).
  Logical volume vgcolor/blue successfully resized.

[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-a----- 480.00m                                                    
  lvol0 vgcolor -wi-ao---- 304.00m                                                    
  red   vgcolor -wi-ao---- 640.00m        


[root@localhost ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/cl-root       17G  3.9G   14G  23% /
devtmpfs                 2.0G     0  2.0G   0% /dev
tmpfs                    2.0G  144K  2.0G   1% /dev/shm
tmpfs                    2.0G  8.9M  2.0G   1% /run
tmpfs                    2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1               1014M  157M  858M  16% /boot
tmpfs                    396M  4.0K  396M   1% /run/user/42
tmpfs                    396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red  637M  129M  509M  21% /red


&gt; 다시  /blue에 mount
[root@localhost ~]# mount /blue

&gt; df -h로 파일 시스템 용량 최종 줄어듦을 확인!
[root@localhost ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl-root        17G  3.9G   14G  23% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G  144K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.9M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                1014M  157M  858M  16% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red   637M  129M  509M  21% /red
/dev/mapper/vgcolor-blue  457M  2.3M  429M   1% /blue    --this check!!


&gt; vgcolor에 대한 속성 정보를 출력해준다.  가끔, volume group(VG)에 문제가 생기면, 해당 파일을 참고해서 VG 복구 가능!
[root@localhost ~]# ls /etc/lvm/backup/
cl  vgcolor

[root@localhost ~]# cat /etc/lvm/backup/vgcolor
# Generated by LVM2 version 2.02.166(2)-RHEL7 (2016-11-16): Mon Apr 17 13:59:32 2023

contents = &quot;Text Format Volume Group&quot;
version = 1

description = &quot;Created *after* executing &#39;lvreduce -L 480M /dev/vgcolor/blue&#39;&quot;

creation_host = &quot;localhost.localdomain&quot;    # Linux localhost.localdomain 3.10.0-514.26.1.el7.x86_64 #1 SMP Thu Jun 29 16:05:25 UTC 2017 x86_64
creation_time = 1681707572    # Mon Apr 17 13:59:32 2023

vgcolor {
    id = &quot;g2HQ8f-DUvm-g3B0-k7ea-LgvE-bM9E-0ZnGQ4&quot;
    seqno = 8
    format = &quot;lvm2&quot;            # informational
    status = [&quot;RESIZEABLE&quot;, &quot;READ&quot;, &quot;WRITE&quot;]
    flags = []
    extent_size = 32768        # 16 Megabytes
    max_lv = 0
    max_pv = 0
    metadata_copies = 0

    physical_volumes {

        pv0 {
            id = &quot;6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq&quot;
            device = &quot;/dev/sda&quot;    # Hint only

            status = [&quot;ALLOCATABLE&quot;]
            flags = []
            dev_size = 2097152    # 1024 Megabytes
            pe_start = 2048
            pe_count = 63    # 1008 Megabytes
        }

        pv1 {
            id = &quot;52XEkN-oWZY-anS8-W323-oPEd-0rnn-v0IX0O&quot;
            device = &quot;/dev/sdb&quot;    # Hint only

            status = [&quot;ALLOCATABLE&quot;]
            flags = []
            dev_size = 2097152    # 1024 Megabytes
            pe_start = 2048
            pe_count = 63    # 1008 Megabytes
        }

        pv2 {
            id = &quot;k7k20f-BqVU-Luyx-Vt9e-8Jao-YsDm-KuHc0P&quot;
            device = &quot;/dev/sdc&quot;    # Hint only

            status = [&quot;ALLOCATABLE&quot;]
            flags = []
            dev_size = 2097152    # 1024 Megabytes
            pe_start = 2048
            pe_count = 63    # 1008 Megabytes
        }
    }

    logical_volumes {

        red {
            id = &quot;zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5&quot;
            status = [&quot;READ&quot;, &quot;WRITE&quot;, &quot;VISIBLE&quot;]
            flags = []
            creation_time = 1681699686    # 2023-04-17 11:48:06 +0900
            creation_host = &quot;localhost.localdomain&quot;
            segment_count = 3

            segment1 {
                start_extent = 0
                extent_count = 10    # 160 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 0
                ]
            }
            segment2 {
                start_extent = 10
                extent_count = 14    # 224 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 49
                ]
            }
            segment3 {
                start_extent = 24
                extent_count = 16    # 256 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv1&quot;, 0
                ]
            }
        }

        blue {
            id = &quot;XRtCnu-fRAI-XkfL-f4fm-OsYy-UTNR-p8Ul7u&quot;
            status = [&quot;READ&quot;, &quot;WRITE&quot;, &quot;VISIBLE&quot;]
            flags = []
            creation_time = 1681699719    # 2023-04-17 11:48:39 +0900
            creation_host = &quot;localhost.localdomain&quot;
            segment_count = 2

            segment1 {
                start_extent = 0
                extent_count = 20    # 320 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 10
                ]
            }
            segment2 {
                start_extent = 20
                extent_count = 10    # 160 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv1&quot;, 16
                ]
            }
        }

        lvol0 {
            id = &quot;3sZq1c-3xHR-VdKv-l9a2-E4AX-VaG1-PvJN4D&quot;
            status = [&quot;READ&quot;, &quot;WRITE&quot;, &quot;VISIBLE&quot;]
            flags = []
            creation_time = 1681699844    # 2023-04-17 11:50:44 +0900
            creation_host = &quot;localhost.localdomain&quot;
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 19    # 304 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 30
                ]
            }
        }
    }

}


&gt; vgcfgbackup 그냥 실행 시 -&gt; /etc/lvm/backup 에 디폴트로 백업됨.
[root@localhost ~]# vgcfgbackup
  Volume group &quot;cl&quot; successfully backed up.
  Volume group &quot;vgcolor&quot; successfully backed up.

&gt; vgcfgbackup 백업 파일 지정 가능

[root@localhost ~]# vgcfgbackup -f /tmp/vg.back vgcolor
  Volume group &quot;vgcolor&quot; successfully backed up.
[root@localhost ~]# cat /tmp/vg.back
# Generated by LVM2 version 2.02.166(2)-RHEL7 (2016-11-16): Mon Apr 17 14:07:10 2023

contents = &quot;Text Format Volume Group&quot;
version = 1

description = &quot;vgcfgbackup -f /tmp/vg.back vgcolor&quot;

creation_host = &quot;localhost.localdomain&quot;    # Linux localhost.localdomain 3.10.0-514.26.1.el7.x86_64 #1 SMP Thu Jun 29 16:05:25 UTC 2017 x86_64
creation_time = 1681708030    # Mon Apr 17 14:07:10 2023

vgcolor {
    id = &quot;g2HQ8f-DUvm-g3B0-k7ea-LgvE-bM9E-0ZnGQ4&quot;
    seqno = 8
    format = &quot;lvm2&quot;            # informational
    status = [&quot;RESIZEABLE&quot;, &quot;READ&quot;, &quot;WRITE&quot;]
    flags = []
    extent_size = 32768        # 16 Megabytes
    max_lv = 0
    max_pv = 0
    metadata_copies = 0

    physical_volumes {

        pv0 {
            id = &quot;6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq&quot;
            device = &quot;/dev/sda&quot;    # Hint only

            status = [&quot;ALLOCATABLE&quot;]
            flags = []
            dev_size = 2097152    # 1024 Megabytes
            pe_start = 2048
            pe_count = 63    # 1008 Megabytes
        }

        pv1 {
            id = &quot;52XEkN-oWZY-anS8-W323-oPEd-0rnn-v0IX0O&quot;
            device = &quot;/dev/sdb&quot;    # Hint only

            status = [&quot;ALLOCATABLE&quot;]
            flags = []
            dev_size = 2097152    # 1024 Megabytes
            pe_start = 2048
            pe_count = 63    # 1008 Megabytes
        }

        pv2 {
            id = &quot;k7k20f-BqVU-Luyx-Vt9e-8Jao-YsDm-KuHc0P&quot;
            device = &quot;/dev/sdc&quot;    # Hint only

            status = [&quot;ALLOCATABLE&quot;]
            flags = []
            dev_size = 2097152    # 1024 Megabytes
            pe_start = 2048
            pe_count = 63    # 1008 Megabytes
        }
    }

    logical_volumes {

        red {
            id = &quot;zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5&quot;
            status = [&quot;READ&quot;, &quot;WRITE&quot;, &quot;VISIBLE&quot;]
            flags = []
            creation_time = 1681699686    # 2023-04-17 11:48:06 +0900
            creation_host = &quot;localhost.localdomain&quot;
            segment_count = 3

            segment1 {
                start_extent = 0
                extent_count = 10    # 160 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 0
                ]
            }
            segment2 {
                start_extent = 10
                extent_count = 14    # 224 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 49
                ]
            }
            segment3 {
                start_extent = 24
                extent_count = 16    # 256 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv1&quot;, 0
                ]
            }
        }

        blue {
            id = &quot;XRtCnu-fRAI-XkfL-f4fm-OsYy-UTNR-p8Ul7u&quot;
            status = [&quot;READ&quot;, &quot;WRITE&quot;, &quot;VISIBLE&quot;]
            flags = []
            creation_time = 1681699719    # 2023-04-17 11:48:39 +0900
            creation_host = &quot;localhost.localdomain&quot;
            segment_count = 2

            segment1 {
                start_extent = 0
                extent_count = 20    # 320 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 10
                ]
            }
            segment2 {
                start_extent = 20
                extent_count = 10    # 160 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv1&quot;, 16
                ]
            }
        }

        lvol0 {
            id = &quot;3sZq1c-3xHR-VdKv-l9a2-E4AX-VaG1-PvJN4D&quot;
            status = [&quot;READ&quot;, &quot;WRITE&quot;, &quot;VISIBLE&quot;]
            flags = []
            creation_time = 1681699844    # 2023-04-17 11:50:44 +0900
            creation_host = &quot;localhost.localdomain&quot;
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 19    # 304 Megabytes

                type = &quot;striped&quot;
                stripe_count = 1    # linear

                stripes = [
                    &quot;pv0&quot;, 30
                ]
            }
        }
    }

}


&gt; backup한 것 restore
[root@localhost ~]# vgcfgrestore -f /tmp/vg.back vgcolor
  Restored volume group vgcolor

&gt; 
[root@localhost ~]# vgdisplay vgcolor
  --- Volume group ---
  VG Name               vgcolor
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               2.95 GiB
  PE Size               16.00 MiB
  Total PE              189
  Alloc PE / Size       89 / 1.39 GiB
  Free  PE / Size       100 / 1.56 GiB
  VG UUID               g2HQ8f-DUvm-g3B0-k7ea-LgvE-bM9E-0ZnGQ4

</code></pre>
<h4 id="moving-volumes-between-systems">Moving Volumes Between Systems</h4>
<ul>
<li><strong>새로운 시스템 (old -&gt; new) 디스크 이전하는 process</strong></li>
</ul>
<ol>
<li>unmount /디렉토리 (언마운트하기)</li>
<li>vgchange -a n VG이름 (:volume group 비활성화)</li>
<li>vgexport VG이름  (:export해서 해당 VG 내보냄)</li>
<li>poweroff</li>
</ol>
<hr>
<ol start="5">
<li>새로운 디스크장착</li>
<li>power on</li>
<li>pvscan (:physical volume들을 scan함 -&gt; 어느 Volume group에 속하는지 분류됨)</li>
<li>vgimport VG이름 (:volume group이 import됨)</li>
<li>vgchange -a y VG이름 (VG가 아직 비활성화 상태이므로, volume group을 활성화해주어야 함.</li>
</ol>
<pre><code class="language-shell">[root@localhost ~]# df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl-root        17G  3.9G   14G  23% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G  144K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.9M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                1014M  157M  858M  16% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M   12K  396M   1% /run/user/0
/dev/mapper/vgcolor-red   637M  129M  509M  21% /red
/dev/mapper/vgcolor-blue  457M  2.3M  429M   1% /blue

[root@localhost ~]# umount /red /blue

[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  3.9G   14G  23% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  8.9M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   12K  396M   1% /run/user/0

[root@localhost ~]# swapoff /dev/vgcolor/lvol0


[root@localhost ~]# vgchange -a n vgcolor
  0 logical volume(s) in volume group &quot;vgcolor&quot; now active
[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi------- 480.00m                                                    
  lvol0 vgcolor -wi------- 304.00m                                                    
  red   vgcolor -wi------- 640.00m                                                    
[root@localhost ~]# lvdisplay /dev/vgcolor/red
  --- Logical volume ---
  LV Path                /dev/vgcolor/red
  LV Name                red
  VG Name                vgcolor
  LV UUID                zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 11:48:06 +0900
  LV Status              NOT available   ---this check!!!
  LV Size                640.00 MiB
  Current LE             40
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto

[root@localhost ~]# vgexport vgcolor
  Volume group &quot;vgcolor&quot; successfully exported

&gt; Attr 에 x붙음 (export)
[root@localhost ~]# pvs
  PV         VG      Fmt  Attr PSize    PFree   
  /dev/sda   vgcolor lvm2 ax-  1008.00m       0      ---Attr this check!!!!
  /dev/sdb   vgcolor lvm2 ax-  1008.00m  592.00m     ---Attr this check!!!!
  /dev/sdc   vgcolor lvm2 ax-  1008.00m 1008.00m     ---Attr this check!!!!
  /dev/vda2  cl      lvm2 a--    19.00g       0 

&gt; power off 후, 디스크 바꿔끼웠다고 가정  

&gt; pvscan
[root@localhost ~]# pvscan   
  PV /dev/vda2   VG cl              lvm2 [19.00 GiB / 0    free]
  PV /dev/sda     is in exported VG vgcolor [1008.00 MiB / 0    free]
  PV /dev/sdb     is in exported VG vgcolor [1008.00 MiB / 592.00 MiB free]
  PV /dev/sdc     is in exported VG vgcolor [1008.00 MiB / 1008.00 MiB free]
  Total: 4 [21.95 GiB] / in use: 4 [21.95 GiB] / in no VG: 0 [0   ]

&gt; vgimport 수행
[root@localhost ~]# vgimport vgcolor
  Volume group &quot;vgcolor&quot; successfully imported

&gt; export(x- 사라짐)
[root@localhost ~]# pvs
  PV         VG      Fmt  Attr PSize    PFree   
  /dev/sda   vgcolor lvm2 a--  1008.00m       0 
  /dev/sdb   vgcolor lvm2 a--  1008.00m  592.00m
  /dev/sdc   vgcolor lvm2 a--  1008.00m 1008.00m
  /dev/vda2  cl      lvm2 a--    19.00g       0 

[root@localhost ~]# vgdisplay vgcolor
  --- Volume group ---
  VG Name               vgcolor
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               2.95 GiB
  PE Size               16.00 MiB
  Total PE              189
  Alloc PE / Size       89 / 1.39 GiB
  Free  PE / Size       100 / 1.56 GiB
  VG UUID               g2HQ8f-DUvm-g3B0-k7ea-LgvE-bM9E-0ZnGQ4


&gt; 아직, Logical Volume은 활성화되지 않은 상태임.
[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi------- 480.00m                                                    
  lvol0 vgcolor -wi------- 304.00m                                                    
  red   vgcolor -wi------- 640.00m                                           

&gt; LV status 확인
[root@localhost ~]# lvdisplay /dev/vgcolor/red
  --- Logical volume ---
  LV Path                /dev/vgcolor/red
  LV Name                red
  VG Name                vgcolor
  LV UUID                zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 11:48:06 +0900
  LV Status              NOT available   -----this check!!!아직 비활성화 상태
  LV Size                640.00 MiB
  Current LE             40
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto

&gt; vgcolor라는 LV 활성화 
[root@localhost ~]# vgchange -a y vgcolor
  3 logical volume(s) in volume group &quot;vgcolor&quot; now active

[root@localhost ~]# lvs
  LV    VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root  cl      -wi-ao----  17.00g                                                    
  swap  cl      -wi-ao----   2.00g                                                    
  blue  vgcolor -wi-a----- 480.00m                                                    
  lvol0 vgcolor -wi-a----- 304.00m                                                    
  red   vgcolor -wi-a----- 640.00m                                                    
[root@localhost ~]# lvdisplay /dev/vgcolor/red
  --- Logical volume ---
  LV Path                /dev/vgcolor/red
  LV Name                red
  VG Name                vgcolor
  LV UUID                zUlKwe-fLDP-oZrd-LrlW-NfR7-2l6Z-vAaaX5
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 11:48:06 +0900
  LV Status              available        -----this check!!!활성화 됨.
  # open                 0
  LV Size                640.00 MiB
  Current LE             40
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

</code></pre>
<h4 id="logical-volume-삭제">Logical Volume 삭제</h4>
<pre><code class="language-shell">&gt; LV 삭제
[root@localhost ~]# lvremove /dev/vgcolor/lvol0
Do you really want to remove active logical volume vgcolor/lvol0? [y/n]: y
  Logical volume &quot;lvol0&quot; successfully removed

[root@localhost ~]# lvs
  LV   VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root cl      -wi-ao----  17.00g                                                    
  swap cl      -wi-ao----   2.00g                                                    
  blue vgcolor -wi-a----- 480.00m                                                    
  red  vgcolor -wi-a----- 640.00m    

&gt; VG 삭제
[root@localhost ~]# vgremove vgcolor
Do you really want to remove volume group &quot;vgcolor&quot; containing 2 logical volumes? [y/n]: y
Do you really want to remove active logical volume vgcolor/red? [y/n]: y
  Logical volume &quot;red&quot; successfully removed
Do you really want to remove active logical volume vgcolor/blue? [y/n]: y
  Logical volume &quot;blue&quot; successfully removed
  Volume group &quot;vgcolor&quot; successfully removed

[root@localhost ~]# vgs
  VG #PV #LV #SN Attr   VSize  VFree
  cl   1   2   0 wz--n- 19.00g    0 

&gt; Physical Volume은 아직 남아있음
[root@localhost ~]# pvs
  PV         VG Fmt  Attr PSize  PFree
  /dev/sda      lvm2 ---   1.00g 1.00g
  /dev/sdb      lvm2 ---   1.00g 1.00g
  /dev/sdc      lvm2 ---   1.00g 1.00g
  /dev/vda2  cl lvm2 a--  19.00g    0 

&gt; /dev/sdc PV 삭제
[root@localhost ~]# pvremove /dev/sdc
  Labels on physical volume &quot;/dev/sdc&quot; successfully wiped.

&gt; pvs 확인
[root@localhost ~]# pvs
  PV         VG Fmt  Attr PSize  PFree
  /dev/sda      lvm2 ---   1.00g 1.00g
  /dev/sdb      lvm2 ---   1.00g 1.00g
  /dev/vda2  cl lvm2 a--  19.00g    0 
</code></pre>
<h4 id="advanced-lvm--automated-storage-tiering">Advanced LVM : Automated Storage Tiering</h4>
<ul>
<li><p><strong>사양 exampale</strong></p>
<ul>
<li>HDD(하드디스크 2TB)</li>
<li>SSD(512G)</li>
<li>SSHD(2TB) : SSD와 하드디스크를 결합한 하이브리드 형태<ul>
<li>OS가 설치되는 영역 : SSD</li>
<li>실제 data가 저장되는 영역 : HDD</li>
<li>이것이 LVM Tiering과 똑같은 것.</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Storage Tiering</strong></p>
<ul>
<li>SSD: 읽고 쓰기 성능이 빠르기 때문에, 캐쉬 용도로 사용</li>
<li>HDD: 실제 data를 저장
=&gt; 이들을 PV(physical volume으로 만듬)
=&gt; HDD를 묶어서 tag로 지정, SSD를 묶어서 tag로 지정
=&gt; 이러한 PV를 묶고 묶어 VG(volume group)으로 만듦.
=&gt; data라고 하는 tag를 갖고 있는 PV만 모아서 LV(Logical volume)1으로 만듦.
=&gt; 캐쉬라고 하는 tag를 갖고 있는 PV만 모아서 LV(Logical volume)2으로 만듦.
=&gt; 그리고 LV1과 LV2를 서로 묶어서 (LV1+LV2) 하나의 LV(Logical volume)처럼 만들어줌.
=&gt; 이를 바로 <strong>storage Tiering</strong>이라고 부름.</li>
</ul>
</li>
</ul>
<ul>
<li>option<ul>
<li>writethrough: 읽기 성능 향상, 쓰기 성능 보통<ul>
<li>안정성 보장</li>
</ul>
</li>
<li>writeback: ssd로부터 읽고 쓰니까, 읽기 성능 향상, 쓰기 성능 향상<ul>
<li>안정성 문제 (캐쉬에 쓴게 날라 갈 수도 있으므로)</li>
</ul>
</li>
</ul>
</li>
</ul>
<pre><code class="language-shell">&gt; pvs object tags
[root@localhost ~]# pvs -o+tags
  PV         VG Fmt  Attr PSize  PFree PV Tags
  /dev/sda      lvm2 ---   1.00g 1.00g        
  /dev/sdb      lvm2 ---   1.00g 1.00g        
  /dev/vda2  cl lvm2 a--  19.00g    0  

[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  3.9G   14G  23% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  8.9M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   12K  396M   1% /run/user/0

[root@localhost ~]# pvcreate /dev/sdc
  Physical volume &quot;/dev/sdc&quot; successfully created.

[root@localhost ~]# pvs
  PV         VG Fmt  Attr PSize  PFree
  /dev/sda      lvm2 ---   1.00g 1.00g
  /dev/sdb      lvm2 ---   1.00g 1.00g
  /dev/sdc      lvm2 ---   1.00g 1.00g
  /dev/vda2  cl lvm2 a--  19.00g    0성

[root@localhost ~]# vgs
  VG #PV #LV #SN Attr   VSize  VFree
  cl   1   2   0 wz--n- 19.00g    0 

&gt; VG 생성  
[root@localhost ~]# vgcreate vgcloud /dev/sda /dev/sdb /dev/sdc
  Volume group &quot;vgcloud&quot; successfully created


&gt; VG(volume group) 이 만들어져야, tag를 지정할 수 있다.
&gt; tag 생성
[root@localhost ~]# pvchange --addtag slowhdd /dev/sda /dev/sdb
  Physical volume &quot;/dev/sda&quot; changed
  Physical volume &quot;/dev/sdb&quot; changed
  2 physical volumes changed / 0 physical volumes not changed

&gt; tag 생성  
[root@localhost ~]# pvchange --addtag sdd /dev/sdc
  Physical volume &quot;/dev/sdc&quot; changed
  1 physical volume changed / 0 physical volumes not changed

&gt; tag 확인
[root@localhost ~]# pvs -o+tags
  PV         VG      Fmt  Attr PSize    PFree    PV Tags
  /dev/sda   vgcloud lvm2 a--  1020.00m 1020.00m slowhdd
  /dev/sdb   vgcloud lvm2 a--  1020.00m 1020.00m slowhdd
  /dev/sdc   vgcloud lvm2 a--  1020.00m 1020.00m sdd    
  /dev/vda2  cl      lvm2 a--    19.00g       0         

&gt; vgcloud Volume Group(VG)에서 slowhdd라는 태그(@slowhdd)를 갖고 있는 애들만 모아서 lvdata이름의 Logical Volume(LV) 만들자
[root@localhost ~]# lvcreate -l 100%FREE -n lvdata vgcloud @slowhdd
WARNING: xfs signature detected on /dev/vgcloud/lvdata at offset 0. Wipe it? [y/n]: y
  Wiping xfs signature on /dev/vgcloud/lvdata.
  Logical volume &quot;lvdata&quot; created.


&gt;  vgcloud Volume Group(VG)에서 sdd라는 태그를 갖고 있는 애들만 모아서 lvcache이름의 Logical Volume(LV) 만들자
&gt; cache-poll로 쓰겠다는 type 옵션추가 (--type cache-pool)
[root@localhost ~]# lvcreate --type cache-pool -l 100%FREE -n lvcache vgcloud @sdd
  Using default stripesize 64.00 KiB.
  Logical volume &quot;lvcache&quot; created.

&gt; LV 확인
[root@localhost ~]# lvs
  LV      VG      Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root    cl      -wi-ao----   17.00g                                                    
  swap    cl      -wi-ao----    2.00g                                                    
  lvcache vgcloud Cwi---C--- 1004.00m                                                    
  lvdata  vgcloud -wi-a-----    1.99g  


&gt; lvcache를  lvdata의 cachepool로 쓰겠다. -&gt; lvcache, lvdata 두개의 LV가 하나로 결합됨.
[root@localhost ~]# lvconvert --type cache --cachepool vgcloud/lvcache vgcloud/lvdata
Do you want wipe existing metadata of cache pool volume vgcloud/lvcache? [y/n]: y
  Logical volume vgcloud/lvdata is now cached.

&gt; LV 확인 (결합됨)
[root@localhost ~]# lvs
  LV     VG      Attr       LSize  Pool      Origin         Data%  Meta%  Move Log Cpy%Sync Convert
  root   cl      -wi-ao---- 17.00g                                                                 
  swap   cl      -wi-ao----  2.00g                                                                 
  lvdata vgcloud Cwi-a-C---  1.99g [lvcache] [lvdata_corig] 0.00   1.86            0.00       

&gt; 파일 포맷
[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  3.9G   14G  23% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  8.9M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   12K  396M   1% /run/user/0

[root@localhost ~]# mkfs.xfs /dev/vgcloud/lvdata
meta-data=/dev/vgcloud/lvdata    isize=512    agcount=8, agsize=65264 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=522112, imaxpct=25
         =                       sunit=16     swidth=16 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

&gt; mount 시킴.
[root@localhost ~]# mkdir /data
[root@localhost ~]# mount /dev/vgcloud/lvdata /data

&gt; 확인
[root@localhost ~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/cl-root          17G  3.9G   14G  23% /
devtmpfs                    2.0G     0  2.0G   0% /dev
tmpfs                       2.0G  144K  2.0G   1% /dev/shm
tmpfs                       2.0G  8.9M  2.0G   1% /run
tmpfs                       2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                  1014M  157M  858M  16% /boot
tmpfs                       396M  4.0K  396M   1% /run/user/42
tmpfs                       396M   12K  396M   1% /run/user/0
/dev/mapper/vgcloud-lvdata  2.0G   33M  2.0G   2% /data



&gt;
[root@localhost ~]# lvs
  LV     VG      Attr       LSize  Pool      Origin         Data%  Meta%  Move Log Cpy%Sync Convert
  root   cl      -wi-ao---- 17.00g                                                                 
  swap   cl      -wi-ao----  2.00g                                                                 
  lvdata vgcloud Cwi-aoC---  1.99g [lvcache] [lvdata_corig] 0.97   1.86            0.00         



&gt; lvs -o 옵션으로 컬럼 지정 가능
&gt; vgcloud의 lvdata에서 다음과 같은 컬럼에 대한 lvs 정보를 출력
[root@localhost ~]# lvs -o cachemode,cache_read_hits,cache_total_blocks vgcloud/lvdata
  CacheMode       CacheReadHits    CacheTotalBlocks
  writethrough              336            16064

[root@localhost ~]# cp /usr/bin/* /data

&gt; HDD에 데이터 쓰기 전에 캐쉬가 사용될 것이므로, cachereadhits 가 늘어남.
[root@localhost ~]# lvs -o cachemode,cache_read_hits,cache_total_blocks vgcloud/lvdata
  CacheMode       CacheReadHits    CacheTotalBlocks
  writethrough              343            16064

=&gt; writethrough (디폴트) 방식이므로, 읽기 성능의 향상.(쓰기 성능은 그대로)

</code></pre>
<h3 id="advanced-lvm--raid-volumes">Advanced LVM : RAID Volumes</h3>
<ul>
<li>하드웨어 적으로 RAID 구현하지 않을 경우, 소프트웨어 적으로 RAID 구현 </li>
</ul>
<h4 id="striping">striping</h4>
<ul>
<li>일을 분담해서 하도록 함.</li>
<li>RAID 0</li>
</ul>
<h4 id="mirroring">mirroring</h4>
<ul>
<li>디스크 이중화 -&gt; 한쪽 디스크가 장애나더라도, 다른 디스크가 수행</li>
<li>최소한 디스크가 2개 붙어있어야 함.</li>
<li>읽기 성능을 향상시킬 수 있다.</li>
<li>RAID 1</li>
</ul>
<h4 id="raid">RAID</h4>
<ul>
<li>RAID 0: striping</li>
<li>RAID 1: mirroring</li>
<li>RAID 3: parity(패리티) 값 저장 <ul>
<li>10이라는 data가 들어왔을 때, parity 값에 저장을 해두어서, 고장난 디스크의 값 (?) 을 다음과 같이, 5+?+2 = 10 연산으로 유추할 수 있도록 함. </li>
<li>parity 값을 저장하는 디스크가 다른 디스크보다 훨씬 읽고 쓰기를 많이 하므로, 고장날 확률이 높아짐. </li>
</ul>
</li>
<li><strong>RAID 5</strong>: 따라서, parity 값도 한 디스크에 저장하지 말고, 여러 디스크에 분산해서 저장하자. (즉, parity 값을 분산해서 저장)<ul>
<li>색칠된 부분이 parity 저장된 곳</li>
</ul>
</li>
<li>RAID 6: double parity (parity 값을 두개 저장)</li>
</ul>
<h4 id="lvm--mirroring">LVM + mirroring</h4>
<pre><code class="language-shell">[root@localhost ~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/cl-root          17G  3.9G   14G  23% /
devtmpfs                    2.0G     0  2.0G   0% /dev
tmpfs                       2.0G  144K  2.0G   1% /dev/shm
tmpfs                       2.0G  8.9M  2.0G   1% /run
tmpfs                       2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1                  1014M  157M  858M  16% /boot
tmpfs                       396M  4.0K  396M   1% /run/user/42
tmpfs                       396M   12K  396M   1% /run/user/0
/dev/mapper/vgcloud-lvdata  2.0G  190M  1.8G  10% /dat럼

[root@localhost ~]# umount /data

[root@localhost ~]# vgremove vgcloud
Do you really want to remove volume group &quot;vgcloud&quot; containing 1 logical volumes? [y/n]: y
Do you really want to remove active logical volume vgcloud/lvdata? [y/n]: y
  Logical volume &quot;lvcache&quot; successfully removed
  Logical volume &quot;lvdata&quot; successfully removed
  Volume group &quot;vgcloud&quot; successfully removed

[root@localhost ~]# pvs
  PV         VG Fmt  Attr PSize  PFree
  /dev/sda      lvm2 ---   1.00g 1.00g
  /dev/sdb      lvm2 ---   1.00g 1.00g
  /dev/sdc      lvm2 ---   1.00g 1.00g
  /dev/vda2  cl lvm2 a--  19.00g    0 

&gt; VG vgtest 생성
[root@localhost ~]# vgcreate vgtest /dev/sda /dev/sdb /dev/sdc
  Volume group &quot;vgtest&quot; successfully created

[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  cl       1   2   0 wz--n- 19.00g    0 
  vgtest   3   0   0 wz--n-  2.99g 2.99g

&gt; -m 1: 미러링 1개
[root@localhost ~]# lvcreate -L 100M -m 1 -n mirror vgtest
  Logical volume &quot;mirror&quot; created.

&gt; Sync부분이 같은거 가지고 있는지 나타내는 클럼
[root@localhost ~]# lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   cl     -wi-ao----  17.00g                                                    
  swap   cl     -wi-ao----   2.00g                                                    
  mirror vgtest rwi-a-r--- 100.00m                                    92.00    
&gt; mapping 정보를 보여달라.  
[root@localhost ~]# lvdisplay -m /dev/vgtest/mirror
  --- Logical volume ---
  LV Path                /dev/vgtest/mirror
  LV Name                mirror
  VG Name                vgtest
  LV UUID                k0qAXT-5Mp9-tJ4Q-kjaO-FTnT-A1Yi-giT6PW
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 15:58:45 +0900
  LV Status              available
  # open                 0
  LV Size                100.00 MiB
  Current LE             25
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:6

  --- Segments ---
  Logical extents 0 to 24:
    Type        raid1
    Monitoring        monitored
    Raid Data LV 0
      Logical volume    mirror_rimage_0
      Logical extents    0 to 24
    Raid Data LV 1
      Logical volume    mirror_rimage_1
      Logical extents    0 to 24
    Raid Metadata LV 0    mirror_rmeta_0
    Raid Metadata LV 1    mirror_rmeta_1


[root@localhost ~]# vgdisplay -v vgtest
  --- Volume group ---
  VG Name               vgtest
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               2.99 GiB
  PE Size               4.00 MiB
  Total PE              765
  Alloc PE / Size       52 / 208.00 MiB
  Free  PE / Size       713 / 2.79 GiB
  VG UUID               g9L7mJ-Jf2i-o1W0-3k07-kTnK-b0Ld-Lt9xB1

  --- Logical volume ---
  LV Path                /dev/vgtest/mirror
  LV Name                mirror
  VG Name                vgtest
  LV UUID                k0qAXT-5Mp9-tJ4Q-kjaO-FTnT-A1Yi-giT6PW
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 15:58:45 +0900
  LV Status              available
  # open                 0
  LV Size                100.00 MiB
  Current LE             25
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:6

  --- Physical volumes ---
  PV Name               /dev/sda     
  PV UUID               6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq
  PV Status             allocatable
  Total PE / Free PE    255 / 229

  PV Name               /dev/sdb     
  PV UUID               52XEkN-oWZY-anS8-W323-oPEd-0rnn-v0IX0O
  PV Status             allocatable
  Total PE / Free PE    255 / 229

  PV Name               /dev/sdc     
  PV UUID               adfL89-v8PF-iNyr-1lLD-1hQA-rf8e-rCZa5g
  PV Status             allocatable
  Total PE / Free PE    255 / 255


[root@localhost ~]# lvremove /dev/vgtest/mirror
Do you really want to remove active logical volume vgtest/mirror? [y/n]: y
  Logical volume &quot;mirror&quot; successfully removed

&gt; 원본과 원본과 관련된 미러링 1개, RAID 1, vgtest라는 VG에서 
[root@localhost ~]# lvcreate -L 400M --type raid1 -m 1 -n lvmirror vgtest
  Logical volume &quot;lvmirror&quot; created.
[root@localhost ~]# vgdisplay -v vgtest
  --- Volume group ---
  VG Name               vgtest
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               2.99 GiB
  PE Size               4.00 MiB
  Total PE              765
  Alloc PE / Size       202 / 808.00 MiB
  Free  PE / Size       563 / 2.20 GiB
  VG UUID               g9L7mJ-Jf2i-o1W0-3k07-kTnK-b0Ld-Lt9xB1

  --- Logical volume ---
  LV Path                /dev/vgtest/lvmirror
  LV Name                lvmirror
  VG Name                vgtest
  LV UUID                n2A6Av-0It6-ExXb-6Ya6-home-z6gV-e0cfi1
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 16:06:10 +0900
  LV Status              available
  # open                 0
  LV Size                400.00 MiB
  Current LE             100
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:6

  --- Physical volumes ---
  PV Name               /dev/sda     
  PV UUID               6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq
  PV Status             allocatable
  Total PE / Free PE    255 / 154       ----- this check!! mirroring

  PV Name               /dev/sdb     
  PV UUID               52XEkN-oWZY-anS8-W323-oPEd-0rnn-v0IX0O
  PV Status             allocatable
  Total PE / Free PE    255 / 154        ----- this check!! mirroring

  PV Name               /dev/sdc     
  PV UUID               adfL89-v8PF-iNyr-1lLD-1hQA-rf8e-rCZa5g
  PV Status             allocatable
  Total PE / Free PE    255 / 255          ----- this check!!not mirroring          

&gt; LVcreate
&gt; 옵션 =&gt; VG이름 :vgtest, --type (raid타입): raid5, -i (디스크 개수): disk 3개, -n (이름): lvraid5
[root@localhost ~]# lvcreate -L 100M --type raid5 -i 3 -n lvraid5 vgtest
  Using default stripesize 64.00 KiB.
  Rounding size 100.00 MiB (25 extents) up to stripe boundary size 108.00 MiB (27 extents).
  Logical volume &quot;lvraid5&quot; created.

&gt; 확인 (각각 10개씩 사용됨을 확인 가능)
[root@localhost ~]# vgdisplay -v vgtest
  --- Volume group ---
  VG Name               vgtest
  System ID             
  Format                lvm2
  Metadata Areas        4
  Metadata Sequence No  10
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                4
  Act PV                4
  VG Size               3.98 GiB
  PE Size               4.00 MiB
  Total PE              1020
  Alloc PE / Size       40 / 160.00 MiB
  Free  PE / Size       980 / 3.83 GiB
  VG UUID               g9L7mJ-Jf2i-o1W0-3k07-kTnK-b0Ld-Lt9xB1

  --- Logical volume ---
  LV Path                /dev/vgtest/lvraid5
  LV Name                lvraid5
  VG Name                vgtest
  LV UUID                wuOc77-d2Ma-Atxh-uRml-3qDw-RA7b-wettbB
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2023-04-17 16:09:32 +0900
  LV Status              available
  # open                 0
  LV Size                108.00 MiB
  Current LE             27
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:15

  --- Physical volumes ---
  PV Name               /dev/sda     
  PV UUID               6vSBrl-LUJi-TyWx-jCH2-T0ND-DqHT-9sRLpq
  PV Status             allocatable
  Total PE / Free PE    255 / 245        -------10개씩 사용되고 있음

  PV Name               /dev/sdb     
  PV UUID               52XEkN-oWZY-anS8-W323-oPEd-0rnn-v0IX0O
  PV Status             allocatable
  Total PE / Free PE    255 / 245        -------10개씩 사용되고 있음

  PV Name               /dev/sdc     
  PV UUID               adfL89-v8PF-iNyr-1lLD-1hQA-rf8e-rCZa5g
  PV Status             allocatable
  Total PE / Free PE    255 / 245        -------10개씩 사용되고 있음

  PV Name               /dev/sdd     
  PV UUID               L48xDo-TZ93-qOQK-QBtt-RDSC-RGQN-kosJ5E
  PV Status             allocatable
  Total PE / Free PE    255 / 245        -------10개씩 사용되고 있음



</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[partitioning disk ]]></title>
            <link>https://velog.io/@yoni_d/partitioning-disk</link>
            <guid>https://velog.io/@yoni_d/partitioning-disk</guid>
            <pubDate>Fri, 14 Apr 2023 08:08:08 GMT</pubDate>
            <description><![CDATA[<h2 id="fdisk--gdisk">fdisk &amp; gdisk</h2>
<h3 id="scsi-type의-1gb-디스크-2개-추가">scsi type의 1GB 디스크 2개 추가</h3>
<p>SATA/SAS/SCSI - /dev/sd__
IDE - /dev/hd__
Virtual Disk - /dev/vd__</p>
<pre><code class="language-shell">@@VM으로 실습
&gt; scsi type의 1GB 디스크 2개 추가
[root@localhost etc]# lsblk
NAME        MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda           8:0    0   1G  0 disk                 -- this one!!
sdb           8:16   0   1G  0 disk                 -- this one!!
vda         252:0    0  20G  0 disk 
├─vda1      252:1    0   1G  0 part /boot
└─vda2      252:2    0  19G  0 part 
  ├─cl-root 253:0    0  17G  0 lvm  /
  └─cl-swap 253:1    0   2G  0 lvm  [SWAP]


</code></pre>
<h3 id="fdisk">fdisk</h3>
<h4 id="partition-type">partition type</h4>
<ul>
<li>primary (0 primary, 0 extended, 4 free) partition</li>
<li>extended partition =&gt; logical partition 생성</li>
</ul>
<pre><code class="language-shell">[root@localhost etc]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x280ab957.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition&#39;s system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-2097151, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +300M
Partition 1 of type Linux and of size 300 MiB is set

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      616447      307200   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (616448-2097151, default 616448): 
Using default value 616448
Last sector, +sectors or +size{K,M,G} (616448-2097151, default 2097151): +400M
Partition 2 of type Linux and of size 400 MiB is set

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      616447      307200   83  Linux
/dev/sda2          616448     1435647      409600   83  Linux

Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 is deleted

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      616447      307200   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (2-4, default 2): 2
First sector (616448-2097151, default 616448): 
Using default value 616448
Last sector, +sectors or +size{K,M,G} (616448-2097151, default 2097151): 
Using default value 2097151
Partition 2 of type Extended and of size 723 MiB is set

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      616447      307200   83  Linux
/dev/sda2          616448     2097151      740352    5  Extended

Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (618496-2097151, default 618496): 
Using default value 618496
Last sector, +sectors or +size{K,M,G} (618496-2097151, default 2097151): +200M
Partition 5 of type Linux and of size 200 MiB is set

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      616447      307200   83  Linux
/dev/sda2          616448     2097151      740352    5  Extended
/dev/sda5          618496     1028095      204800   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 6
First sector (1030144-2097151, default 1030144): 
Using default value 1030144
Last sector, +sectors or +size{K,M,G} (1030144-2097151, default 2097151): +400M
Partition 6 of type Linux and of size 400 MiB is set

Command (m for help): p

Disk /dev/sda: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x280ab957

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048      616447      307200   83  Linux
/dev/sda2          616448     2097151      740352    5  Extended
/dev/sda5          618496     1028095      204800   83  Linux
/dev/sda6         1030144     1849343      409600   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


&gt; lsblk 로 파티션 생성됨을 확인
[root@localhost etc]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0    1G  0 disk 
├─sda1        8:1    0  300M  0 part 
├─sda2        8:2    0    1K  0 part 
├─sda5        8:5    0  200M  0 part 
└─sda6        8:6    0  400M  0 part 
sdb           8:16   0    1G  0 disk 
vda         252:0    0   20G  0 disk 
├─vda1      252:1    0    1G  0 part /boot
└─vda2      252:2    0   19G  0 part 
  ├─cl-root 253:0    0   17G  0 lvm  /
  └─cl-swap 253:1    0    2G  0 lvm  [SWAP]

</code></pre>
<h3 id="parted">parted</h3>
<pre><code class="language-shell">[root@localhost etc]# gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): ?
b    back up GPT data to a file
c    change a partition&#39;s name
d    delete a partition
i    show detailed information on a partition
l    list known partition types
n    add a new partition
o    create a new empty GUID partition table (GPT)
p    print the partition table
q    quit without saving changes
r    recovery and transformation options (experts only)
s    sort partitions
t    change a partition&#39;s type code
v    verify disk
w    write table to disk and exit
x    extra functionality (experts only)
?    print this menu

Command (? for help): q
[root@localhost etc]# clear

[root@localhost etc]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type &#39;help&#39; to view a list of commands.
(parted) help                                                             
  align-check TYPE N                        check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found
        partitions, or a particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU Parted
(parted) p                                                                
Error: /dev/sdb: unrecognised disk label
Model: QEMU QEMU HARDDISK (scsi)                                          
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 
(parted) mkpart                                                           
Error: /dev/sdb: unrecognised disk label
(parted) mkpart primary 0% 300M
Error: /dev/sdb: unrecognised disk label
(parted) mklabel msdos
(parted) p                                                                
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End  Size  Type  File system  Flags

(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you
want to continue?
Yes/No? yes                                                               
(parted) p                                                                
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 301M 100%                                         
(parted) p                                                                
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End     Size   File system  Name     Flags
 1      301MB  1073MB  772MB               primary

(parted) mkpart primary 0% 300M
(parted) p
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size   File system  Name     Flags
 2      1049kB  300MB   299MB               primary
 1      301MB   1073MB  772MB               primary

(parted) rm 1                                                             
(parted) p                                                                
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name     Flags
 2      1049kB  300MB  299MB               primary

(parted) q                                                                
Information: You may need to update /etc/fstab.

[root@localhost etc]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0    1G  0 disk 
├─sda1        8:1    0  300M  0 part 
├─sda2        8:2    0    1K  0 part 
├─sda5        8:5    0  200M  0 part 
└─sda6        8:6    0  400M  0 part 
sdb           8:16   0    1G  0 disk 
└─sdb2        8:18   0  285M  0 part 
vda         252:0    0   20G  0 disk 
├─vda1      252:1    0    1G  0 part /boot
└─vda2      252:2    0   19G  0 part 
  ├─cl-root 253:0    0   17G  0 lvm  /
  └─cl-swap 253:1    0    2G  0 lvm  [SWAP]
[root@localhost etc]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1                                                               
├─sda2                                                               
├─sda5                                                               
└─sda6                                                               
sdb                                                                  
└─sdb2                                                               
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]
[root@localhost etc]# mkfs -t xfs /dev/sda1
meta-data=/dev/sda1              isize=512    agcount=4, agsize=19200 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=76800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost etc]# mkfs -t ext4 /dev/sda5
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
51200 inodes, 204800 blocks
10240 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33816576
25 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
    8193, 24577, 40961, 57345, 73729

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@localhost etc]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      xfs               243550a7-03de-42be-a6f4-726a8ea2a6ce   
├─sda2                                                               
├─sda5      ext4              571a7ee6-2340-4337-8741-10aae94af0fb   
└─sda6                                                               
sdb                                                                  
└─sdb2                                                               
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]</code></pre>
<h3 id="mount">mount</h3>
<pre><code class="language-shell">[root@localhost etc]# mkdir /white /black
[root@localhost etc]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0    1G  0 disk 
├─sda1        8:1    0  300M  0 part 
├─sda2        8:2    0    1K  0 part 
├─sda5        8:5    0  200M  0 part 
└─sda6        8:6    0  400M  0 part 
sdb           8:16   0    1G  0 disk 
└─sdb2        8:18   0  285M  0 part 
vda         252:0    0   20G  0 disk 
├─vda1      252:1    0    1G  0 part /boot
└─vda2      252:2    0   19G  0 part 
  ├─cl-root 253:0    0   17G  0 lvm  /
  └─cl-swap 253:1    0    2G  0 lvm  [SWAP]
[root@localhost etc]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      xfs               243550a7-03de-42be-a6f4-726a8ea2a6ce   
├─sda2                                                               
├─sda5      ext4              571a7ee6-2340-4337-8741-10aae94af0fb   
└─sda6                                                               
sdb                                                                  
└─sdb2                                                               
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]
[root@localhost etc]# mount /dev/sda1 /white
[root@localhost etc]# mount /dev/sda5 /black

[root@localhost etc]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      xfs               243550a7-03de-42be-a6f4-726a8ea2a6ce   /white
├─sda2                                                               
├─sda5      ext4              571a7ee6-2340-4337-8741-10aae94af0fb   /black
└─sda6                                                               
sdb                                                                  
└─sdb2                                                               
vda                                                                  
├─vda1      xfs               0cab009d-2c67-4dc9-a881-c5efde97ed56   /boot
└─vda2      LVM2_member       CFDwnt-NM58-A0Gj-sTQy-iCPE-EsRc-iqIAyb 
  ├─cl-root xfs               999a2a08-42a2-4cbc-a52c-3544d87d2897   /
  └─cl-swap swap              faab5b3c-984a-4a82-a139-92d1b706f013   [SWAP]

&gt; lsblk -f와 동일하게 확인 가능
[root@localhost etc]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  4.7G   13G  28% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  9.0M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   20K  396M   1% /run/user/0
tmpfs                396M     0  396M   0% /run/user/1001
tmpfs                396M     0  396M   0% /run/user/1000
/dev/sda1            297M   16M  282M   6% /white
/dev/sda5            190M  1.6M  175M   1% /black




[root@localhost etc]# vi /etc/fstab
  #
  # /etc/fstab
  # Created by anaconda on Thu Apr 13 10:19:58 2023
  #
  # Accessible filesystems, by reference, are maintained under &#39;/dev/disk&#39;
  # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
  #
  /dev/mapper/cl-root     /                       xfs     defaults        0 0
  UUID=0cab009d-2c67-4dc9-a881-c5efde97ed56 /boot                   xfs     defaults        0 0
  /dev/mapper/cl-swap     swap                    swap    defaults        0 0
  /dev/sda1               /white                  xfs     defaults        0 0
  /dev/sda5               /black                  ext4    defaults        0 1
  ~                                                                               
~                                                                               
~            
[root@localhost etc]# mount -a 
[root@localhost etc]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  4.7G   13G  28% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  144K  2.0G   1% /dev/shm
tmpfs                2.0G  9.0M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
tmpfs                396M  4.0K  396M   1% /run/user/42
tmpfs                396M   20K  396M   1% /run/user/0
tmpfs                396M     0  396M   0% /run/user/1001
tmpfs                396M     0  396M   0% /run/user/1000
/dev/sda1            297M   16M  282M   6% /white
/dev/sda5            190M  1.6M  175M   1% /black


[root@localhost ~]# reboot

[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  4.7G   13G  28% /
devtmpfs             2.0G     0  2.0G   0% /dev
tmpfs                2.0G  160K  2.0G   1% /dev/shm
tmpfs                2.0G  8.9M  2.0G   1% /run
tmpfs                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
/dev/sda1            297M   16M  282M   6% /white
/dev/sda5            190M  1.6M  175M   1% /black
tmpfs                396M  8.0K  396M   1% /run/user/42
tmpfs                396M   12K  396M   1% /run/user/0

</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[Install and Update software package]]></title>
            <link>https://velog.io/@yoni_d/Install-and-Update-software-package</link>
            <guid>https://velog.io/@yoni_d/Install-and-Update-software-package</guid>
            <pubDate>Fri, 14 Apr 2023 05:06:13 GMT</pubDate>
            <description><![CDATA[<h2 id="linux-pakaging">Linux Pakaging</h2>
<ul>
<li>Red Hat Package Manager : RPM</li>
<li>Debian (ubuntu) dpkg</li>
</ul>
<h2 id="rpm">RPM</h2>
<h3 id="features">features</h3>
<ul>
<li>Dependency tracking: 의존성을 tracking </li>
<li>installed file tracking</li>
</ul>
<h3 id="options">options</h3>
<ul>
<li>rpm -i : installing</li>
<li>-V 패키지명</li>
<li>-Uvh 이름.rpm : installing + Upgrading   (vh -&gt; 설치 과정을 화면에 표시)</li>
<li>-e 패키지명 : 삭제</li>
<li>-ql 패키지명 :</li>
<li>-qf 파일의절대경로 : 파일의 절대경로로 설치</li>
<li>--nodeps : 삭제할 때 의존성 관계 갖고 있는 패키지 중에 특정것만 삭제하겠다.</li>
<li>--force : 강제로 설치</li>
</ul>
<h3 id="단점">단점</h3>
<p>rpm dependency(의존성)에 대한 문제는 알려만 주고, 처리는 사용자가 알아서 해야 함.
=&gt; 이러한 단점을 보완하여 나온 것이 <strong>yum</strong> ! </p>
<h3 id="wget-install-rpm">wget, install rpm</h3>
<pre><code class="language-shell">[root@station14 ~]# wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/amanda-3.3.3-22.el7.x86_64.rpm
--2023-04-14 14:01:11--  http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/amanda-3.3.3-22.el7.x86_64.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 129760 (127K) [application/x-rpm]
Saving to: ‘amanda-3.3.3-22.el7.x86_64.rpm’

100%[==============================================================&gt;] 129,760      140KB/s   in 0.9s   

2023-04-14 14:01:13 (140 KB/s) - ‘amanda-3.3.3-22.el7.x86_64.rpm’ saved [129760/129760]

[root@station14 ~]# wget http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/zsh-5.0.2-34.el7_8.2.x86_64.rpm
--2023-04-14 14:01:28--  http://rpmfind.net/linux/centos/7.9.2009/os/x86_64/Packages/zsh-5.0.2-34.el7_8.2.x86_64.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2497380 (2.4M) [application/x-rpm]
Saving to: ‘zsh-5.0.2-34.el7_8.2.x86_64.rpm’

100%[==============================================================&gt;] 2,497,380    468KB/s   in 5.7s   

2023-04-14 14:01:34 (425 KB/s) - ‘zsh-5.0.2-34.el7_8.2.x86_64.rpm’ saved [2497380/2497380]

&gt; zshll 설치
[root@station14 ~]# rpm -Uvh zsh-5.0.2-34.el7_8.2.x86_64.rpm 
warning: zsh-5.0.2-34.el7_8.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zsh-5.0.2-34.el7_8.2             ################################# [100%]

&gt; amanda 설치
[root@station14 ~]# rpm -Uvh amanda-3.3.3-22.el7.x86_64.rpm 
warning: amanda-3.3.3-22.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
    amanda-libs(x86-64) = 3.3.3-22.el7 is needed by amanda-3.3.3-22.el7.x86_64
    libamanda-3.3.3.so()(64bit) is needed by amanda-3.3.3-22.el7.x86_64
    libamar-3.3.3.so()(64bit) is needed by amanda-3.3.3-22.el7.x86_64
    perl(Amanda::Config) is needed by amanda-3.3.3-22.el7.x86_64
    perl(Amanda::Constants) is needed by amanda-3.3.3-22.el7.x86_64
    perl(Amanda::Debug) is needed by amanda-3.3.3-22.el7.x86_64
    perl(Amanda::Paths) is needed by amanda-3.3.3-22.el7.x86_64
    perl(Amanda::Util) is needed by amanda-3.3.3-22.el7.x86_64
&gt; amanda와 같이 의존성 문제 있는 경우, 설치 불가 -- rpm 명령어의 최대 단점
</code></pre>
<h3 id="rpm-강제-재설치--force">rpm 강제 재설치(--force)</h3>
<pre><code class="language-shell">[root@station14 ~]# rpm -Uvh zsh-5.0.2-34.el7_8.2.x86_64.rpm 
warning: zsh-5.0.2-34.el7_8.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
    package zsh-5.0.2-34.el7_8.2.x86_64 is already installed

&gt; --force 옵션
[root@station14 ~]# rpm -Uvh --force zsh-5.0.2-34.el7_8.2.x86_64.rpm 
warning: zsh-5.0.2-34.el7_8.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zsh-5.0.2-34.el7_8.2             ################################# [100%]
</code></pre>
<h3 id="rpm--qf">rpm -qf</h3>
<pre><code class="language-shell">
&gt; ls 절대 경로 알아내기
[root@station14 ~]# which ls
alias ls=&#39;ls --color=auto&#39;
    /bin/ls

&gt;파일의 절대경로로 설치
[root@station14 ~]# rpm -qf /bin/ls
coreutils-8.22-18.el7.x86_64

</code></pre>
<h3 id="rpm--e--삭제">rpm -e : 삭제</h3>
<pre><code class="language-shell">[root@station14 ~]# rpm -e zsh
[root@station14 ~]# rpm -qa | grep zsh
</code></pre>
<h2 id="yum">yum</h2>
<h3 id="option">option</h3>
<ul>
<li>yum search 이름 : 해당 이름 들어간 패키지 출력</li>
<li>yum install</li>
<li>yum remove</li>
<li>yum reposit</li>
<li>yum clean all</li>
<li>yum grouplist</li>
<li>yum groupinstall</li>
<li>yum history</li>
</ul>
<h3 id="yum-search--install">yum search , install</h3>
<pre><code class="language-shell">[root@station14 ~]# yum search aman
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
========================================== N/S matched: aman ===========================================
amanda-client.x86_64 : The client component of the AMANDA tape backup system
amanda-libs.x86_64 : Amanda libraries
amanda-server.x86_64 : The server side of the AMANDA tape backup system
amanda.x86_64 : A network-capable tape backup solution

  Name and summary matches only, use &quot;search all&quot; for everything.


[root@station14 ~]# yum install amanda
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package amanda.x86_64 0:3.3.3-17.el7 will be installed
--&gt; Processing Dependency: amanda-libs(x86-64) = 3.3.3-17.el7 for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: perl(Amanda::Util) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: perl(Amanda::Paths) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: perl(Amanda::Debug) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: perl(Amanda::Constants) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: perl(Amanda::Config) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: libamar-3.3.3.so()(64bit) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Processing Dependency: libamanda-3.3.3.so()(64bit) for package: amanda-3.3.3-17.el7.x86_64
--&gt; Running transaction check
---&gt; Package amanda-libs.x86_64 0:3.3.3-17.el7 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package                    Arch                  Version                     Repository           Size
========================================================================================================
Installing:
 amanda                     x86_64                3.3.3-17.el7                base                125 k
Installing for dependencies:
 amanda-libs                x86_64                3.3.3-17.el7                base                1.3 M

Transaction Summary
========================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 1.4 M
Installed size: 4.7 M
Is this ok [y/d/N]: y
Downloading packages:
--------------------------------------------------------------------------------------------------------
Total                                                                   5.2 MB/s | 1.4 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : amanda-libs-3.3.3-17.el7.x86_64                                                      1/2 
  Installing : amanda-3.3.3-17.el7.x86_64                                                           2/2 
  Verifying  : amanda-3.3.3-17.el7.x86_64                                                           1/2 
  Verifying  : amanda-libs-3.3.3-17.el7.x86_64                                                      2/2 

Installed:
  amanda.x86_64 0:3.3.3-17.el7                                                                          

Dependency Installed:
  amanda-libs.x86_64 0:3.3.3-17.el7                                                                     

Complete!
[root@station14 ~]# rpm -qa | grep aman
amanda-libs-3.3.3-17.el7.x86_64
amanda-3.3.3-17.el7.x86_64
</code></pre>
<h3 id="rpm-repolist-rpm-repository-목록">rpm repolist: rpm repository 목록</h3>
<pre><code class="language-shell">[root@station14 ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                         repo name                                         status
base                                            CentOS 7 - x86_64 - base                          3,831
classRPMs                                       Custom Guru Labs Classroom RPMs                     196
errataRPMs                                      CentOS 7 - Server - x86_64 - Errata                 291
mysql-connectors-community/x86_64               MySQL Connectors Community                          213
mysql-tools-community/x86_64                    MySQL Tools Community                                96
mysql80-community/x86_64                        MySQL 8.0 Community Server                          386
repolist: 5,013</code></pre>
<h3 id="rpm-clean-all--rpm-repository에-캐싱된-기존-오래된-정보를-비움">rpm clean all : rpm repository에 캐싱된 기존 오래된 정보를 비움</h3>
<pre><code class="language-shell">[root@station14 ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base classRPMs errataRPMs mysql-connectors-community mysql-tools-community
              : mysql80-community
Cleaning up everything
Cleaning up list of fastest mirrors


&gt; clean up 후 repolist
[root@station14 ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
base                                                                             | 3.6 kB  00:00:00     
classRPMs                                                                        | 2.5 kB  00:00:00     
errataRPMs                                                                       | 2.5 kB  00:00:00     
mysql-connectors-community                                                       | 2.6 kB  00:00:00     
mysql-tools-community                                                            | 2.6 kB  00:00:00     
mysql80-community                                                                | 2.6 kB  00:00:00     
(1/7): mysql-connectors-community/x86_64/primary_db                              |  96 kB  00:00:00     
(2/7): mysql-tools-community/x86_64/primary_db                                   |  91 kB  00:00:00     
(3/7): mysql80-community/x86_64/primary_db                                       | 231 kB  00:00:00     
(4/7): base/group_gz                                                             | 155 kB  00:00:00     
(5/7): base/primary_db                                                           | 3.0 MB  00:00:00     
(6/7): errataRPMs/primary_db                                                     | 689 kB  00:00:00     
(7/7): classRPMs/primary_db                                                      | 143 kB  00:00:00     
Determining fastest mirrors
repo id                                         repo name                                         status
base                                            CentOS 7 - x86_64 - base                          3,831
classRPMs                                       Custom Guru Labs Classroom RPMs                     196
errataRPMs                                      CentOS 7 - Server - x86_64 - Errata                 291
mysql-connectors-community/x86_64               MySQL Connectors Community                          213
mysql-tools-community/x86_64                    MySQL Tools Community                                96
mysql80-community/x86_64                        MySQL 8.0 Community Server                          386
repolist: 5,013


&gt; 캐싱 된 repolist
[root@station14 ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                         repo name                                         status
base                                            CentOS 7 - x86_64 - base                          3,831
classRPMs                                       Custom Guru Labs Classroom RPMs                     196
errataRPMs                                      CentOS 7 - Server - x86_64 - Errata                 291
mysql-connectors-community/x86_64               MySQL Connectors Community                          213
mysql-tools-community/x86_64                    MySQL Tools Community                                96
mysql80-community/x86_64                        MySQL 8.0 Community Server                          386
repolist: 5,013
</code></pre>
<h3 id="grouplist-groupinstall">grouplist, groupinstall</h3>
<pre><code class="language-shell">&gt; 패키지 그룹 list 확인
[root@station14 ~]# yum grouplist
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server  --이 그룹을 설치해보자!!
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
Done

&gt; 확인한 패키지 그룹 File and Print Server 설치
[root@station14 ~]# yum groupinstall &#39;File and Print Server&#39;
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Warning: Group base does not have any packages to install.
Group base does have 1 conditional packages, which may get installed.
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package foomatic.x86_64 0:4.0.9-8.el7 will be installed
--&gt; Processing Dependency: foomatic-db for package: foomatic-4.0.9-8.el7.x86_64
---&gt; Package foomatic-filters.x86_64 0:4.0.9-8.el7 will be installed
---&gt; Package iprutils.x86_64 0:2.4.13.1-1.el7 will be installed
--&gt; Processing Dependency: lsscsi for package: iprutils-2.4.13.1-1.el7.x86_64
---&gt; Package samba.x86_64 0:4.4.4-14.el7_3 will be installed
--&gt; Processing Dependency: samba-libs = 4.4.4-14.el7_3 for package: samba-4.4.4-14.el7_3.x86_64
--&gt; Processing Dependency: samba-common-tools = 4.4.4-14.el7_3 for package: samba-4.4.4-14.el7_3.x86_64
--&gt; Processing Dependency: libxattr-tdb-samba4.so(SAMBA_4.4.4)(64bit) for package: samba-4.4.4-14.el7_3.x86_64
--&gt; Processing Dependency: libxattr-tdb-samba4.so()(64bit) for package: samba-4.4.4-14.el7_3.x86_64
---&gt; Package targetd.noarch 0:0.7.1-1.el7 will be installed
--&gt; Processing Dependency: lvm2-python-libs &gt;= 2.02.99 for package: targetd-0.7.1-1.el7.noarch
--&gt; Processing Dependency: python-setproctitle for package: targetd-0.7.1-1.el7.noarch
--&gt; Processing Dependency: PyYAML for package: targetd-0.7.1-1.el7.noarch
--&gt; Running transaction check
---&gt; Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--&gt; Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---&gt; Package foomatic-db.noarch 0:4.0-40.20130911.el7 will be installed
--&gt; Processing Dependency: foomatic-db-ppds = 4.0-40.20130911.el7 for package: foomatic-db-4.0-40.20130911.el7.noarch
--&gt; Processing Dependency: foomatic-db-filesystem = 4.0-40.20130911.el7 for package: foomatic-db-4.0-40.20130911.el7.noarch
---&gt; Package lsscsi.x86_64 0:0.27-4.el7 will be installed
---&gt; Package lvm2-python-libs.x86_64 7:2.02.166-1.el7_3.5 will be installed
---&gt; Package python-setproctitle.x86_64 0:1.1.6-5.el7 will be installed
---&gt; Package samba-common-tools.x86_64 0:4.4.4-14.el7_3 will be installed
---&gt; Package samba-libs.x86_64 0:4.4.4-14.el7_3 will be installed
--&gt; Processing Dependency: libpytalloc-util.so.2(PYTALLOC_UTIL_2.1.6)(64bit) for package: samba-libs-4.4.4-14.el7_3.x86_64
--&gt; Processing Dependency: libpytalloc-util.so.2(PYTALLOC_UTIL_2.0.6)(64bit) for package: samba-libs-4.4.4-14.el7_3.x86_64
--&gt; Processing Dependency: libpytalloc-util.so.2()(64bit) for package: samba-libs-4.4.4-14.el7_3.x86_64
--&gt; Running transaction check
---&gt; Package foomatic-db-filesystem.noarch 0:4.0-40.20130911.el7 will be installed
---&gt; Package foomatic-db-ppds.noarch 0:4.0-40.20130911.el7 will be installed
---&gt; Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---&gt; Package pytalloc.x86_64 0:2.1.6-1.el7 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package                          Arch             Version                         Repository      Size
========================================================================================================
Installing for group install &quot;Core&quot;:
 iprutils                         x86_64           2.4.13.1-1.el7                  base           243 k
Installing for group install &quot;File and Storage Server&quot;:
 samba                            x86_64           4.4.4-14.el7_3                  base           610 k
 targetd                          noarch           0.7.1-1.el7                     base            49 k
Installing for group install &quot;Print Server&quot;:
 foomatic                         x86_64           4.0.9-8.el7                     base           253 k
 foomatic-filters                 x86_64           4.0.9-8.el7                     base            98 k
Installing for dependencies:
 PyYAML                           x86_64           3.10-11.el7                     base           153 k
 foomatic-db                      noarch           4.0-40.20130911.el7             base           1.0 M
 foomatic-db-filesystem           noarch           4.0-40.20130911.el7             base           9.1 k
 foomatic-db-ppds                 noarch           4.0-40.20130911.el7             base            29 M
 libyaml                          x86_64           0.1.4-11.el7_0                  base            55 k
 lsscsi                           x86_64           0.27-4.el7                      base            47 k
 lvm2-python-libs                 x86_64           7:2.02.166-1.el7_3.5            base           174 k
 pytalloc                         x86_64           2.1.6-1.el7                     base            15 k
 python-setproctitle              x86_64           1.1.6-5.el7                     base            15 k
 samba-common-tools               x86_64           4.4.4-14.el7_3                  base           451 k
 samba-libs                       x86_64           4.4.4-14.el7_3                  base           260 k

Transaction Summary
========================================================================================================
Install  5 Packages (+11 Dependent packages)

Total download size: 32 M
Installed size: 48 M
Is this ok [y/d/N]: y
Downloading packages:
--------------------------------------------------------------------------------------------------------
Total                                                                   9.8 MB/s |  32 MB  00:00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : foomatic-db-filesystem-4.0-40.20130911.el7.noarch                                   1/16 
  Installing : foomatic-db-ppds-4.0-40.20130911.el7.noarch                                         2/16 
  Installing : foomatic-db-4.0-40.20130911.el7.noarch                                              3/16 
  Installing : foomatic-filters-4.0.9-8.el7.x86_64                                                 4/16 
  Installing : pytalloc-2.1.6-1.el7.x86_64                                                         5/16 
  Installing : samba-libs-4.4.4-14.el7_3.x86_64                                                    6/16 
  Installing : samba-common-tools-4.4.4-14.el7_3.x86_64                                            7/16 
  Installing : 7:lvm2-python-libs-2.02.166-1.el7_3.5.x86_64                                        8/16 
  Installing : python-setproctitle-1.1.6-5.el7.x86_64                                              9/16 
  Installing : libyaml-0.1.4-11.el7_0.x86_64                                                      10/16 
  Installing : PyYAML-3.10-11.el7.x86_64                                                          11/16 
  Installing : lsscsi-0.27-4.el7.x86_64                                                           12/16 
  Installing : iprutils-2.4.13.1-1.el7.x86_64                                                     13/16 
  Installing : targetd-0.7.1-1.el7.noarch                                                         14/16 
  Installing : samba-4.4.4-14.el7_3.x86_64                                                        15/16 
  Installing : foomatic-4.0.9-8.el7.x86_64                                                        16/16 
  Verifying  : lsscsi-0.27-4.el7.x86_64                                                            1/16 
  Verifying  : libyaml-0.1.4-11.el7_0.x86_64                                                       2/16 
  Verifying  : python-setproctitle-1.1.6-5.el7.x86_64                                              3/16 
  Verifying  : foomatic-4.0.9-8.el7.x86_64                                                         4/16 
  Verifying  : samba-4.4.4-14.el7_3.x86_64                                                         5/16 
  Verifying  : foomatic-db-ppds-4.0-40.20130911.el7.noarch                                         6/16 
  Verifying  : 7:lvm2-python-libs-2.02.166-1.el7_3.5.x86_64                                        7/16 
  Verifying  : iprutils-2.4.13.1-1.el7.x86_64                                                      8/16 
  Verifying  : pytalloc-2.1.6-1.el7.x86_64                                                         9/16 
  Verifying  : foomatic-db-4.0-40.20130911.el7.noarch                                             10/16 
  Verifying  : foomatic-db-filesystem-4.0-40.20130911.el7.noarch                                  11/16 
  Verifying  : samba-libs-4.4.4-14.el7_3.x86_64                                                   12/16 
  Verifying  : samba-common-tools-4.4.4-14.el7_3.x86_64                                           13/16 
  Verifying  : targetd-0.7.1-1.el7.noarch                                                         14/16 
  Verifying  : PyYAML-3.10-11.el7.x86_64                                                          15/16 
  Verifying  : foomatic-filters-4.0.9-8.el7.x86_64                                                16/16 

Installed:
  foomatic.x86_64 0:4.0.9-8.el7 foomatic-filters.x86_64 0:4.0.9-8.el7 iprutils.x86_64 0:2.4.13.1-1.el7
  samba.x86_64 0:4.4.4-14.el7_3 targetd.noarch 0:0.7.1-1.el7         

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7                           foomatic-db.noarch 0:4.0-40.20130911.el7       
  foomatic-db-filesystem.noarch 0:4.0-40.20130911.el7   foomatic-db-ppds.noarch 0:4.0-40.20130911.el7  
  libyaml.x86_64 0:0.1.4-11.el7_0                       lsscsi.x86_64 0:0.27-4.el7                     
  lvm2-python-libs.x86_64 7:2.02.166-1.el7_3.5          pytalloc.x86_64 0:2.1.6-1.el7                  
  python-setproctitle.x86_64 0:1.1.6-5.el7              samba-common-tools.x86_64 0:4.4.4-14.el7_3     
  samba-libs.x86_64 0:4.4.4-14.el7_3                   

Complete!


</code></pre>
<h3 id="yum-history">yum history</h3>
<pre><code class="language-shell">[root@station14 ~]# yum history
Loaded plugins: fastestmirror, langpacks
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | root &lt;root&gt;              | 2023-04-14 14:54 | Install        |   16   
     8 | root &lt;root&gt;              | 2023-04-14 14:42 | Install        |    2   
     7 | root &lt;root&gt;              | 2023-04-14 09:53 | Install        |    8   
     6 | root &lt;root&gt;              | 2023-04-13 09:47 | Install        |   44   
     5 | root &lt;root&gt;              | 2023-04-12 17:14 | Install        |    2   
     4 | root &lt;root&gt;              | 2023-04-12 16:40 | Install        |    4   
     3 | root &lt;root&gt;              | 2023-04-10 15:29 | I, O           |    5 ss
     2 | System &lt;unset&gt;           | 2023-04-10 15:08 | Install        |    1  &lt;
     1 | System &lt;unset&gt;           | 2023-04-08 05:23 | Install        | 1362 &gt; 
history list

&gt; history 자세하게 확인
[root@station14 ~]# yum history info 9
Loaded plugins: fastestmirror, langpacks
Transaction ID : 9
Begin time     : Fri Apr 14 14:54:52 2023
Begin rpmdb    : 1430:8069e658c3e5ed87a4cb52acd618d16d7e43b51f
End time       :            14:55:09 2023 (17 seconds)
End rpmdb      : 1446:ebf5be8424b9ecd1d61bfc5bff2dc3e8e91fd9ad
User           : root &lt;root&gt;
Return-Code    : Success
Command Line   : groupinstall File and Print Server
Transaction performed with:
    Installed     rpm-4.11.3-21.el7.x86_64                      @anaconda
    Installed     yum-3.4.3-150.el7.centos.noarch               @anaconda
    Installed     yum-plugin-fastestmirror-1.1.31-40.el7.noarch @anaconda
Packages Altered:
    Dep-Install PyYAML-3.10-11.el7.x86_64                         @base
    Install     foomatic-4.0.9-8.el7.x86_64                       @base
    Dep-Install foomatic-db-4.0-40.20130911.el7.noarch            @base
    Dep-Install foomatic-db-filesystem-4.0-40.20130911.el7.noarch @base
    Dep-Install foomatic-db-ppds-4.0-40.20130911.el7.noarch       @base
    Install     foomatic-filters-4.0.9-8.el7.x86_64               @base
    Install     iprutils-2.4.13.1-1.el7.x86_64                    @base
    Dep-Install libyaml-0.1.4-11.el7_0.x86_64                     @base
    Dep-Install lsscsi-0.27-4.el7.x86_64                          @base
    Dep-Install lvm2-python-libs-7:2.02.166-1.el7_3.5.x86_64      @base
    Dep-Install pytalloc-2.1.6-1.el7.x86_64                       @base
    Dep-Install python-setproctitle-1.1.6-5.el7.x86_64            @base
    Install     samba-4.4.4-14.el7_3.x86_64                       @base
    Dep-Install samba-common-tools-4.4.4-14.el7_3.x86_64          @base
    Dep-Install samba-libs-4.4.4-14.el7_3.x86_64                  @base
    Install     targetd-0.7.1-1.el7.noarch                        @base
history info


&gt; history undo 되돌리는 기능

[root@station14 ~]# yum history undo 9
Loaded plugins: fastestmirror, langpacks
Undoing transaction 9, from Fri Apr 14 14:54:52 2023
    Dep-Install PyYAML-3.10-11.el7.x86_64                         @base
    Install     foomatic-4.0.9-8.el7.x86_64                       @base
    Dep-Install foomatic-db-4.0-40.20130911.el7.noarch            @base
    Dep-Install foomatic-db-filesystem-4.0-40.20130911.el7.noarch @base
    Dep-Install foomatic-db-ppds-4.0-40.20130911.el7.noarch       @base
    Install     foomatic-filters-4.0.9-8.el7.x86_64               @base
    Install     iprutils-2.4.13.1-1.el7.x86_64                    @base
    Dep-Install libyaml-0.1.4-11.el7_0.x86_64                     @base
    Dep-Install lsscsi-0.27-4.el7.x86_64                          @base
    Dep-Install lvm2-python-libs-7:2.02.166-1.el7_3.5.x86_64      @base
    Dep-Install pytalloc-2.1.6-1.el7.x86_64                       @base
    Dep-Install python-setproctitle-1.1.6-5.el7.x86_64            @base
    Install     samba-4.4.4-14.el7_3.x86_64                       @base
    Dep-Install samba-common-tools-4.4.4-14.el7_3.x86_64          @base
    Dep-Install samba-libs-4.4.4-14.el7_3.x86_64                  @base
    Install     targetd-0.7.1-1.el7.noarch                        @base
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package PyYAML.x86_64 0:3.10-11.el7 will be erased
---&gt; Package foomatic.x86_64 0:4.0.9-8.el7 will be erased
---&gt; Package foomatic-db.noarch 0:4.0-40.20130911.el7 will be erased
---&gt; Package foomatic-db-filesystem.noarch 0:4.0-40.20130911.el7 will be erased
---&gt; Package foomatic-db-ppds.noarch 0:4.0-40.20130911.el7 will be erased
---&gt; Package foomatic-filters.x86_64 0:4.0.9-8.el7 will be erased
---&gt; Package iprutils.x86_64 0:2.4.13.1-1.el7 will be erased
---&gt; Package libyaml.x86_64 0:0.1.4-11.el7_0 will be erased
---&gt; Package lsscsi.x86_64 0:0.27-4.el7 will be erased
---&gt; Package lvm2-python-libs.x86_64 7:2.02.166-1.el7_3.5 will be erased
---&gt; Package pytalloc.x86_64 0:2.1.6-1.el7 will be erased
---&gt; Package python-setproctitle.x86_64 0:1.1.6-5.el7 will be erased
---&gt; Package samba.x86_64 0:4.4.4-14.el7_3 will be erased
---&gt; Package samba-common-tools.x86_64 0:4.4.4-14.el7_3 will be erased
---&gt; Package samba-libs.x86_64 0:4.4.4-14.el7_3 will be erased
---&gt; Package targetd.noarch 0:0.7.1-1.el7 will be erased
--&gt; Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                         Arch            Version                       Repository      Size
====================================================================================================
Removing:
 PyYAML                          x86_64          3.10-11.el7                   @base          630 k
 foomatic                        x86_64          4.0.9-8.el7                   @base          633 k
 foomatic-db                     noarch          4.0-40.20130911.el7           @base          7.1 M
 foomatic-db-filesystem          noarch          4.0-40.20130911.el7           @base          0.0  
 foomatic-db-ppds                noarch          4.0-40.20130911.el7           @base           35 M
 foomatic-filters                x86_64          4.0.9-8.el7                   @base          326 k
 iprutils                        x86_64          2.4.13.1-1.el7                @base          925 k
 libyaml                         x86_64          0.1.4-11.el7_0                @base          130 k
 lsscsi                          x86_64          0.27-4.el7                    @base           88 k
 lvm2-python-libs                x86_64          7:2.02.166-1.el7_3.5          @base           62 k
 pytalloc                        x86_64          2.1.6-1.el7                   @base           27 k
 python-setproctitle             x86_64          1.1.6-5.el7                   @base           29 k
 samba                           x86_64          4.4.4-14.el7_3                @base          1.8 M
 samba-common-tools              x86_64          4.4.4-14.el7_3                @base          1.1 M
 samba-libs                      x86_64          4.4.4-14.el7_3                @base          709 k
 targetd                         noarch          0.7.1-1.el7                   @base          123 k

Transaction Summary
====================================================================================================
Remove  16 Packages

Installed size: 48 M
Is this ok [y/N]: 
..


</code></pre>
<h3 id="yum-remove">yum remove</h3>
<pre><code class="language-shell">[root@station14 ~]# rpm -qa | grep httpd
httpd-2.4.6-45.el7.centos.4.x86_64
httpd-tools-2.4.6-45.el7.centos.4.x86_64
[root@station14 ~]# yum remove httpd
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package httpd.x86_64 0:2.4.6-45.el7.centos.4 will be erased
--&gt; Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package            Arch                Version                            Repository          Size
====================================================================================================
Removing:
 httpd              x86_64              2.4.6-45.el7.centos.4              @base              9.4 M

Transaction Summary
====================================================================================================
Remove  1 Package

Installed size: 9.4 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : httpd-2.4.6-45.el7.centos.4.x86_64                                               1/1 
  Verifying  : httpd-2.4.6-45.el7.centos.4.x86_64                                               1/1 

Removed:
  httpd.x86_64 0:2.4.6-45.el7.centos.4                                                              

Complete!

[root@station14 ~]# yum history
Loaded plugins: fastestmirror, langpacks
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    10 | root &lt;root&gt;              | 2023-04-14 15:01 | Erase          |    1   
     9 | root &lt;root&gt;              | 2023-04-14 14:54 | Install        |   16   
     8 | root &lt;root&gt;              | 2023-04-14 14:42 | Install        |    2   
     7 | root &lt;root&gt;              | 2023-04-14 09:53 | Install        |    8   
     6 | root &lt;root&gt;              | 2023-04-13 09:47 | Install        |   44   
     5 | root &lt;root&gt;              | 2023-04-12 17:14 | Install        |    2   
     4 | root &lt;root&gt;              | 2023-04-12 16:40 | Install        |    4   
     3 | root &lt;root&gt;              | 2023-04-10 15:29 | I, O           |    5 ss
     2 | System &lt;unset&gt;           | 2023-04-10 15:08 | Install        |    1  &lt;
     1 | System &lt;unset&gt;           | 2023-04-08 05:23 | Install        | 1362 &gt; 
history list
&gt; ID 10 에 Erase !

</code></pre>
<h3 id="yum-repo-파일">yum .repo 파일</h3>
<h4 id="식별자">식별자</h4>
<p>name
baseurl
enabled
gpgcheck : key 확인하려면 1로 설정 -&gt; 확인하는 key의 위치도 지정해야 함.</p>
<pre><code class="language-shell">[root@station14 ~]# cat -n /etc/yum
yum/         yum.conf     yum.repos.d/ 
[root@station14 ~]# cat -n /etc/yum.conf 
     1    [main]
     2    cachedir=/var/cache/yum/$basearch/$releasever
     3    keepcache=0
     4    debuglevel=2
     5    logfile=/var/log/yum.log
     6    exactarch=1
     7    obsoletes=1
     8    gpgcheck=1
     9    plugins=1
    10    installonly_limit=5
    11    bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&amp;ref=http://bugs.centos.org/bug_report_page.php?category=yum
    12    distroverpkg=centos-release
    13    
    14    
    15    #  This is the default, if you make this bigger yum won&#39;t see if the metadata
    16    # is newer on the remote and so you&#39;ll &quot;gain&quot; the bandwidth of not having to
    17    # download the new metadata and &quot;pay&quot; for it by yum not having correct
    18    # information.
    19    #  It is esp. important, to have correct metadata, for distributions like
    20    # Fedora which don&#39;t keep old packages around. If you don&#39;t like this checking
    21    # interupting your command line usage, it&#39;s much better to have something
    22    # manually check the metadata once an hour (yum-updatesd will do this).
    23    # metadata_expire=90m
    24    
    25    # PUT YOUR REPOS HERE OR IN separate files named file.repo
    26    # in /etc/yum.repos.d
[root@station14 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo.reallydisabled  CentOS-Media.repo.reallydisabled  mysql-community-debuginfo.repo
CentOS-CR.repo                   CentOS-Sources.repo               mysql-community.repo
CentOS-Debuginfo.repo            CentOS-Vault.repo                 mysql-community-source.repo
CentOS-fasttrack.repo            classroom.repo
[root@station14 ~]# cat -n /etc/yum.repos.d/classroom.repo 
     1    [base]
     2    name=CentOS $releasever - $basearch - base
     3    baseurl=file:///net/server1/export/netinstall/CENTOS7
     4    enabled=1
     5    gpgcheck=0
     6    
     7    [classRPMs]
     8    name=Custom Guru Labs Classroom RPMs
     9    baseurl=file:///net/server1/export/courserepos/R7
    10    enabled=1
    11    gpgcheck=0
    12    
    13    [errataRPMs]
    14    name=CentOS $releasever - Server - $basearch - Errata
    15    baseurl=file:///net/server1/export/courserepos/errata/R7
    16    enabled=1
    17    gpgcheck=0
[root@station14 ~]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
--2023-04-14 15:13:52--  https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 38.145.60.24, 38.145.60.23, 38.145.60.22
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|38.145.60.24|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15608 (15K) [application/x-rpm]
Saving to: ‘epel-release-latest-7.noarch.rpm’

100%[===============================================================&gt;] 15,608      78.1KB/s   in 0.2s   

2023-04-14 15:13:53 (78.1 KB/s) - ‘epel-release-latest-7.noarch.rpm’ saved [15608/15608]

[root@station14 ~]# ll
total 35688
lrwxrwxrwx. 1 root root        7 Apr 10 15:33 a.link -&gt; /tmp/hp
-rw-r--r--. 1 root root   129760 Oct 15  2020 amanda-3.3.3-22.el7.x86_64.rpm
-rw-------. 1 root root     2510 Apr  8 05:41 anaconda-ks.cfg
drwxr-xr-x. 3 root root       17 Apr 10 14:15 color
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Desktop
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Documents
drwxr-xr-x. 2 root root     4096 Apr 12 09:34 Downloads
-rw-r--r--. 1 root root    15608 Sep  5  2021 epel-release-latest-7.noarch.rpm
-rw-r--r--. 1 root root 14435384 Apr 12 17:19 errors.txt
-rw-r--r--. 1 root root       94 Apr 14 11:56 fri
-rw-r--r--. 1 root root      617 Apr 10 14:20 fstab
drwxr-xr-x. 2 root root       49 Apr  8 05:48 Music
-rw-------. 1 root root     2038 Apr  8 05:41 original-ks.cfg
-rw-r--r--. 1 root root        0 Apr 12 17:19 output.txt
drwxr-xr-x. 3 root root     4096 Apr 13 10:51 Pictures
drwxr-xr-x. 4 root root       44 Apr 10 16:06 projects
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Public
-rw-r--r--. 1 root root        0 Apr 10 12:21 pwd
-rw-r--r--. 1 root root  4953734 Apr 11 15:54 sed-output.txt
-rw-r--r--. 1 root root 14474943 Apr 12 17:20 stderrandstdout.txt
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Templates
-rw-r--r--. 1 root root     2119 Apr  8 05:41 toppost.log
drwxr-xr-x. 3 root root       17 Apr 10 14:00 Videos
-rw-r--r--. 1 root root  2497380 Apr  8  2020 zsh-5.0.2-34.el7_8.2.x86_64.rpm
[root@station14 ~]# rpm -Uvh epel-release-latest-7.noarch.rpm 
warning: epel-release-latest-7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-14                ################################# [100%]
[root@station14 ~]# ll
total 35688
lrwxrwxrwx. 1 root root        7 Apr 10 15:33 a.link -&gt; /tmp/hp
-rw-r--r--. 1 root root   129760 Oct 15  2020 amanda-3.3.3-22.el7.x86_64.rpm
-rw-------. 1 root root     2510 Apr  8 05:41 anaconda-ks.cfg
drwxr-xr-x. 3 root root       17 Apr 10 14:15 color
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Desktop
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Documents
drwxr-xr-x. 2 root root     4096 Apr 12 09:34 Downloads
-rw-r--r--. 1 root root    15608 Sep  5  2021 epel-release-latest-7.noarch.rpm
-rw-r--r--. 1 root root 14435384 Apr 12 17:19 errors.txt
-rw-r--r--. 1 root root       94 Apr 14 11:56 fri
-rw-r--r--. 1 root root      617 Apr 10 14:20 fstab
drwxr-xr-x. 2 root root       49 Apr  8 05:48 Music
-rw-------. 1 root root     2038 Apr  8 05:41 original-ks.cfg
-rw-r--r--. 1 root root        0 Apr 12 17:19 output.txt
drwxr-xr-x. 3 root root     4096 Apr 13 10:51 Pictures
drwxr-xr-x. 4 root root       44 Apr 10 16:06 projects
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Public
-rw-r--r--. 1 root root        0 Apr 10 12:21 pwd
-rw-r--r--. 1 root root  4953734 Apr 11 15:54 sed-output.txt
-rw-r--r--. 1 root root 14474943 Apr 12 17:20 stderrandstdout.txt
drwxr-xr-x. 2 root root        6 Apr  8 05:47 Templates
-rw-r--r--. 1 root root     2119 Apr  8 05:41 toppost.log
drwxr-xr-x. 3 root root       17 Apr 10 14:00 Videos
-rw-r--r--. 1 root root  2497380 Apr  8  2020 zsh-5.0.2-34.el7_8.2.x86_64.rpm
[root@station14 ~]# ll /etc/yum.repos.d/
total 52
-rw-r--r--. 1 root root 1664 Apr  8 05:41 CentOS-Base.repo.reallydisabled
-rw-r--r--. 1 root root 1309 Apr  8 05:41 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Apr  8 05:41 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 Apr  8 05:41 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Apr  8 05:41 CentOS-Media.repo.reallydisabled
-rw-r--r--. 1 root root 1331 Apr  8 05:41 CentOS-Sources.repo
-rw-r--r--. 1 root root 2893 Apr  8 05:41 CentOS-Vault.repo
-rw-r--r--. 1 root root  392 Jan  6  2017 classroom.repo
-rw-r--r--. 1 root root 1358 Sep  5  2021 epel.repo
-rw-r--r--. 1 root root 1457 Sep  5  2021 epel-testing.repo
-rw-r--r--. 1 root root 1147 Aug 27  2022 mysql-community-debuginfo.repo
-rw-r--r--. 1 root root 2062 Aug 27  2022 mysql-community.repo
-rw-r--r--. 1 root root 2132 Aug 27  2022 mysql-community-source.repo
[root@station14 ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base classRPMs epel errataRPMs mysql-connectors-community mysql-tools-community
              : mysql80-community
Cleaning up everything
Cleaning up list of fastest mirrors
[root@station14 ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
base                                                                              | 3.6 kB  00:00:00     
classRPMs                                                                         | 2.5 kB  00:00:00     
epel/x86_64/metalink                                                              | 7.2 kB  00:00:00     
epel                                                                              | 4.7 kB  00:00:00     
errataRPMs                                                                        | 2.5 kB  00:00:00     
mysql-connectors-community                                                        | 2.6 kB  00:00:00     
mysql-tools-community                                                             | 2.6 kB  00:00:00     
mysql80-community                                                                 | 2.6 kB  00:00:00     
(1/10): base/group_gz                                                             | 155 kB  00:00:00     
(2/10): classRPMs/primary_db                                                      | 143 kB  00:00:00     
(3/10): epel/x86_64/group_gz                                                      |  99 kB  00:00:00     
(4/10): base/primary_db                                                           | 3.0 MB  00:00:00     
(5/10): mysql-connectors-community/x86_64/primary_db                              |  96 kB  00:00:00     
(6/10): errataRPMs/primary_db                                                     | 689 kB  00:00:00     
(7/10): mysql80-community/x86_64/primary_db                                       | 231 kB  00:00:00     
(8/10): mysql-tools-community/x86_64/primary_db                                   |  91 kB  00:00:00     
epel/x86_64/primary_db         FAILED                                          
http://mirror.earthlink.iq/epel/7/x86_64/repodata/cc73c13317f503a7ec301dfb6f1b951c7167913481da87606cf971640fb08409-primary.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn&#39;t help to resolve this issue please create a bug on https://bugs.centos.org/

(9/10): epel/x86_64/primary_db                                                    | 7.0 MB  00:00:01     
(10/10): epel/x86_64/updateinfo                                                   | 1.0 MB  00:00:03     
Determining fastest mirrors
 * epel: mirror-jp.misakamikoto.network
repo id                                    repo name                                               status
base                                       CentOS 7 - x86_64 - base                                 3,831
classRPMs                                  Custom Guru Labs Classroom RPMs                            196
*epel/x86_64                               Extra Packages for Enterprise Linux 7 - x86_64          13,771
errataRPMs                                 CentOS 7 - Server - x86_64 - Errata                        291
mysql-connectors-community/x86_64          MySQL Connectors Community                                 213
mysql-tools-community/x86_64               MySQL Tools Community                                       96
mysql80-community/x86_64                   MySQL 8.0 Community Server                                 386
repolist: 18,784
[root@station14 ~]# yum search dbench
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror-jp.misakamikoto.network
============================================ N/S matched: dbench =============================================
dbench.x86_64 : Filesystem load benchmarking tool

  Name and summary matches only, use &quot;search all&quot; for everything.
[root@station14 ~]# yum install dbench
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror-jp.misakamikoto.network
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package dbench.x86_64 0:4.0-10.el7 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                  Arch                     Version                       Repository              Size
==============================================================================================================
Installing:
 dbench                   x86_64                   4.0-10.el7                    epel                   1.0 M

Transaction Summary
==============================================================================================================
Install  1 Package

Total download size: 1.0 M
Installed size: 25 M
Is this ok [y/d/N]: d
Background downloading packages, then exiting:
warning: /var/cache/yum/x86_64/7/epel/packages/dbench-4.0-10.el7.x86_64.rpm.12557.tmp: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for dbench-4.0-10.el7.x86_64.rpm.12557.tmp is not installed
dbench-4.0-10.el7.x86_64.rpm                                                           | 1.0 MB  00:00:00     
exiting because &quot;Download Only&quot; specified
[root@station14 ~]# ll /var/cache/yum/x86_64/7
total 12
drwxr-xr-x. 4 root root  246 Apr 14 15:15 base
drwxr-xr-x. 4 root root   96 Apr 14 15:15 classRPMs
drwxr-xr-x. 4 root root 4096 Apr 14 15:15 epel
drwxr-xr-x. 4 root root   96 Apr 14 15:15 errataRPMs
drwxr-xr-x. 4 root root  137 Apr 14 15:15 mysql80-community
drwxr-xr-x. 4 root root  137 Apr 14 15:15 mysql-connectors-community
drwxr-xr-x. 4 root root  137 Apr 14 15:15 mysql-tools-community
-rw-r--r--. 1 root root  232 Apr 14 15:17 timedhosts
-rw-r--r--. 1 root root  574 Apr 14 15:15 timedhosts.txt
[root@station14 ~]# ll /var/cache/yum/x86_64/7/epel
total 8384
-rw-r--r--. 1 root root  101292 Apr 13 09:51 97d2e9722dd5c0662a5c885a746a127e951f8860139076802e27d35eadb4aa45-comps-Everything.x86_64.xml.gz
-rw-r--r--. 1 root root 1088510 Apr 13 10:14 ca4819ec6c4463c637a88157e4c8c620f8c207d8922fdaf8762e21292da00302-updateinfo.xml.bz2
-rw-r--r--. 1 root root       0 Apr 14 15:15 cachecookie
-rw-r--r--. 1 root root 7360792 Apr 13 09:51 cc73c13317f503a7ec301dfb6f1b951c7167913481da87606cf971640fb08409-primary.sqlite.bz2
drwxr-xr-x. 2 root root      48 Apr 14 15:17 gen
-rw-r--r--. 1 root root    7328 Apr 14 15:15 metalink.xml
drwxr-xr-x. 2 root root      42 Apr 14 15:17 packages
-rw-r--r--. 1 root root    4850 Apr 13 10:14 repomd.xml
[root@station14 ~]# cd /var/cache/yum/x86_64/7/epel/packages/
[root@station14 packages]# ll
total 1016
-rw-r--r--. 1 root root 1036820 Aug 21  2014 dbench-4.0-10.el7.x86_64.rpm
[root@station14 packages]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base classRPMs epel errataRPMs mysql-connectors-community mysql-tools-community
              : mysql80-community
Cleaning up everything
Cleaning up list of fastest mirrors
[root@station14 packages]# ll /var/cache/yum/x86_64/7/epel/packages/
total 0
[root@station14 packages]# yum repolist
Loaded plugins: fastestmirror, langpacks
base                                                                                   | 3.6 kB  00:00:00     
classRPMs                                                                              | 2.5 kB  00:00:00     
epel/x86_64/metalink                                                                   | 7.2 kB  00:00:00     
epel                                                                                   | 4.7 kB  00:00:00     
errataRPMs                                                                             | 2.5 kB  00:00:00     
mysql-connectors-community                                                             | 2.6 kB  00:00:00     
mysql-tools-community                                                                  | 2.6 kB  00:00:00     
mysql80-community                                                                      | 2.6 kB  00:00:00     
(1/10): base/group_gz                                                                  | 155 kB  00:00:00     
(2/10): base/primary_db                                                                | 3.0 MB  00:00:00     
(3/10): classRPMs/primary_db                                                           | 143 kB  00:00:00     
(4/10): epel/x86_64/group_gz                                                           |  99 kB  00:00:00     
(5/10): epel/x86_64/updateinfo                                                         | 1.0 MB  00:00:00     
(6/10): errataRPMs/primary_db                                                          | 689 kB  00:00:00     
(7/10): mysql-connectors-community/x86_64/primary_db                                   |  96 kB  00:00:00     
(8/10): mysql-tools-community/x86_64/primary_db                                        |  91 kB  00:00:00     
(9/10): epel/x86_64/primary_db                                                         | 7.0 MB  00:00:01     
(10/10): mysql80-community/x86_64/primary_db                                           | 231 kB  00:00:05     
Determining fastest mirrors
 * epel: mirror-jp.misakamikoto.network
repo id                                      repo name                                                  status
base                                         CentOS 7 - x86_64 - base                                    3,831
classRPMs                                    Custom Guru Labs Classroom RPMs                               196
*epel/x86_64                                 Extra Packages for Enterprise Linux 7 - x86_64             13,771
errataRPMs                                   CentOS 7 - Server - x86_64 - Errata                           291
mysql-connectors-community/x86_64            MySQL Connectors Community                                    213
mysql-tools-community/x86_64                 MySQL Tools Community                                          96
mysql80-community/x86_64                     MySQL 8.0 Community Server                                    386
repolist: 18,784
[root@station14 packages]# yum grouplist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror-jp.misakamikoto.network
Installed Environment Groups:
   File and Print Server
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   Cinnamon Desktop
   MATE Desktop
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Cinnamon
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Educational Software
   Electronic Lab
   Fedora Packager
   General Purpose Desktop
   Graphical Administration Tools
   Haskell
   LXQt Desktop
   Legacy UNIX Compatibility
   MATE
   Milkymist
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
   TurboGears application framework
   Xfce
Done
</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[at, batch, crontab]]></title>
            <link>https://velog.io/@yoni_d/at-batch-crontab</link>
            <guid>https://velog.io/@yoni_d/at-batch-crontab</guid>
            <pubDate>Fri, 14 Apr 2023 04:41:01 GMT</pubDate>
            <description><![CDATA[<p>allow 파일 있으면 deny파일은 항상 무시됨
allow 파일 없으면, 어떤 유저들이 crone이나 app 서비스 이용할 수 있을까?</p>
<p>deny파일 - 어떤 유저들이 사용하지 못하도록 함.</p>
<h3 id="at">at</h3>
<pre><code class="language-shell">[root@localhost etc]# date
Fri Apr 14 11:19:02 KST 2023
[root@localhost etc]# at -l
[root@localhost etc]# atq
[root@localhost etc]# which df
/usr/bin/df
wh:[root@localhost etc]# whereis who
who: /usr/bin/who /usr/share/man/man1/who.1.gz /usr/share/man/man1p/who.1p.gz

[root@localhost etc]# at -t 202304141132
at&gt; /usr/bin/df -h &lt; /tmp/at.result
at&gt; /usr/bin/who &gt;&gt; /tmp/at.result 
at&gt; &lt;EOT&gt;
job 1 at Fri Apr 14 11:32:00 2023
[root@localhost etc]# at -l
1    Fri Apr 14 11:32:00 2023 a root
[root@localhost etc]# atq
1    Fri Apr 14 11:32:00 2023 a root

[root@localhost etc]# at -c 1
#!/bin/sh
# atrun uid=0 gid=0
# mail root 0
umask 22
XDG_VTNR=1; export XDG_VTNR
SSH_AGENT_PID=1746; export SSH_AGENT_PID
XDG_SESSION_ID=1; export XDG_SESSION_ID
HOSTNAME=localhost.localdomain; export HOSTNAME
IMSETTINGS_INTEGRATE_DESKTOP=yes; export IMSETTINGS_INTEGRATE_DESKTOP
GPG_AGENT_INFO=/run/user/0/keyring/gpg:0:1; export GPG_AGENT_INFO
SHELL=/bin/bash; export SHELL
XDG_MENU_PREFIX=gnome-; export XDG_MENU_PREFIX
VTE_VERSION=3804; export VTE_VERSION
HISTSIZE=1000; export HISTSIZE
WINDOWID=33554439; export WINDOWID
IMSETTINGS_MODULE=none; export IMSETTINGS_MODULE
USER=root; export USER
LS_COLORS=rs=0:di=38\;5\;27:ln=38\;5\;51:mh=44\;38\;5\;15:pi=40\;38\;5\;11:so=38\;5\;13:do=38\;5\;5:bd=48\;5\;232\;38\;5\;11:cd=48\;5\;232\;38\;5\;3:or=48\;5\;232\;38\;5\;9:mi=05\;48\;5\;232\;38\;5\;15:su=48\;5\;196\;38\;5\;15:sg=48\;5\;11\;38\;5\;16:ca=48\;5\;196\;38\;5\;226:tw=48\;5\;10\;38\;5\;16:ow=48\;5\;10\;38\;5\;21:st=48\;5\;21\;38\;5\;15:ex=38\;5\;34:\*.tar=38\;5\;9:\*.tgz=38\;5\;9:\*.arc=38\;5\;9:\*.arj=38\;5\;9:\*.taz=38\;5\;9:\*.lha=38\;5\;9:\*.lz4=38\;5\;9:\*.lzh=38\;5\;9:\*.lzma=38\;5\;9:\*.tlz=38\;5\;9:\*.txz=38\;5\;9:\*.tzo=38\;5\;9:\*.t7z=38\;5\;9:\*.zip=38\;5\;9:\*.z=38\;5\;9:\*.Z=38\;5\;9:\*.dz=38\;5\;9:\*.gz=38\;5\;9:\*.lrz=38\;5\;9:\*.lz=38\;5\;9:\*.lzo=38\;5\;9:\*.xz=38\;5\;9:\*.bz2=38\;5\;9:\*.bz=38\;5\;9:\*.tbz=38\;5\;9:\*.tbz2=38\;5\;9:\*.tz=38\;5\;9:\*.deb=38\;5\;9:\*.rpm=38\;5\;9:\*.jar=38\;5\;9:\*.war=38\;5\;9:\*.ear=38\;5\;9:\*.sar=38\;5\;9:\*.rar=38\;5\;9:\*.alz=38\;5\;9:\*.ace=38\;5\;9:\*.zoo=38\;5\;9:\*.cpio=38\;5\;9:\*.7z=38\;5\;9:\*.rz=38\;5\;9:\*.cab=38\;5\;9:\*.jpg=38\;5\;13:\*.jpeg=38\;5\;13:\*.gif=38\;5\;13:\*.bmp=38\;5\;13:\*.pbm=38\;5\;13:\*.pgm=38\;5\;13:\*.ppm=38\;5\;13:\*.tga=38\;5\;13:\*.xbm=38\;5\;13:\*.xpm=38\;5\;13:\*.tif=38\;5\;13:\*.tiff=38\;5\;13:\*.png=38\;5\;13:\*.svg=38\;5\;13:\*.svgz=38\;5\;13:\*.mng=38\;5\;13:\*.pcx=38\;5\;13:\*.mov=38\;5\;13:\*.mpg=38\;5\;13:\*.mpeg=38\;5\;13:\*.m2v=38\;5\;13:\*.mkv=38\;5\;13:\*.webm=38\;5\;13:\*.ogm=38\;5\;13:\*.mp4=38\;5\;13:\*.m4v=38\;5\;13:\*.mp4v=38\;5\;13:\*.vob=38\;5\;13:\*.qt=38\;5\;13:\*.nuv=38\;5\;13:\*.wmv=38\;5\;13:\*.asf=38\;5\;13:\*.rm=38\;5\;13:\*.rmvb=38\;5\;13:\*.flc=38\;5\;13:\*.avi=38\;5\;13:\*.fli=38\;5\;13:\*.flv=38\;5\;13:\*.gl=38\;5\;13:\*.dl=38\;5\;13:\*.xcf=38\;5\;13:\*.xwd=38\;5\;13:\*.yuv=38\;5\;13:\*.cgm=38\;5\;13:\*.emf=38\;5\;13:\*.axv=38\;5\;13:\*.anx=38\;5\;13:\*.ogv=38\;5\;13:\*.ogx=38\;5\;13:\*.aac=38\;5\;45:\*.au=38\;5\;45:\*.flac=38\;5\;45:\*.mid=38\;5\;45:\*.midi=38\;5\;45:\*.mka=38\;5\;45:\*.mp3=38\;5\;45:\*.mpc=38\;5\;45:\*.ogg=38\;5\;45:\*.ra=38\;5\;45:\*.wav=38\;5\;45:\*.axa=38\;5\;45:\*.oga=38\;5\;45:\*.spx=38\;5\;45:\*.xspf=38\;5\;45:; export LS_COLORS
SSH_AUTH_SOCK=/run/user/0/keyring/ssh; export SSH_AUTH_SOCK
USERNAME=root; export USERNAME
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/1574,unix/unix:/tmp/.ICE-unix/1574; export SESSION_MANAGER
GNOME_SHELL_SESSION_MODE=classic; export GNOME_SHELL_SESSION_MODE
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin; export PATH
MAIL=/var/spool/mail/root; export MAIL
DESKTOP_SESSION=gnome-classic; export DESKTOP_SESSION
QT_IM_MODULE=ibus; export QT_IM_MODULE
PWD=/etc; export PWD
XMODIFIERS=@im=ibus; export XMODIFIERS
LANG=en_US.UTF-8; export LANG
GDM_LANG=en_US.UTF-8; export GDM_LANG
GDMSESSION=gnome-classic; export GDMSESSION
HISTCONTROL=ignoredups; export HISTCONTROL
XDG_SEAT=seat0; export XDG_SEAT
HOME=/root; export HOME
SHLVL=2; export SHLVL
GNOME_DESKTOP_SESSION_ID=this-is-deprecated; export GNOME_DESKTOP_SESSION_ID
XDG_SESSION_DESKTOP=gnome-classic; export XDG_SESSION_DESKTOP
LOGNAME=root; export LOGNAME
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-sdGbL4LTU1,guid=4a928abda20f7253e4e40b9e64376074; export DBUS_SESSION_BUS_ADDRESS
LESSOPEN=\|\|/usr/bin/lesspipe.sh\ %s; export LESSOPEN
WINDOWPATH=1; export WINDOWPATH
XDG_RUNTIME_DIR=/run/user/0; export XDG_RUNTIME_DIR
XDG_CURRENT_DESKTOP=GNOME-Classic:GNOME; export XDG_CURRENT_DESKTOP
XAUTHORITY=/run/gdm/auth-for-root-1QefRc/database; export XAUTHORITY
OLDPWD=/root/.ssh; export OLDPWD
cd /etc || {
     echo &#39;Execution directory inaccessible&#39; &gt;&amp;2
     exit 1
}
${SHELL:-/bin/sh} &lt;&lt; &#39;marcinDELIMITER60ce56da&#39;
/usr/bin/df -h &lt; /tmp/at.result
/usr/bin/who &gt;&gt; /tmp/at.result

marcinDELIMITER60ce56da
[root@localhost etc]# at -l
You have new mail in /var/spool/mail/root
[root@localhost etc]# ll /var/spool/at
total 0
drwx------. 2 daemon daemon 6 Apr 14 11:32 spool
[root@localhost etc]# ll /tmp/at.result 
-rw-r--r--. 1 root root 183 Apr 14 11:32 /tmp/at.result


</code></pre>
<h3 id="crontab">crontab</h3>
<pre><code class="language-shell">[root@station14 ~]# which vmstat
/usr/bin/vmstat
[root@station14 ~]# vi fri

      1 20 12 * * 5 /usr/bin/vmstat 5 2 &gt; /tmp/cron.txt
      2 30 23 * * * /usr/bin/last  &gt; /tmp/login.users
[root@station14 ~]# crontab fri
[root@station14 ~]# crontab -l
20 12 * * 5 /usr/bin/vmstat 5 2 &gt; /tmp/cron.txt
30 23 * * * /usr/bin/last  &gt; /tmp/login.users

[root@station14 ~]# crontab -e   --수정
crontab: installing new crontab 

[root@station14 ~]# crontab -l
57 11 * * 5 /usr/bin/vmstat 5 2 &gt; /tmp/cron.txt
30 23 * * * /usr/bin/last  &gt; /tmp/login.users



</code></pre>
<pre><code class="language-shell">[guru@station14 ~]$ crontab -e
crontab: installing new crontab

[guru@station14 ~]$ crontab -l
*/5 * * * * echo &quot;Hello from guru&quot; &gt;&gt; /tmp/hello.txt

[guru@station14 ~]$ cd
[guru@station14 ~]$ crontab -l &gt; crontab-guru
[guru@station14 ~]$ ll
total 16
-rw-rw-r--. 1 guru guru   0 Apr 10 15:11 banana
drwxrwxr-x. 2 guru guru   6 Apr 10 14:50 bbb
-rw-rw-r--. 1 guru guru  53 Apr 14 12:09 crontab-guru
--w-r--r--. 1 guru guru 617 Apr 12 12:20 fstab
-rw-r--r--. 1 guru guru 617 Apr 10 14:44 group
-rw-r--r--. 1 guru guru 617 Apr 10 15:12 passwd
drwxrwxr-x. 4 guru guru  54 Apr 12 13:53 test
-rw-r--r--. 1 root root   0 Apr 10 15:52 *test file*
[guru@station14 ~]$ crontab -r
[guru@station14 ~]$ crontab -l
no crontab for guru
[guru@station14 ~]$ vi crontab-guru 
[guru@station14 ~]$ crontab crontab-guru 
[guru@station14 ~]$ crontab -l
*/5 * * * * echo &quot;Hello from guru&quot; &gt;&gt; /tmp/hello.txt
3-59/5 * * * * echo &quot;This is a test message&quot;
[guru@station14 ~]$ sleep 300; echo -3 &#39;Ding!\a&#39;</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[network 설정]]></title>
            <link>https://velog.io/@yoni_d/network-%EC%84%A4%EC%A0%95</link>
            <guid>https://velog.io/@yoni_d/network-%EC%84%A4%EC%A0%95</guid>
            <pubDate>Fri, 14 Apr 2023 02:03:24 GMT</pubDate>
            <description><![CDATA[<p>/etc/hosts -&gt; 작은 dns
여기에 ip등록해두면, 도메인 가능</p>
<pre><code class="language-shell">[root@localhost .ssh]# nmtui
[root@localhost .ssh]# ll /etc/sysconfig/network-scripts
total 232
-rw-r--r--. 1 root root   379 Apr 14 10:06 ifcfg-eth0
-rw-r--r--. 1 root root   254 Sep 12  2016 ifcfg-lo
lrwxrwxrwx. 1 root root    24 Apr 13 10:28 ifdown -&gt; ../../../usr/sbin/ifdown
-rwxr-xr-x. 1 root root   627 Sep 12  2016 ifdown-bnep
-rwxr-xr-x. 1 root root  5817 Sep 12  2016 ifdown-eth
-rwxr-xr-x. 1 root root  6196 May 26  2017 ifdown-ib
-rwxr-xr-x. 1 root root   781 Sep 12  2016 ifdown-ippp
-rwxr-xr-x. 1 root root  4201 Sep 12  2016 ifdown-ipv6
lrwxrwxrwx. 1 root root    11 Apr 13 10:28 ifdown-isdn -&gt; ifdown-ippp
-rwxr-xr-x. 1 root root  1778 Sep 12  2016 ifdown-post
-rwxr-xr-x. 1 root root  1068 Sep 12  2016 ifdown-ppp
-rwxr-xr-x. 1 root root   837 Sep 12  2016 ifdown-routes
-rwxr-xr-x. 1 root root  1444 Sep 12  2016 ifdown-sit
-rwxr-xr-x. 1 root root  1621 Nov  6  2016 ifdown-Team
-rwxr-xr-x. 1 root root  1556 Apr 16  2016 ifdown-TeamPort
-rwxr-xr-x. 1 root root  1462 Sep 12  2016 ifdown-tunnel
lrwxrwxrwx. 1 root root    22 Apr 13 10:28 ifup -&gt; ../../../usr/sbin/ifup
-rwxr-xr-x. 1 root root 12688 Sep 12  2016 ifup-aliases
-rwxr-xr-x. 1 root root   859 Sep 12  2016 ifup-bnep
-rwxr-xr-x. 1 root root 11880 Sep 12  2016 ifup-eth
-rwxr-xr-x. 1 root root 10145 May 26  2017 ifup-ib
-rwxr-xr-x. 1 root root 12039 Sep 12  2016 ifup-ippp
-rwxr-xr-x. 1 root root 10525 Sep 12  2016 ifup-ipv6
lrwxrwxrwx. 1 root root     9 Apr 13 10:28 ifup-isdn -&gt; ifup-ippp
-rwxr-xr-x. 1 root root   642 Sep 12  2016 ifup-plip
-rwxr-xr-x. 1 root root  1043 Sep 12  2016 ifup-plusb
-rwxr-xr-x. 1 root root  2772 Sep 12  2016 ifup-post
-rwxr-xr-x. 1 root root  4154 Sep 12  2016 ifup-ppp
-rwxr-xr-x. 1 root root  1925 Sep 12  2016 ifup-routes
-rwxr-xr-x. 1 root root  3263 Sep 12  2016 ifup-sit
-rwxr-xr-x. 1 root root  1755 Apr 16  2016 ifup-Team
-rwxr-xr-x. 1 root root  1876 Apr 16  2016 ifup-TeamPort
-rwxr-xr-x. 1 root root  2682 Sep 12  2016 ifup-tunnel
-rwxr-xr-x. 1 root root  1740 Sep 12  2016 ifup-wireless
-rwxr-xr-x. 1 root root  4623 Sep 12  2016 init.ipv6-global
-rw-r--r--. 1 root root 15780 Apr 13  2017 network-functions
-rw-r--r--. 1 root root 26829 Sep 12  2016 network-functions-ipv6
[root@localhost .ssh]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
# Generated by dracut initrd
NAME=&quot;eth0&quot;
HWADDR=52:54:00:10:51:1B
ONBOOT=yes
NETBOOT=yes
UUID=&quot;01239daa-e89f-46aa-88df-f2f828f95805&quot;
IPV6INIT=yes
BOOTPROTO=none
TYPE=Ethernet
IPADDR=192.168.122.101
PREFIX=24
GATEWAY=192.168.122.1
DNS1=192.168.122.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
[root@localhost .ssh]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.253  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 497468  bytes 951679576 (907.5 MiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 447364  bytes 30790677 (29.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost .ssh]# nmtui
[root@localhost .ssh]# 
[root@localhost .ssh]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.253  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 497513  bytes 951681944 (907.5 MiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 447366  bytes 30790809 (29.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost .ssh]# ping -c 2 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.060 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.058 ms

--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.058/0.059/0.060/0.001 ms
[root@localhost .ssh]# ping -c 2 192.168.122.1
PING 192.168.122.1 (192.168.122.1) 56(84) bytes of data.
64 bytes from 192.168.122.1: icmp_seq=1 ttl=64 time=0.240 ms
64 bytes from 192.168.122.1: icmp_seq=2 ttl=64 time=0.218 ms

--- 192.168.122.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.218/0.229/0.240/0.011 ms
[root@localhost .ssh]# ping -c 2 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=111 time=27.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=111 time=27.3 ms

--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 27.339/27.361/27.383/0.022 ms
[root@localhost .ssh]# ping -c 2 www.google.co.kr
PING www.google.co.kr (172.217.161.227) 56(84) bytes of data.
64 bytes from kix06s05-in-f3.1e100.net (172.217.161.227): icmp_seq=1 ttl=111 time=27.5 ms
64 bytes from kix06s05-in-f3.1e100.net (172.217.161.227): icmp_seq=2 ttl=111 time=27.4 ms

--- www.google.co.kr ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 27.489/27.535/27.581/0.046 ms
[root@localhost .ssh]# ping -c 2 192.168.122.101
PING 192.168.122.101 (192.168.122.101) 56(84) bytes of data.
From 192.168.122.253 icmp_seq=1 Destination Host Unreachable
From 192.168.122.253 icmp_seq=2 Destination Host Unreachable

--- 192.168.122.101 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 999ms
pipe 2
[root@localhost .ssh]# traceroute www.google.co.kr
traceroute to www.google.co.kr (142.250.206.227), 30 hops max, 60 byte packets
 1  gateway (192.168.122.1)  0.164 ms  0.112 ms  0.067 ms
 2  59.29.225.254 (59.29.225.254)  0.883 ms  0.822 ms  0.740 ms
 3  59.29.225.12 (59.29.225.12)  0.670 ms  0.616 ms  0.548 ms
 4  211.192.200.241 (211.192.200.241)  3.810 ms  3.760 ms  3.758 ms
 5  * * *
 6  * * *
 7  112.189.14.85 (112.189.14.85)  1.261 ms 112.189.13.97 (112.189.13.97)  1.359 ms  1.266 ms
 8  * * *
 9  112.174.90.154 (112.174.90.154)  8.385 ms 112.174.90.130 (112.174.90.130)  7.804 ms  7.793 ms
10  112.174.84.50 (112.174.84.50)  7.773 ms 112.174.84.46 (112.174.84.46)  7.957 ms 112.174.84.50 (112.174.84.50)  7.084 ms
11  142.250.165.78 (142.250.165.78)  27.844 ms 72.14.243.228 (72.14.243.228)  33.514 ms 142.250.165.78 (142.250.165.78)  28.548 ms
12  108.170.243.33 (108.170.243.33)  31.512 ms  29.781 ms *
13  108.170.242.193 (108.170.242.193)  32.138 ms 142.250.58.187 (142.250.58.187)  28.048 ms 172.253.75.94 (172.253.75.94)  32.654 ms
14  108.170.242.208 (108.170.242.208)  32.408 ms 108.170.242.112 (108.170.242.112)  33.541 ms 108.170.242.98 (108.170.242.98)  31.794 ms
15  142.251.254.135 (142.251.254.135)  33.588 ms 209.85.249.18 (209.85.249.18)  33.788 ms 142.251.254.81 (142.251.254.81)  33.138 ms
16  142.250.57.228 (142.250.57.228)  33.823 ms kix06s10-in-f3.1e100.net (142.250.206.227)  28.590 ms 142.250.58.92 (142.250.58.92)  34.561 ms


[root@localhost .ssh]# nslookup www.naver.com
Server:        192.168.122.1
Address:    192.168.122.1#53

Non-authoritative answer:
www.naver.com    canonical name = www.naver.com.nheos.com.
Name:    www.naver.com.nheos.com
Address: 223.130.200.107
Name:    www.naver.com.nheos.com
Address: 223.130.200.104

[root@localhost .ssh]# dig www.daum.net

; &lt;&lt;&gt;&gt; DiG 9.9.4-RedHat-9.9.4-38.el7_3.3 &lt;&lt;&gt;&gt; www.daum.net
;; global options: +cmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 12430
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.daum.net.            IN    A

;; ANSWER SECTION:
www.daum.net.        273    IN    CNAME    daum-4vdtymgd.kgslb.com.
daum-4vdtymgd.kgslb.com. 12    IN    A    121.53.105.193

;; Query time: 2 msec
;; SERVER: 192.168.122.1#53(192.168.122.1)
;; WHEN: Fri Apr 14 10:20:12 KST 2023
;; MSG SIZE  rcvd: 94

[root@localhost .ssh]# nmcli
virbr0: connected to virbr0
    bridge, 52:54:00:7E:B9:D6, sw, mtu 1500
    inet4 192.168.124.1/24

eth0: connected to eth0
    &quot;Red Hat Virtio network device&quot;
    ethernet (virtio_net), 52:54:00:10:51:1B, hw, mtu 1500
    ip4 default
    inet4 192.168.122.253/24
    inet6 fe80::5054:ff:fe10:511b/64

lo: unmanaged
    loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

virbr0-nic: unmanaged
    tun, 52:54:00:7E:B9:D6, sw, mtu 1500

Use &quot;nmcli device show&quot; to get complete information about known devices and
&quot;nmcli connection show&quot; to get an overview on active connection profiles.

Consult nmcli(1) and nmcli-examples(5) manual pages for complete usage details.

[root@localhost .ssh]# nmcli dev
DEVICE      TYPE      STATE      CONNECTION 
virbr0      bridge    connected  virbr0     
eth0        ethernet  connected  eth0       
lo          loopback  unmanaged  --         
virbr0-nic  tun       unmanaged  --         

[root@localhost .ssh]# nmcli connection
NAME    UUID                                  TYPE            DEVICE 
eth0    01239daa-e89f-46aa-88df-f2f828f95805  802-3-ethernet  eth0   
virbr0  ca54eaeb-de63-4d54-8fa3-631446f13343  bridge          virbr0 
[root@localhost .ssh]# nmcli con 
add      delete   edit     help     load     monitor  show     
clone    down     export   import   modify   reload   up       

[root@localhost .ssh]# nmcli con del
Error: No connection specified.

[root@localhost .ssh]# nmcli con del eth0 
Connection &#39;eth0&#39; (01239daa-e89f-46aa-88df-f2f828f95805) successfully deleted.
[root@localhost .ssh]# ls /etc/sysconfig/network-scripts
ifcfg-lo     ifdown-ipv6    ifdown-Team      ifup-eth   ifup-plusb   ifup-TeamPort
ifdown       ifdown-isdn    ifdown-TeamPort  ifup-ib    ifup-post    ifup-tunnel
ifdown-bnep  ifdown-post    ifdown-tunnel    ifup-ippp  ifup-ppp     ifup-wireless
ifdown-eth   ifdown-ppp     ifup             ifup-ipv6  ifup-routes  init.ipv6-global
ifdown-ib    ifdown-routes  ifup-aliases     ifup-isdn  ifup-sit     network-functions
ifdown-ippp  ifdown-sit     ifup-bnep        ifup-plip  ifup-Team    network-functions-ipv6

[root@localhost .ssh]# nmcli con del &#39;Wired connection 1&#39;
Connection &#39;Wired connection 1&#39; (8966818d-f806-33f7-9e73-b0b7800dae91) successfully deleted.
[root@localhost .ssh]# nmcli dev
DEVICE      TYPE      STATE         CONNECTION 
virbr0      bridge    connected     virbr0     
eth0        ethernet  disconnected  --         
lo          loopback  unmanaged     --         
virbr0-nic  tun       unmanaged     --       

[root@localhost .ssh]# nmcli con add type 
adsl          bridge        generic       macvlan       team          vpn           
bluetooth     bridge-slave  gsm           no-slave      team-slave    vxlan         
bond          cdma          infiniband    olpc-mesh     tun           wifi          
bond-slave    ethernet      ip-tunnel     pppoe         vlan          wimax         
[root@localhost .ssh]# nmcli con add type ethernet 
Display all 141 possibilities? (y or n)
802-1x.altsubject-matches                 dcb.app-fcoe-priority
802-1x.anonymous-identity                 dcb.app-fip-flags
802-1x.ca-cert                            dcb.app-fip-priority
802-1x.ca-path                            dcb.app-iscsi-flags
802-1x.client-cert                        dcb.app-iscsi-priority
802-1x.domain-suffix-match                dcb.priority-bandwidth
802-1x.eap                                dcb.priority-flow-control
802-1x.identity                           dcb.priority-flow-control-flags
802-1x.pac-file                           dcb.priority-group-bandwidth
802-1x.password                           dcb.priority-group-flags
802-1x.password-flags                     dcb.priority-group-id
802-1x.password-raw                       dcb.priority-strict-bandwidth
802-1x.password-raw-flags                 dcb.priority-traffic-class
802-1x.phase1-fast-provisioning           ethernet.auto-negotiate
802-1x.phase1-peaplabel                   ethernet.cloned-mac-address
802-1x.phase1-peapver                     ethernet.duplex
802-1x.phase2-altsubject-matches          ethernet.generate-mac-address-mask
802-1x.phase2-auth                        ethernet.mac-address
802-1x.phase2-autheap                     ethernet.mac-address-blacklist
802-1x.phase2-ca-cert                     ethernet.mtu
802-1x.phase2-ca-path                     ethernet.port
802-1x.phase2-client-cert                 ethernet.s390-nettype
802-1x.phase2-domain-suffix-match         ethernet.s390-options
802-1x.phase2-private-key                 ethernet.s390-subchannels
802-1x.phase2-private-key-password        ethernet.speed
802-1x.phase2-private-key-password-flags  ethernet.wake-on-lan
802-1x.phase2-subject-match               ethernet.wake-on-lan-password
802-1x.pin                                ifname
802-1x.pin-flags                          ipv4.addresses
802-1x.private-key                        ipv4.dad-timeout
802-1x.private-key-password               ipv4.dhcp-client-id
802-1x.private-key-password-flags         ipv4.dhcp-fqdn
802-1x.subject-match                      ipv4.dhcp-hostname
[root@localhost .ssh]# nmcli con add type ethernet ifname 
eth0        lo          virbr0      virbr0-nic  
[root@localhost .ssh]# nmcli con add type ethernet ifname eth0 con-name eth0 autoconnect yes ipv4.
ipv4.addresses           ipv4.dhcp-send-hostname  ipv4.dns-search          ipv4.method
ipv4.dad-timeout         ipv4.dhcp-timeout        ipv4.gateway             ipv4.never-default
ipv4.dhcp-client-id      ipv4.dns                 ipv4.ignore-auto-dns     ipv4.route-metric
ipv4.dhcp-fqdn           ipv4.dns-options         ipv4.ignore-auto-routes  ipv4.routes
ipv4.dhcp-hostname       ipv4.dns-priority        ipv4.may-fail            
[root@localhost .ssh]# nmcli con add type ethernet ifname eth0 con-name eth0 autoconnect yes
Connection &#39;eth0&#39; (6a23644f-89a1-438c-b834-90849d9f3977) successfully added.
[root@localhost .ssh]# ls /etc/sysconfig/network-scripts/
ifcfg-eth0   ifdown-ippp    ifdown-sit       ifup-bnep  ifup-plip    ifup-Team          network-functions-ipv6
ifcfg-lo     ifdown-ipv6    ifdown-Team      ifup-eth   ifup-plusb   ifup-TeamPort
ifdown       ifdown-isdn    ifdown-TeamPort  ifup-ib    ifup-post    ifup-tunnel
ifdown-bnep  ifdown-post    ifdown-tunnel    ifup-ippp  ifup-ppp     ifup-wireless
ifdown-eth   ifdown-ppp     ifup             ifup-ipv6  ifup-routes  init.ipv6-global
ifdown-ib    ifdown-routes  ifup-aliases     ifup-isdn  ifup-sit     network-functions

[root@localhost .ssh]# nmcli con modi eth0 ipv4.method manual ipv4.addresses 192.168.122.108/24 ipv4.dns 192.168.122.1 ipv4.gateway 192.168.122.1
[root@localhost .ssh]# systemctl restart network
[root@localhost .ssh]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.108  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::6f2c:1f29:25e8:7d1f  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 499027  bytes 951768885 (907.6 MiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 447620  bytes 30817357 (29.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost .ssh]# cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 192.168.122.1

</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[Network]]></title>
            <link>https://velog.io/@yoni_d/Network</link>
            <guid>https://velog.io/@yoni_d/Network</guid>
            <pubDate>Thu, 13 Apr 2023 07:52:35 GMT</pubDate>
            <description><![CDATA[<h3 id="ethtool">ethtool</h3>
<pre><code class="language-shell">
&gt; lan카드 정보 확인
[root@station14 ~]# ethtool -i eno1
driver: e1000e
version: 3.2.6-k
firmware-version: 0.13-4
expansion-rom-version: 
bus-info: 0000:00:19.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

&gt; lan카드 커널에서 잘 인식했는지 모듈 확인
[root@station14 ~]# lsmod | grep 1000e
e1000e                244351  0 
ptp                    19231  1 e1000e


&gt; speed, autoneg, duplex 변경
[root@station14 ~]# ethtool -s eno1 duplex half autoneg off speed 100
[root@station14 ~]# ethtool eno1
Settings for eno1:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 100Mb/s         --this one!!!!
    Duplex: Half           --this one!!!!
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: off         --this one!!!!
    MDI-X: off (auto)
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: yes

</code></pre>
<h3 id="network-configuration-with-ip-command">Network configuration with ip command</h3>
<pre><code class="language-shell">&gt; Layer 2
[root@station14 ~]# ip link
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 88:51:fb:68:ca:22 brd ff:ff:ff:ff:ff:ff
3: virbr0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
    link/ether 52:54:00:17:43:1c brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT qlen 1000
    link/ether 52:54:00:17:43:1c brd ff:ff:ff:ff:ff:ff
7: vnet0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast master virbr0 state UNKNOWN mode DEFAULT qlen 1000
    link/ether fe:54:00:10:51:1b brd ff:ff:ff:ff:ff:ff
[root@station14 ~]# 
[root@station14 ~]# 



&gt; Layer 3
[root@station14 ~]# ifconfig
eno1: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 59.29.224.196  netmask 255.255.255.0  broadcast 59.29.224.255
        inet6 fe80::8a51:fbff:fe68:ca22  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 88:51:fb:68:ca:22  txqueuelen 1000  (Ethernet)
        RX packets 1309195  bytes 1819257549 (1.6 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 632185  bytes 51719734 (49.3 MiB)
        TX errors 30  dropped 0 overruns 0  carrier 30  collisions 1128
        device interrupt 20  memory 0xf7c00000-f7c20000  

lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10&lt;host&gt;
        loop  txqueuelen 1  (Local Loopback)
        RX packets 303  bytes 33314 (32.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 303  bytes 33314 (32.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:17:43:1c  txqueuelen 1000  (Ethernet)
        RX packets 544690  bytes 28967982 (27.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1065899  bytes 1662646197 (1.5 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet6 fe80::fc54:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether fe:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 911  bytes 68503 (66.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11776  bytes 631027 (616.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@station14 ~]# ip addr
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 88:51:fb:68:ca:22 brd ff:ff:ff:ff:ff:ff
    inet 59.29.224.196/24 brd 59.29.224.255 scope global dynamic eno1
       valid_lft 431742sec preferred_lft 431742sec
    inet6 fe80::8a51:fbff:fe68:ca22/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 52:54:00:17:43:1c brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:17:43:1c brd ff:ff:ff:ff:ff:ff
7: vnet0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast master virbr0 state UNKNOWN qlen 1000
    link/ether fe:54:00:10:51:1b brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe10:511b/64 scope link 
       valid_lft forever preferred_lft forever
[root@station14 ~]# 
[root@station14 ~]# 


&gt; routing table 정보 보기
[root@station14 ~]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         59.29.224.254   0.0.0.0         UG        0 0          0 eno1
59.29.224.0     0.0.0.0         255.255.255.0   U         0 0          0 eno1
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0

[root@station14 ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    100    0        0 eno1
59.29.224.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

[root@station14 ~]# ip route
default via 59.29.224.254 dev eno1  proto static  metric 100 
59.29.224.0/24 dev eno1  proto kernel  scope link  src 59.29.224.196  metric 100 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 



&gt; ARP
[root@station14 ~]# arp -a
? (59.29.224.200) at 40:01:c6:b5:d1:10 [ether] on eno1
server1.example.com (59.29.224.181) at 88:51:fb:67:d3:ae [ether] on eno1
gateway (59.29.224.254) at 54:75:d0:c3:d3:bf [ether] on eno1
? (59.29.224.7) at 90:9f:33:8c:83:71 [ether] on eno1
? (192.168.122.253) at 52:54:00:10:51:1b [ether] on virbr0

[root@station14 ~]# ip neigh
59.29.224.200 dev eno1 lladdr 40:01:c6:b5:d1:10 STALE
59.29.224.181 dev eno1 lladdr 88:51:fb:67:d3:ae STALE
59.29.224.254 dev eno1 lladdr 54:75:d0:c3:d3:bf REACHABLE
59.29.224.7 dev eno1 lladdr 90:9f:33:8c:83:71 STALE
192.168.122.253 dev virbr0 lladdr 52:54:00:10:51:1b STALE



&gt; ip setting @@vm
[root@localhost .ssh]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.253  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 11826  bytes 633655 (618.8 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 912  bytes 68593 (66.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost .ssh]# ifconfig eth0 192.168.122.55 netmask 255.255.255.0 up
[root@localhost .ssh]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.55  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 11868  bytes 635867 (620.9 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 925  bytes 71245 (69.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


&gt; network service 재시작(or 시스템 재부팅)=&gt; 설정한 ip 정보 다 날라감
[root@localhost .ssh]# systemctl restart network
[root@localhost .ssh]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.253  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 11895  bytes 637693 (622.7 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 962  bytes 76584 (74.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

&gt; 라우팅테이블 정보 확인
[root@localhost .ssh]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.122.1   0.0.0.0         UG        0 0          0 eth0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.124.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0

&gt; eth0 LAN카드로 가라는 라우팅 테이블 정보 추가
[root@localhost .ssh]# route add -net 192.168.33.0 netmask 255.255.255.0 dev eth0
[root@localhost .ssh]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.122.1   0.0.0.0         UG        0 0          0 eth0
192.168.33.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.124.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0

&gt; 하지만 이 역시도 재부팅 하면 사라짐.
[root@localhost .ssh]# systemctl restart network
[root@localhost .ssh]# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.122.1   0.0.0.0         UG        0 0          0 eth0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.124.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0


&gt; 파일에 등록하면 영구 저장
/etc/sysconfig/network-scripts//route-interfacename(ex. eth0)


&gt; network 설정을 파일에 직접하기보다, 간접적으로 하는 방법 선호
nmcli</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[log 관리]]></title>
            <link>https://velog.io/@yoni_d/log-%EA%B4%80%EB%A6%AC</link>
            <guid>https://velog.io/@yoni_d/log-%EA%B4%80%EB%A6%AC</guid>
            <pubDate>Thu, 13 Apr 2023 04:56:56 GMT</pubDate>
            <description><![CDATA[<h3 id="journal-log">journal log</h3>
<pre><code class="language-shell">&gt; 옵션없이 journalctl 을 실행하면 systemd 의 로그를 볼 수 있다.
journalctl 

&gt; -n 옵션:  최근 10 개 메시지만 표시
journalctl -n 10

&gt; -f 옵션: 마지막 로그 내용을 보여준 후에 이후에 변경되는 로그 파일의 내용을 계속 출력
journalctl -f

&gt; -u 옵션 : crond 관련 journal log만 출력
journalctl -u crond

&gt; service name 어떻게 알까? 특정 daemon에 대한 정보 확인
systemctl -t service

&gt; 2023-04-13 13:01:00 부터 now까지의 journal log만 보고 싶다.
(기존 syslog, rsyslog는 이런 기능이 없다.)
journalctl --since &quot;2023-04-13 13:01:00&quot; --until now


&gt; -p 옵션: priorities (level 상태) 
즉, 특정 레벨에 해당하는 log를 보고자 할 때 사용 (level이 올라갈수록 emergency한 것)


&gt; error level에 해당하는 log들만 보자.
journalctl -p 3
</code></pre>
<h3 id="journal-log를-영구적으로-저장하는-법">journal log를 영구적으로 저장하는 법</h3>
<p>journal log는 휘발성으로 재부팅하면 날라가게 된다.
영구적으로 어떻게 저장할까?</p>
<pre><code class="language-shell">[root@station14 log]# mkdir -p /var/log/journal/
[root@station14 log]# systemctl restart systemd-journald

&gt; 영구적으로 저장하는거니까 이 위치에 더이상 journal로그가 필요 없다.
[root@station14 log]# ls /run/log/journal
ls: cannot access /run/log/journal: No such file or directory

&gt; mkdir한 곳 파일에 영구적으로 journal로그가 저장됨
[root@station14 log]# ll /var/log/journal/
total 0
drwxr-xr-x. 2 root root 28 Apr 13 14:05 2544d59d80f44d02b6ae0264364abe2e
</code></pre>
<h3 id="detecing-log-modification-with-log-sealing">Detecing Log Modification with Log Sealing</h3>
<p>sealing이 손상됨 == 누군가 log에 접근함.
sealing 기능 사용하려면 journal log는 영구적으로 저장되어 있어야 한다.</p>
<pre><code class="language-shell">[root@station14 log]# journalctl --setup-keys --interval=60m
Generating seed...
Generating key pair...
Generating sealing key...
Failed to set file attributes: Operation not supported

The new key pair has been generated. The secret sealing key has been written to
the following local file. This key file is automatically updated when the
sealing key is advanced. It should not be used on multiple hosts.

    /var/log/journal/2544d59d80f44d02b6ae0264364abe2e/fss

Please write down the following secret verification key. It should be stored
at a safe location and should not be saved locally on disk.

    c45c92-f2860d-6d83c8-6d67fe/72065-d693a400     --sealing key (빨간 key값)을 통해 검증할 수 있다. 해당 sealing key는 안전하게 보관해두자.

The sealing key is automatically changed every 1h.

The keys have been generated for host station14.example.com/2544d59d80f44d02b6ae0264364abe2e.

To transfer the verification key to your phone please scan the QR code below:


&gt; 검증
[root@station14 log]# journalctl --verify --verify-key=c45c92-f2860d-6d83c8-6d67fe/72065-d693a400
PASS: /var/log/journal/2544d59d80f44d02b6ae0264364abe2e/system.journal  
</code></pre>
<h3 id="syslog">syslog</h3>
<p>udp 프로토콜 사용 -&gt; log손상 발생</p>
<h3 id="rsyslog">rsyslog</h3>
<pre><code class="language-shell">[root@station14 log]# vi /etc/rsyslog.conf

     46 #### RULES ####
     47 
     48 # Log all kernel messages to the console.
     49 # Logging much else clutters up the screen.
     50 #kern.*                                                 /dev/console          # kernel log messa        ge save to console
     51 
     52 # Log anything (except mail) of level info or higher.
     53 # Don&#39;t log private authentication messages!
     54 *.info;mail.none;authpriv.none;cron.none                /var/log/messages     # mail, auth, cron         log to save here
     55 
     56 # The authpriv file has restricted access.
     57 authpriv.*                                              /var/log/secure       #about authentific        ation
     58 
     59 # Log all the mail messages in one place.
     60 mail.*                                                  -/var/log/maillog
     61 
     62 *.*                                                     /var/log/testlog.txt
     63 # Log cron stuff
     64 cron.*                                                  /var/log/cron
     65 
     66 # Everybody gets emergency messages
     67 *.emerg                                                 :omusrmsg:*   #output module (om) + usrm        sg (module name)
     68 
     69 # Save news errors of level crit and higher in a special file.
     70 uucp,news.crit                                          /var/log/spooler
     71 
     72 # Save boot messages also to boot.log
     73 local7.*                                      

[root@station14 log]# systemctl restart rsyslog
[root@station14 log]# ll /var/log/testlog.txt 
-rw-------. 1 root root 5004 Apr 13 14:52 /var/log/testlog.txt
</code></pre>
<h3 id="logrotate">Logrotate</h3>
<p>로그 파일의 순환- 로그 파일의 크기가 과도하게 커지지 않도록 제한</p>
<ul>
<li>logrotate 유틸리티를 사용하여 행해짐, cron에 의해 하루에 한 번씩 실행됨</li>
<li>logrotate는 /etc/logrotate.conf로 한 번에 처리방식을 지정하거나</li>
<li>/etc/logrotate.d에서 각 로그 파일별 개별로 설정해 줄 수도 있다.<pre><code class="language-shell"></code></pre>
</li>
</ul>
<p>[root@station14 log]# vi /etc/logrotate.conf 
      1 # see &quot;man logrotate&quot; for details
      2 # rotate log files weekly
      3 weekly
      4 
      5 # keep 4 weeks worth of backlogs
      6 rotate 4    --weekly이므로, 4주마다 오래된거 자르고 새로 추가
      7 
      8 # create new (empty) log files after rotating old ones
      9 create        --기간지난거 삭제하고 새로 만들겠다.
     10 
     11 # use date as a suffix of the rotated file
     12 dateext        --log 파일 이름 뒤에 붙이겠다.
     13 
     14 # uncomment this if you want your log files compressed
     15 #compress    --압축하지 않겠다.
     16 
     17 # RPM packages drop log rotation information into this directory
     18 include /etc/logrotate.d
     19 
     20 # no packages own wtmp and btmp -- we&#39;ll rotate them here
     21 /var/log/wtmp {
     22     monthly
     23     create 0664 root utmp
     24         minsize 1M
     25     rotate 1
     26 }
     27 
     28 /var/log/btmp {
     29     missingok    --btmp 파일이 없어도 error메시지 보내지말고 rotation시켜라
     30     monthly
     31     create 0600 root utmp
     32     rotate 1
     33 }
     34
     35 /var/log/testlog.txt {         --추가
     36     weekly
     37     rotate 2
     38     create 0600 root hdmi
     39     size +100
     40     compress
     41 }
     42 
     43 # system-specific logs may be also be configured here.</p>
<blockquote>
<p>매일 crone을 통해 logrotate 수행
[root@station14 log]# cat -n /etc/cron.daily/logrotate
     1    #!/bin/sh
     2<br>     3    /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
     4    EXITVALUE=$?
     5    if [ $EXITVALUE != 0 ]; then
     6        /usr/bin/logger -t logrotate &quot;ALERT exited abnormally with [$EXITVALUE]&quot;
     7    fi
     8    exit 0</p>
</blockquote>
<blockquote>
<p>수동으로 logrotate 실행해보자.
[root@station14 log]# logrotate /etc/logrotate.conf
[root@station14 log]# ll /var/log/testlog*
-rw-------. 1 root hdmi    0 Apr 13 15:07 /var/log/testlog.txt
-rw-------. 1 root root 1333 Apr 13 15:01 /var/log/testlog.txt-20230413.gz</p>
</blockquote>
<p>```</p>
<h3 id="국내타임서버리스트">국내타임서버리스트</h3>
<p><a href="http://time.ewha.or.kr/domestic.html">http://time.ewha.or.kr/domestic.html</a> </p>
]]></description>
        </item>
        <item>
            <title><![CDATA[Virtual Machine, Linux install]]></title>
            <link>https://velog.io/@yoni_d/Virtual-Machine-Linux-install</link>
            <guid>https://velog.io/@yoni_d/Virtual-Machine-Linux-install</guid>
            <pubDate>Thu, 13 Apr 2023 00:53:37 GMT</pubDate>
            <description><![CDATA[<h3 id="virtual-machine-make">Virtual Machine Make</h3>
<pre><code class="language-shell">&gt; install
[root@station14 ~]# yum -y install qemu-kvm libvirt virt-manager virt-viewer libvirt-daemon-kvm
Loaded plugins: fastestmirror, langpacks
base                                                                             | 3.6 kB  00:00:00     
classRPMs                                                                        | 2.5 kB  00:00:00     
errataRPMs                                                                       | 2.5 kB  00:00:00     
mysql-connectors-community                                                       | 2.6 kB  00:00:14     
http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-tools-community/el/7/x86_64/repodata/repomd.xml: (28, &#39;Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds&#39;)
Trying other mirror.
mysql-tools-community                                                            | 2.6 kB  00:00:00     
mysql80-community                                                                | 2.6 kB  00:00:00     
Loading mirror speeds from cached hostfile
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package libvirt.x86_64 0:2.0.0-10.el7_3.9 will be installed
--&gt; Processing Dependency: libvirt-daemon-driver-storage = 2.0.0-10.el7_3.9 for package: libvirt-2.0.0-10.el7_3.9.x86_64
...
...
...
Complete!


&gt; 디스크 공간 확인
[root@station14 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root         8.0G  4.0G  4.1G  50% /
devtmpfs                     7.8G     0  7.8G   0% /dev
tmpfs                        7.8G   56M  7.8G   1% /dev/shm
tmpfs                        7.8G  8.7M  7.8G   1% /run
tmpfs                        7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                    494M  151M  344M  31% /boot
/dev/mapper/vg0-tmp         1014M   34M  981M   4% /tmp
/dev/mapper/vg0-var          2.0G  237M  1.8G  12% /var
tmpfs                        1.6G  8.0K  1.6G   1% /run/user/0
server1:/export/netinstall   931G   14G  917G   2% /net/server1/export/netinstall
server1:/export/courserepos  931G   14G  917G   2% /net/server1/export/courserepos

[root@station14 ~]# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 931.5G  0 disk 
├─sda1         8:1    0   500M  0 part /boot
└─sda2         8:2    0  34.2G  0 part 
  ├─vg0-root 253:0    0     8G  0 lvm  /
  ├─vg0-swap 253:1    0   512M  0 lvm  [SWAP]
  ├─vg0-tmp  253:2    0     1G  0 lvm  /tmp
  └─vg0-var  253:3    0     2G  0 lvm  /var
sr0           11:0    1  1024M  0 rom  


&gt; fdisk로 disk에 적용
[root@station14 ~]# fdisk /dev/sda 

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (72706048-1953525167, default 72706048): 
Using default value 72706048
Last sector, +sectors or +size{K,M,G} (72706048-1953525167, default 1953525167): +100G
Partition 3 of type Linux and of size 100 GiB is set

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x0008166c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    72706047    35840000   8e  Linux LVM
/dev/sda3        72706048   282421247   104857600   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.


&gt; lsblk로 확인
[root@station14 ~]# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 931.5G  0 disk 
├─sda1         8:1    0   500M  0 part /boot
└─sda2         8:2    0  34.2G  0 part 
  ├─vg0-root 253:0    0     8G  0 lvm  /
  ├─vg0-swap 253:1    0   512M  0 lvm  [SWAP]
  ├─vg0-tmp  253:2    0     1G  0 lvm  /tmp
  └─vg0-var  253:3    0     2G  0 lvm  /var
sr0           11:0    1  1024M  0 rom

&gt; partprobe후 파티션한 데이터가 반영되어 보임
[root@station14 ~]# partprobe /dev/sda
[root@station14 ~]# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 931.5G  0 disk 
├─sda1         8:1    0   500M  0 part /boot
├─sda2         8:2    0  34.2G  0 part 
│ ├─vg0-root 253:0    0     8G  0 lvm  /
│ ├─vg0-swap 253:1    0   512M  0 lvm  [SWAP]
│ ├─vg0-tmp  253:2    0     1G  0 lvm  /tmp
│ └─vg0-var  253:3    0     2G  0 lvm  /var
└─sda3         8:3    0   100G  0 part        --this one!!
sr0           11:0    1  1024M  0 rom  

&gt; 세번째 파티션을 xfs로 format
[root@station14 ~]# mkfs -t xfs /dev/sda3
meta-data=/dev/sda3              isize=512    agcount=4, agsize=6553600 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=26214400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


&gt; 특정 디렉토리와 연결해주기 위한 mount 필요
[root@station14 ~]# vi /etc/fstab 
--vi /etc/fstab 파일 가장 밑에 아래와 같이 입력 추가!
/dev/sda3               /var/lib/libvirt/images xfs     defaults        0 0

&gt; mount -a(자동으로)
[root@station14 ~]# mount -a


&gt; df- h 로 디스크 영역 확인
[root@station14 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root         8.0G  4.0G  4.1G  50% /
devtmpfs                     7.8G     0  7.8G   0% /dev
tmpfs                        7.8G   40M  7.8G   1% /dev/shm
tmpfs                        7.8G  8.7M  7.8G   1% /run
tmpfs                        7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                    494M  151M  344M  31% /boot
/dev/mapper/vg0-tmp         1014M   34M  981M   4% /tmp
/dev/mapper/vg0-var          2.0G  237M  1.8G  12% /var
tmpfs                        1.6G  8.0K  1.6G   1% /run/user/0
server1:/export/netinstall   931G   14G  917G   2% /net/server1/export/netinstall
server1:/export/courserepos  931G   14G  917G   2% /net/server1/export/courserepos
/dev/sda3                    100G   33M  100G   1% /var/lib/libvirt/images

&gt; 재부팅필요 ( qemu-kvm 커널 모듈이기 때문에)
[root@station14 ~]# reboot

&gt; 재부팅 후 kvm 보임
[root@station14 ~]# lsmod | grep kvm
kvm_intel             170181  0 
kvm                   554609  1 kvm_intel
irqbypass              13503  1 kvm

&gt; gui형태로 vm관리할 수 있는 툴
[root@station14 ~]# virt-manager

</code></pre>
<h3 id="virt-manager">virt-manager</h3>
<p><img src="https://velog.velcdn.com/images/yoni_d/post/b0df1c58-2f4e-491d-9b5c-2ef121509816/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/d50c41f8-2258-486b-97e8-23d1ef405249/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/63fa3b71-41c0-4d9e-98b9-cf8e4c03eedc/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/adfd56f4-a9e4-400d-b738-34f418bd7426/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/b0f6ae1a-ddd6-4e82-b40e-648e04bfbbaa/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/910a1c1c-c6ac-4725-abe2-da58d152a405/image.png" alt=""></p>
<h3 id="centos-linux-7-installation">CENTOS LINUX 7 installation</h3>
<p><img src="https://velog.velcdn.com/images/yoni_d/post/0083380e-92cc-43de-857e-0e40a611e4e7/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/ef0331f9-3587-4e0b-a896-9ad530e08a74/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/77341b88-da96-47da-a1b7-c60146f9c40a/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/04293549-1370-4ef7-9e99-da2bd4751a8a/image.png" alt=""></p>
<h3 id="secureshell">SecureShell</h3>
<p>원격접속 telnet(systemV) , rlogin(BSD), *<em>ssh-&gt; 보안강화(암호문) *</em>
파일전송 ftp(systemV) , rcp(BSD), *<em>sftp/scp-&gt; 보안강화(암호문)
*</em> 
보안강화(암호문): 공개키 - 암호화, 개인키 - 복호화</p>
<h3 id="openssh">OpenSSH</h3>
<pre><code class="language-shell">&gt; .pub가 있는건 공개키, 없는건 개인키
암호화 알고리즘에 따라 여러가지 키쌍이 존재
[root@station14 ~]# ls -l /etc/ssh
total 292
-rw-r--r--. 1 root root     242153 Apr 12  2017 moduli
-rw-r--r--. 1 root root       2208 Apr 12  2017 ssh_config
-rw-------. 1 root root       4361 Apr 12  2017 sshd_config
-rw-r-----. 1 root ssh_keys    668 Apr  8 05:41 ssh_host_dsa_key
-rw-r--r--. 1 root root        590 Apr  8 05:41 ssh_host_dsa_key.pub
-rw-r-----. 1 root ssh_keys    227 Apr  8 05:41 ssh_host_ecdsa_key
-rw-r--r--. 1 root root        162 Apr  8 05:41 ssh_host_ecdsa_key.pub
-rw-r-----. 1 root ssh_keys    387 Apr  8 05:41 ssh_host_ed25519_key
-rw-r--r--. 1 root root         82 Apr  8 05:41 ssh_host_ed25519_key.pub
-rw-r-----. 1 root ssh_keys    965 Apr  8 05:41 ssh_host_key
-rw-r--r--. 1 root root        630 Apr  8 05:41 ssh_host_key.pub
-rw-r-----. 1 root ssh_keys   1675 Apr  8 05:41 ssh_host_rsa_key
-rw-r--r--. 1 root root        382 Apr  8 05:41 ssh_host_rsa_key.pub
You have new mail in /var/spool/mail/root
</code></pre>
<h3 id="virtual-machine-snapshot">Virtual Machine snapshot</h3>
<blockquote>
<p>VM shutdown 후,dual monitor 아이콘 클릭을 통해 snapshot
virtual Machine 문제가 생기면 snapshot 선택 후, 왼쪽 하단 play 버튼 클릭
전구 버튼을 통해 다시 실행
<img src="https://velog.velcdn.com/images/yoni_d/post/e8ae973c-8854-491b-8775-fae6042c5dde/image.png" alt="">
<img src="https://velog.velcdn.com/images/yoni_d/post/b73080a2-fc39-4c77-b107-fd6dd971d8b2/image.png" alt=""></p>
</blockquote>
<h3 id="in-virtual-machine-terminal">in virtual Machine Terminal</h3>
<p>vi /etc/ssh/sshd_config
#PermitRootLogin yes -- root 에 ssh로 접속 가능 여부 (보안 취약!주석 해제 후 no로 바꾸기)</p>
<pre><code class="language-shell">[root@localhost ~]# vi /etc/ssh/sshd_config 
     46 # Authentication:
     47 
     48 LoginGraceTime 10m
     49 PermitRootLogin no
     50 #StrictModes yes
     51 MaxAuthTries 2
     52 #MaxSessions 10

    137 Banner /etc/issue
    138 AllowUsers aaa , yoni


[root@localhost ~]# vi /etc/issue
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# useradd aaa
pa[root@localhost ~]# passwd aaa
Changing password for user aaa.
New password: bbb
BAD PASSWORD: The password is a palindrome
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@localhost ~]# ifconfig eth0
eth0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500
        inet 192.168.122.253  netmask 255.255.255.0  broadcast 192.168.122.255
        inet6 fe80::5054:ff:fe10:511b  prefixlen 64  scopeid 0x20&lt;link&gt;
        ether 52:54:00:10:51:1b  txqueuelen 1000  (Ethernet)
        RX packets 643  bytes 37393 (36.5 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 146  bytes 13863 (13.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

&gt; root 접속은 막아두어서 접속 안됨
[root@localhost ~]# ssh root@192.168.122.253
The authenticity of host &#39;192.168.122.253 (192.168.122.253)&#39; can&#39;t be established.
ECDSA key fingerprint is d3:2b:d4:c6:8a:41:dd:d3:ea:00:87:33:f7:69:94:4e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added &#39;192.168.122.253&#39; (ECDSA) to the list of known hosts.
Warning

root@192.168.122.253&#39;s password: 
Permission denied, please try again.
root@192.168.122.253&#39;s password: 
Received disconnect from 192.168.122.253: 2: Too many authentication failures for root


&gt; 일반 유저 aaa, yoni는 접속 됨
[root@localhost ~]# ssh aaa@192.168.122.253
Welcome

aaa@192.168.122.253&#39;s password: bbb
Last login: Thu Apr 13 11:17:13 2023 from 192.168.122.253
[aaa@localhost ~]$ exit
logout
Connection to 192.168.122.253 closed.

[root@localhost ~]# ssh yoni@192.168.122.253
Welcome

yoni@192.168.122.253&#39;s password: kabang
Last login: Thu Apr 13 11:17:06 2023 from 192.168.122.253
[yoni@localhost ~]$ 


&gt; sftp
[root@localhost ~]# sftp yoni@192.168.122.253
Welcome

yoni@192.168.122.253&#39;s password: 
Connected to 192.168.122.253.
sftp&gt; pwd
Remote working directory: /home/yoni
sftp&gt; put /etc/fstab    -- 파일 업로드    
Uploading /etc/fstab to /home/yoni/fstab
/etc/fstab                                                                    100%  465     0.5KB/s   00:00    
sftp&gt; ls
fstab  
sftp&gt; cd /etc
sftp&gt; get yum.conf       --접속했을 당시 디렉토리로 다운로드
Fetching /etc/yum.conf to yum.conf
/etc/yum.conf                                                                 100%  970     1.0KB/s   00:00    
sftp&gt; quit                -- 접속 끊음


&gt; yum.conf 다운한거 확인
[root@localhost ~]# ll
total 12
-rw-------. 1 root root 1672 Apr 13 10:43 anaconda-ks.cfg
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Desktop
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Documents
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Downloads
-rw-r--r--. 1 root root 1720 Apr 13 10:46 initial-setup-ks.cfg
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Music
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Pictures
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Public
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Templates
drwxr-xr-x. 2 root root    6 Apr 13 10:46 Videos
-rw-r--r--. 1 root root  970 Apr 13 11:21 yum.conf --This one!!!

</code></pre>
<h3 id="ssh-keygen-설정">ssh-keygen 설정</h3>
<pre><code class="language-shell">[root@localhost .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
56:47:e4:0f:45:ec:d4:3d:84:8a:84:49:de:b4:12:34 root@localhost.localdomain
The key&#39;s randomart image is:
+--[ RSA 2048]----+
|      oEo. .oo=o.|
|      .o=..o oo.o|
|       o.oo =o  .|
|        .o o o.  |
|        S     .  |
|       .         |
|                 |
|                 |
|                 |
+-----------------+
[root@localhost .ssh]# ll
total 12
-rw-------. 1 root root 1675 Apr 13 11:55 id_rsa
-rw-r--r--. 1 root root  408 Apr 13 11:55 id_rsa.pub
-rw-r--r--. 1 root root  177 Apr 13 11:10 known_hosts

&gt; Virtual Machine의 yoni 계정에 ssh 접속 key설정
[root@localhost .ssh]# ssh-copy-id yoni@192.168.122.253
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Welcome

yoni@192.168.122.253&#39;s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   &quot;ssh &#39;yoni@192.168.122.253&#39;&quot;
and check to make sure that only the key(s) you wanted were added.

[root@localhost .ssh]# ssh yoni@192.168.122.253
Welcome

Last failed login: Thu Apr 13 11:56:01 KST 2023 from 192.168.122.253 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Thu Apr 13 11:19:32 2023 from 192.168.122.253
[yoni@localhost ~]$ ls -ld .ssh/
drwx------. 2 yoni yoni 29 Apr 13 11:56 .ssh/
[yoni@localhost ~]$ cd .ssh/
[yoni@localhost .ssh]$ ll
total 4
-rw-------. 1 yoni yoni 408 Apr 13 11:56 authorized_keys
</code></pre>
<h4 id="aaa-일반-계정에서-vm의-yoni계정으로-ssh-접속-설정">aaa 일반 계정에서 vm의 yoni계정으로 ssh 접속 설정</h4>
<pre><code class="language-shell">&gt; key 생성
[aaa@localhost .ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/aaa/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/aaa/.ssh/id_rsa.
Your public key has been saved in /home/aaa/.ssh/id_rsa.pub.
The key fingerprint is:
36:17:52:b3:25:bd:6e:dd:b8:ba:12:e7:0e:ad:1f:df aaa@localhost.localdomain
The key&#39;s randomart image is:
+--[ RSA 2048]----+
|          +..    |
|         . =.    |
|        . o  .   |
|         . ..    |
|        S .. . o |
|       . o..+ o .|
|          .=o  . |
|          .o.o.. |
|          .+=o. E|
+-----------------+


&gt; vm의 yoni계정에 ssh 등록
[aaa@localhost .ssh]$ ssh-copy-id yoni@192.168.122.253
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Welcome

yoni@192.168.122.253&#39;s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   &quot;ssh &#39;yoni@192.168.122.253&#39;&quot;
and check to make sure that only the key(s) you wanted were added.


&gt; ssh 로 vm의 yoni 계정 접속
[aaa@localhost .ssh]$ ssh yoni@192.168.122.253
Welcome

Enter passphrase for key &#39;/home/aaa/.ssh/id_rsa&#39;:  --비번 적으라고 함
Last failed login: Thu Apr 13 13:47:41 KST 2023 from 192.168.122.253 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Thu Apr 13 12:23:18 2023 from 192.168.122.253
[yoni@localhost ~]$ exit
logout
Connection to 192.168.122.253 closed함

&gt; ssh-agent를 통해 passphrase 비밀번호를 자동 등록해보자.
[aaa@localhost .ssh]$ eval `ssh-agent`
Agent pid 6458
[aaa@localhost .ssh]$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /home/aaa/.ssh/id_rsa: 
Identity added: /home/aaa/.ssh/id_rsa (/home/aaa/.ssh/id_rsa)

&gt; 자동 로그인 됨 (비밀번호 생략)
[aaa@localhost .ssh]$ ssh yoni@192.168.122.253
Welcome

Last login: Thu Apr 13 13:48:40 2023 from 192.168.122.253
[yoni@localhost ~]$ 

</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[process]]></title>
            <link>https://velog.io/@yoni_d/process</link>
            <guid>https://velog.io/@yoni_d/process</guid>
            <pubDate>Wed, 12 Apr 2023 06:34:14 GMT</pubDate>
            <description><![CDATA[<p>ppid : 부모프로세스 id
swap memory : 메모리 부족하면 swap 영역으로 내려가서 다른 process 실행</p>
<h4 id="process-state">Process state</h4>
<p>top 커맨드 : 현재 process 및 system 정보를 실시간으로 보여줌</p>
<pre><code>[root@station14 home]# top

top - 15:20:40 up  5:40,  3 users,  load average: 0.08, 0.05, 0.05
Tasks: 238 total,   1 running, 237 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.4 us,  0.2 sy,  0.0 ni, 99.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
-- cpu 사용률 sy(커널,시스템) ni(nice value) id(idel) wa(waiting) hi(h/w interrupt를 하면서 소모된 cpu사용량) si (s/w interrupt를 하면서 소모된 cpu사용량)
interrupt가 높다는 것: cpu가 하던일을 멈추고 딴 일을 많이 한다.

KiB Mem : 16305016 total, 14298772 free,  1183132 used,   823112 buff/cache
KiB Swap:   524284 total,   524284 free,        0 used. 14621136 avail Mem 
-- swap이 많이 사용된다 : 물리적 메모리가 부족하다.
메모리 부족 -&gt; 프로그램 실행 못함.
swap 사용하기 위해 메모리에서 hdd swap 에 내려야하고, 나중엔 다시 올려야함.
=&gt; 즉 빈번한 swap 읽고 쓰기는 시스템 성능을 저하시킴.


&lt;아래 컬럼 의미&gt;
PID프로세스번호 
USER 유저 
PR 우선순위(낮을수록 속도 빨라짐)
NI (nice value) -&gt; PR값 에 영향
VIRT 물리적 메모리 + swap
RES 실제 프로세스가 사용하는 물리적 메모리
SHR 공유 메모리(shared memory)
%CPU cpu 사용량
TIME+ 실행되고나서 누적 cpu사용시간

&lt;단축키&gt;
shift + P : cpu많이 사용하는 순 정렬
shift + M : 물리적 메모리 많이 사용하는순 정렬
K : 특정 프로세스 종료하고자 할 때 pid 입력
shift + ? : 명령어들의 단축키


PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                            
 2108 root      20   0 2356848 317392  86424 S   2.0  1.9   6:28.19 firefox                            
 1246 root      20   0  464016  43724  33924 S   1.7  0.3   1:36.79 Xorg                               
 2218 root      20   0 2393560 425356  64516 S   1.3  2.6  16:42.25 Web Content                        
 1770 root      20   0 1803332 142320  38704 S   0.3  0.9   1:43.55 gnome-shell                        
 2018 root      20   0  711340  21652  12788 S   0.3  0.1   0:27.63 gnome-terminal-                    
 5699 root      20   0  159896   2384   1560 R   0.3  0.0   0:00.60 top                                
    1 root      20   0  195816   6952   3976 S   0.0  0.0   0:02.16 systemd                            
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.01 kthreadd                           
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.07 ksoftirqd/0                        
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                       
    7 root      rt   0       0      0      0 S   0.0  0.0   0:00.01 migration/0                        
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh                             
    9 root      20   0       0      0      0 S   0.0  0.0   0:02.14 rcu_sched                          
   10 root      rt   0       0      0      0 S   0.0  0.0   0:00.05 watchdog/0                         
</code></pre><h3 id="system-관련-정보">System 관련 정보</h3>
<pre><code class="language-shell">&gt; /proc/cpuinfo == lscpu (cpu에 대한 정보)
[root@station14 /home]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Model name:            Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Stepping:              9
CPU MHz:               2385.976
BogoMIPS:              6784.77
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-7

&gt; mpstat
[root@station14 /home]# mpstat
Linux 3.10.0-514.26.1.el7.x86_64 (station14.example.com)     04/12/2023     _x86_64_    (8 CPU)

03:52:32 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:52:32 PM  all    0.93    0.00    0.16    0.05    0.00    0.00    0.00    0.00    0.00   98.86


&gt; mpstat -P ALL 하면 너무 많음
[root@station14 /home]# mpstat -P ALL
Linux 3.10.0-514.26.1.el7.x86_64 (station14.example.com)     04/12/2023     _x86_64_    (8 CPU)

03:53:43 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:53:43 PM  all    0.94    0.00    0.16    0.05    0.00    0.00    0.00    0.00    0.00   98.85
03:53:43 PM    0    1.18    0.00    0.22    0.06    0.00    0.00    0.00    0.00    0.00   98.53
03:53:43 PM    1    1.24    0.00    0.19    0.18    0.00    0.00    0.00    0.00    0.00   98.38
03:53:43 PM    2    1.22    0.00    0.19    0.03    0.00    0.00    0.00    0.00    0.00   98.56
03:53:43 PM    3    1.18    0.00    0.23    0.03    0.00    0.00    0.00    0.00    0.00   98.55
03:53:43 PM    4    0.73    0.00    0.10    0.02    0.00    0.00    0.00    0.00    0.00   99.14
03:53:43 PM    5    0.75    0.00    0.10    0.02    0.00    0.00    0.00    0.00    0.00   99.13
03:53:43 PM    6    0.50    0.00    0.15    0.03    0.00    0.00    0.00    0.00    0.00   99.31
03:53:43 PM    7    0.67    0.00    0.09    0.01    0.00    0.00    0.00    0.00    0.00   99.22

&gt; 10초 간격으로 2번 mpstat를 실행
[root@station14 /home]# mpstat 10 2 -P ALL
Linux 3.10.0-514.26.1.el7.x86_64 (station14.example.com)     04/12/2023     _x86_64_    (8 CPU)

--첫번째는 부팅후 현재까지 누적치이므로 버리는값
03:54:43 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:54:53 PM  all    4.20    0.05    0.55    0.04    0.00    0.00    0.00    0.00    0.00   95.16
03:54:53 PM    0    2.52    0.00    0.60    0.00    0.00    0.00    0.00    0.00    0.00   96.88
03:54:53 PM    1    2.70    0.20    0.50    0.10    0.00    0.00    0.00    0.00    0.00   96.50
03:54:53 PM    2    4.60    0.00    0.50    0.00    0.00    0.00    0.00    0.00    0.00   94.90
03:54:53 PM    3    6.22    0.00    0.80    0.10    0.00    0.00    0.00    0.00    0.00   92.88
03:54:53 PM    4    1.40    0.00    0.30    0.00    0.00    0.00    0.00    0.00    0.00   98.29
03:54:53 PM    5   14.01    0.00    0.80    0.00    0.00    0.00    0.00    0.00    0.00   85.19
03:54:53 PM    6    1.41    0.00    0.60    0.00    0.00    0.00    0.00    0.00    0.00   97.99
03:54:53 PM    7    0.80    0.30    0.30    0.00    0.00    0.00    0.00    0.00    0.00   98.60

03:54:53 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
03:55:03 PM  all    6.86    0.05    0.95    0.05    0.00    0.00    0.00    0.00    0.00   92.09
03:55:03 PM    0    9.46    0.10    1.89    0.10    0.00    0.00    0.00    0.00    0.00   88.45
03:55:03 PM    1    7.82    0.00    0.70    0.20    0.00    0.00    0.00    0.00    0.00   91.27
03:55:03 PM    2   15.72    0.10    1.20    0.00    0.00    0.00    0.00    0.00    0.00   82.98
03:55:03 PM    3    6.39    0.00    1.10    0.10    0.00    0.00    0.00    0.00    0.00   92.41
03:55:03 PM    4   11.29    0.00    1.00    0.10    0.00    0.00    0.00    0.00    0.00   87.61
03:55:03 PM    5    1.30    0.10    0.30    0.00    0.00    0.00    0.00    0.00    0.00   98.30
03:55:03 PM    6    1.91    0.10    0.90    0.00    0.00    0.00    0.00    0.00    0.00   97.09
03:55:03 PM    7    1.00    0.20    0.40    0.00    0.00    0.00    0.00    0.00    0.00   98.40

Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
Average:     all    5.53    0.05    0.75    0.04    0.00    0.00    0.00    0.00    0.00   93.63
Average:       0    6.01    0.05    1.25    0.05    0.00    0.00    0.00    0.00    0.00   92.64
Average:       1    5.26    0.10    0.60    0.15    0.00    0.00    0.00    0.00    0.00   93.89
Average:       2   10.16    0.05    0.85    0.00    0.00    0.00    0.00    0.00    0.00   88.94
Average:       3    6.31    0.00    0.95    0.10    0.00    0.00    0.00    0.00    0.00   92.64
Average:       4    6.36    0.00    0.65    0.05    0.00    0.00    0.00    0.00    0.00   92.94
Average:       5    7.66    0.05    0.55    0.00    0.00    0.00    0.00    0.00    0.00   91.74
Average:       6    1.66    0.05    0.75    0.00    0.00    0.00    0.00    0.00    0.00   97.54
Average:       7    0.90    0.25    0.35    0.00    0.00    0.00    0.00    0.00    0.00   98.50
</code></pre>
<h3 id="memory-관련-정보">Memory 관련 정보</h3>
<pre><code>[root@station14 /home]# free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        1.6G         13G        250M        944M         13G
Swap:          511M          0B        511M
[root@station14 /home]# cat /proc/meminfo
MemTotal:       16305016 kB
MemFree:        13722620 kB
MemAvailable:   14102220 kB
Buffers:            1008 kB
Cached:           839104 kB
SwapCached:            0 kB
Active:          1593648 kB
Inactive:         693744 kB
Active(anon):    1451108 kB
Inactive(anon):   229928 kB
Active(file):     142540 kB
Inactive(file):   463816 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:        524284 kB
SwapFree:         524284 kB
Dirty:              1052 kB
Writeback:             0 kB
AnonPages:       1447180 kB
Mapped:           264116 kB
Shmem:            233756 kB
Slab:             104316 kB
SReclaimable:      49968 kB
SUnreclaim:        54348 kB
KernelStack:        8240 kB
PageTables:        27792 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8676792 kB
Committed_AS:    4917936 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      376780 kB
VmallocChunk:   34358947836 kB
HardwareCorrupted:     0 kB
AnonHugePages:    264192 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      124240 kB
DirectMap2M:    16525312 kB
[root@station14 /home]# cat /proc/swaps 
Filename                Type        Size    Used    Priority
/dev/dm-1                               partition    524284    0    -1
</code></pre><h3 id="foreground--background">foreground &amp; background</h3>
<p>특정 프로그램 뒤에 &amp; 붙이면 background process로 실행</p>
<pre><code class="language-shell">&gt; sleep -&gt; foreground
&gt; fg: background process -&gt; foreground process
bg: foreground process -&gt; background process
jobs : job id 확인
&gt; ctrl + z: running중인 프로그램 일시 정지


[root@station14 /home]# sleep 30
[root@station14 /home]# sleep 3000 &amp;
[1] 6224
[root@station14 /home]# ps
  PID TTY          TIME CMD
 5384 pts/1    00:00:00 bash
 5996 pts/1    00:00:00 csh
 6224 pts/1    00:00:00 sleep
 6225 pts/1    00:00:00 ps
[root@station14 /home]# jobs
[1]  + Running                       sleep 3000
[root@station14 /home]# fg %1
sleep 3000                -- foreground 명령어가 실행 중이라 다른 커맨함(jobs) 입력못함
^Z
Suspended
[root@station14 /home]# ps  
  PID TTY          TIME CMD
 5384 pts/1    00:00:00 bash
 5996 pts/1    00:00:00 csh
 6224 pts/1    00:00:00 sleep        -- 아직 메모리에 있는데 cpu에 접근 안되는걸 알 수 있다.
 6270 pts/1    00:00:00 ps

[root@station14 /home]# jobs
[1]  + Suspended                     sleep 3000   --[1]: job id

[root@station14 /home]# bg %1            -- background로 전환
[1]    sleep 3000 &amp;

[root@station14 /home]# jobs
[1]    Running                       sleep 3000        -- 다시 running이 된 모습

ctrl + z ( or ctrl + c) 입력 &gt; 일시정지
[root@station14 /home]# jobs
[1]    Running                       sleep 3000        -- 정지 안되는 모습 (백그라운드이므로)

&gt; signal 정지 확인
[root@station14 ~]$ kill -l
 1) SIGHUP     2) SIGINT     3) SIGQUIT     4) SIGILL     5) SIGTRAP
 6) SIGABRT     7) SIGBUS     8) SIGFPE     9) SIGKILL    10) SIGUSR1
11) SIGSEGV    12) SIGUSR2    13) SIGPIPE    14) SIGALRM    15) SIGTERM
16) SIGSTKFLT    17) SIGCHLD    18) SIGCONT    19) SIGSTOP    20) SIGTSTP
21) SIGTTIN    22) SIGTTOU    23) SIGURG    24) SIGXCPU    25) SIGXFSZ
26) SIGVTALRM    27) SIGPROF    28) SIGWINCH    29) SIGIO    30) SIGPWR
31) SIGSYS    34) SIGRTMIN    35) SIGRTMIN+1    36) SIGRTMIN+2    37) SIGRTMIN+3
38) SIGRTMIN+4    39) SIGRTMIN+5    40) SIGRTMIN+6    41) SIGRTMIN+7    42) SIGRTMIN+8
43) SIGRTMIN+9    44) SIGRTMIN+10    45) SIGRTMIN+11    46) SIGRTMIN+12    47) SIGRTMIN+13
48) SIGRTMIN+14    49) SIGRTMIN+15    50) SIGRTMAX-14    51) SIGRTMAX-13    52) SIGRTMAX-12
53) SIGRTMAX-11    54) SIGRTMAX-10    55) SIGRTMAX-9    56) SIGRTMAX-8    57) SIGRTMAX-7
58) SIGRTMAX-6    59) SIGRTMAX-5    60) SIGRTMAX-4    61) SIGRTMAX-3    62) SIGRTMAX-2
63) SIGRTMAX-1    64) SIGRTMAX    

&gt; ps를 통해 pid확인
[root@station14 ~]# ps
  PID TTY          TIME CMD
 5384 pts/1    00:00:00 bash
 5996 pts/1    00:00:00 csh
 6224 pts/1    00:00:00 sleep
 6301 pts/1    00:00:00 ps

[root@station14 ~]# kill -19 6224
[1]  + Suspended (signal)            sleep 3000

&gt; killall 사용시 pid 몰라도됨.</code></pre>
<h4 id="httpd--pgrep-pkill">httpd , pgrep, pkill</h4>
<pre><code class="language-shell">[root@station14 ~]# yum -y install httpd
Loaded plugins: fastestmirror, langpacks
base                                                                             | 3.6 kB  00:00:00     
classRPMs                                                                        | 2.5 kB  00:00:00     
errataRPMs                                                                       | 2.5 kB  00:00:00     
mysql-connectors-community                                                       | 2.6 kB  00:00:00     
mysql-tools-community                                                            | 2.6 kB  00:00:00     
mysql80-community                                                                | 2.6 kB  00:00:00     
Loading mirror speeds from cached hostfile
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package httpd.x86_64 0:2.4.6-45.el7.centos.4 will be installed
--&gt; Processing Dependency: httpd-tools = 2.4.6-45.el7.centos.4 for package: httpd-2.4.6-45.el7.centos.4.x86_64
--&gt; Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.centos.4.x86_64
--&gt; Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.centos.4.x86_64
--&gt; Running transaction check
---&gt; Package apr.x86_64 0:1.4.8-3.el7 will be installed
---&gt; Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---&gt; Package httpd-tools.x86_64 0:2.4.6-45.el7.centos.4 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package                 Arch               Version                              Repository        Size
========================================================================================================
Installing:
 httpd                   x86_64             2.4.6-45.el7.centos.4                base             2.7 M
Installing for dependencies:
 apr                     x86_64             1.4.8-3.el7                          base             103 k
 apr-util                x86_64             1.5.2-6.el7                          base              92 k
 httpd-tools             x86_64             2.4.6-45.el7.centos.4                base              84 k

Transaction Summary
========================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 3.0 M
Installed size: 9.9 M
Downloading packages:
--------------------------------------------------------------------------------------------------------
Total                                                                    10 MB/s | 3.0 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                                               1/4 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                          2/4 
  Installing : httpd-tools-2.4.6-45.el7.centos.4.x86_64                                             3/4 
  Installing : httpd-2.4.6-45.el7.centos.4.x86_64                                                   4/4 
  Verifying  : httpd-tools-2.4.6-45.el7.centos.4.x86_64                                             1/4 
  Verifying  : apr-1.4.8-3.el7.x86_64                                                               2/4 
  Verifying  : httpd-2.4.6-45.el7.centos.4.x86_64                                                   3/4 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                          4/4 

Installed:
  httpd.x86_64 0:2.4.6-45.el7.centos.4                                                                  

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7  apr-util.x86_64 0:1.5.2-6.el7  httpd-tools.x86_64 0:2.4.6-45.el7.centos.4 


[root@station14 ~]# systemctl start httpd

&gt; 안보임
ps -f[root@station14 ~]# ps -f
UID        PID  PPID  C STIME TTY          TIME CMD
root      5384  2018  0 14:29 pts/1    00:00:00 bash
root      5996  5384  0 15:49 pts/1    00:00:00 -sh
root      6224  5996  0 16:09 pts/1    00:00:00 sleep 3000
root      6558  5996  0 16:41 pts/1    00:00:00 ps -f

[root@station14 ~]# ps -ef | grep httpd
root      6552     1  0 16:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6553  6552  0 16:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6554  6552  0 16:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6555  6552  0 16:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6556  6552  0 16:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6557  6552  0 16:41 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root      6591  5996  0 16:44 pts/1    00:00:00 grep --color=auto httpd

&gt; killall 명령어 실행 (이름으로 kill)
[root@station14 ~]# killall httpd 
[root@station14 ~]# ps -ef | grep httpd
root      6643  5996  0 16:47 pts/1    00:00:00 grep --color=auto httpd


[root@station14 ~]# systemctl start httpd  --다시 재실행
[root@station14 ~]# ps -ef | grep httpd 
root      6651     1  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6652  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6653  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6654  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6655  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache  

&gt; ND로 끝나는 것들 확인
[root@station14 ~]# ps -ef | grep ND$
root      6651     1  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6652  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6653  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6654  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6655  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache    6656  6651  0 16:47 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

[root@station14 ~]# pkill pd[root@station14 ~]# pkill ND$


&gt; guru user로 sleep 실행
[guru@station14 ~]$ sleep 4000 &amp;
[2] 6749
[guru@station14 ~]$ exit
logout
There are stopped jobs.
[guru@station14 ~]$ pgrep sleep
6224
6749

[guru@station14 ~]$ ps -ef | grep sleep
root      6224  5996  0 16:09 pts/1    00:00:00 sleep 3000
guru      6748  6703  0 16:52 pts/1    00:00:00 sleep 4000
guru      6749  6703  0 16:52 pts/1    00:00:00 sleep 4000
guru      6761  6703  0 16:53 pts/1    00:00:00 grep --color=auto sleep

[guru@station14 ~]$ ps -ef | grep sleep
root      6224  5996  0 16:09 pts/1    00:00:00 sleep 3000
guru      6749  6703  0 16:52 pts/1    00:00:00 sleep 4000
guru      6764  6703  0 16:53 pts/1    00:00:00 grep --color=auto sleep
[guru@station14 ~]$ pgrep sleep
6224
6749

[guru@station14 ~]$ ps -ef | grep guru
root      5340  2025  0 14:28 pts/0    00:00:00 su - guru
guru      5341  5340  0 14:28 pts/0    00:00:00 -bash
root      6702  5996  0 16:51 pts/1    00:00:00 su - guru
guru      6703  6702  0 16:51 pts/1    00:00:00 -bash
guru      6749  6703  0 16:52 pts/1    00:00:00 sleep 4000
guru      6768  6703  0 16:54 pts/1    00:00:00 ps -ef
guru      6769  6703  0 16:54 pts/1    00:00:00 grep --color=auto guru

[guru@station14 ~]$ pkill -u guru
[2]+  Terminated              sleep 4000

[guru@station14 ~]$ ps -ef | grep guru
root      5340  2025  0 14:28 pts/0    00:00:00 su - guru
guru      5341  5340  0 14:28 pts/0    00:00:00 -bash
root      6702  5996  0 16:51 pts/1    00:00:00 su - guru
guru      6703  6702  0 16:51 pts/1    00:00:00 -bash
guru      6816  6703  0 16:55 pts/1    00:00:00 ps -ef
guru      6817  6703  0 16:55 pts/1    00:00:00 grep --color=auto guru</code></pre>
<h4 id="nice">nice</h4>
<pre><code class="language-shell">[guru@station14 ~]$ sleep 100 &amp;
[1] 6928
[guru@station14 ~]$ ps -f
UID        PID  PPID  C STIME TTY          TIME CMD
guru      6703  6702  0 16:51 pts/1    00:00:00 -bash
guru      6928  6703  0 17:03 pts/1    00:00:00 sleep 100
guru      6929  6703  0 17:03 pts/1    00:00:00 ps -f
[guru@station14 ~]$ ps -l -- 자세히 확인( nice value가 0)
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S  1000  6703  6702  0  80   0 - 29521 wait   pts/1    00:00:00 bash
0 S  1000  6928  6703  0  80   0 - 27485 hrtime pts/1    00:00:00 sleep
0 R  1000  6930  6703  0  80   0 - 37744 -      pts/1    00:00:00 ps
[guru@station14 ~]$ killall sleep
sleep(6224): Operation not permitted
[1]+  Terminated              sleep 100
[guru@station14 ~]$ nice -n 5 sleep 1000 &amp;   -- nice 값 5 만큼 올려서 sleep 1000을 background로 실행 (-&gt; 속도도 5만큼 느려짐) 
[1] 6939
.[guru@station14 ~]$ ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S  1000  6703  6702  0  80   0 - 29521 wait   pts/1    00:00:00 bash
0 S  1000  6939  6703  0  85   5 - 27485 hrtime pts/1    00:00:00 sleep
0 R  1000  6945  6703  0  80   0 - 37744 -      pts/1    00:00:00 ps

[guru@station14 ~]$ renice -n -3 6939 -- nice값 3만큼 내림



&gt; visitor에서 실행해보기
[root@station14 ~]# su - visitor
Last login: Mon Apr 10 10:54:08 KST 2023 on tty5
[visitor@station14 ~]$ ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S  1001  7025  7024  0  80   0 - 29521 wait   pts/1    00:00:00 bash
0 R  1001  7062  7025  0  80   0 - 37744 -      pts/1    00:00:00 ps
[visitor@station14 ~]$ nice -n -5 sleep 300 &amp;
[1] 7063
[visitor@station14 ~]$ nice: cannot set niceness: Permission denied
^C
[visitor@station14 ~]$ ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S  1001  7025  7024  0  80   0 - 29521 wait   pts/1    00:00:00 bash
0 S  1001  7063  7025  0  80   0 - 27485 hrtime pts/1    00:00:00 sleep
0 R  1001  7072  7025  0  80   0 - 37744 -      pts/1    00:00:00 ps
[visitor@station14 ~]$ renice -n 7 7063
7063 (process ID) old priority 0, new priority 7
[visitor@station14 ~]$ ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S  1001  7025  7024  0  80   0 - 29521 wait   pts/1    00:00:00 bash
0 S  1001  7063  7025  0  87   7 - 27485 hrtime pts/1    00:00:00 sleep
0 R  1001  7075  7025  0  80   0 - 37744 -      pts/1    00:00:00 ps

&gt; priority가 올라가면 그만큼 속도가 느려짐.
일반 유저에서는 nice 한번 올린 값은 절대로 밑으로 못내림 (즉 일방통행, 같은 양수임에도 내려가는거 못함.)
따라서 root 에서만 실행한다.
nice -&gt; 특정 process가 cpu를 너무 많이 사용할때, nice값을 올려서 priority값을 올리고 cpu의 접근을 막아서 다른 process를 처리하도록 할 때 사용한다.

</code></pre>
<h4 id="lab">lab</h4>
<pre><code class="language-shell">[root@station14 ~]# su -c &quot;yum install -y xterm&quot;
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package xterm.x86_64 0:295-3.el7 will be installed
--&gt; Processing Dependency: libXaw.so.7()(64bit) for package: xterm-295-3.el7.x86_64
--&gt; Running transaction check
---&gt; Package libXaw.x86_64 0:1.0.12-5.el7 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package                Arch                   Version                       Repository            Size
========================================================================================================
Installing:
 xterm                  x86_64                 295-3.el7                     base                 455 k
Installing for dependencies:
 libXaw                 x86_64                 1.0.12-5.el7                  base                 190 k

Transaction Summary
========================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 645 k
Installed size: 1.7 M
Downloading packages:
--------------------------------------------------------------------------------------------------------
Total                                                                   4.3 MB/s | 645 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libXaw-1.0.12-5.el7.x86_64                                                           1/2 
  Installing : xterm-295-3.el7.x86_64                                                               2/2 
  Verifying  : libXaw-1.0.12-5.el7.x86_64                                                           1/2 
  Verifying  : xterm-295-3.el7.x86_64                                                               2/2 

Installed:
  xterm.x86_64 0:295-3.el7                                                                              

Dependency Installed:
  libXaw.x86_64 0:1.0.12-5.el7                                                                          

Complete!
[root@station14 ~]# man bash
[root@station14 ~]# jobs -l
[root@station14 ~]# man bash
[root@station14 ~]# man bash

[1]+  Stopped                 man bash
[root@station14 ~]# jobs -l
[1]+  7192 Stopped                 man bash
[root@station14 ~]# vim /etc/fstab 

[2]+  Stopped                 vim /etc/fstab
[root@station14 ~]# vim /etc/pam.d/ &amp;
[3] 7238
[root@station14 ~]# nautilus &amp;
[4] 7240

[3]+  Stopped                 vim /etc/pam.d/
[root@station14 ~]# 
(nautilus:7240): Gtk-WARNING **: cannot open display: 

[4]   Exit 1                  nautilus
[root@station14 ~]# gedit &amp;
[4] 7244
[root@station14 ~]# 
(gedit:7244): Gtk-WARNING **: cannot open display: 

[4]   Exit 1                  gedit
[root@station14 ~]# xterm &amp;
[4] 7248
[root@station14 ~]# Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can&#39;t open display: %s
xterm: DISPLAY is not set

[4]   Exit 1                  xterm
[root@station14 ~]# jobs -l
[1]   7192 Stopped                 man bash
[2]-  7228 Stopped                 vim /etc/fstab
[3]+  7238 Stopped (tty output)    vim /etc/pam.d/
[root@station14 ~]# nautilus &amp;
[4] 7249
[root@station14 ~]# 
(nautilus:7249): Gtk-WARNING **: cannot open display: 
^C
[4]   Exit 1                  nautilus
[root@station14 ~]# gedit &amp;
[4] 7251
[root@station14 ~]# 
(gedit:7251): Gtk-WARNING **: cannot open display: 
^C
[4]   Exit 1                  gedit
[root@station14 ~]# xterm &amp;
[4] 7255
[root@station14 ~]# Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can&#39;t open display: %s
xterm: DISPLAY is not set

[4]   Exit 1                  xterm
[root@station14 ~]# jobs -l
[1]   7192 Stopped                 man bash
[2]-  7228 Stopped                 vim /etc/fstab
[3]+  7238 Stopped (tty output)    vim /etc/pam.d/
[root@station14 ~]# ps f t
  PID TTY      STAT   TIME COMMAND
 5384 pts/1    Ss     0:00 bash
 5996 pts/1    S      0:00  \_ -sh
 6224 pts/1    T      0:00      \_ sleep 3000
 6702 pts/1    S      0:00      \_ su - guru
 6703 pts/1    S      0:00          \_ -bash
 6939 pts/1    SN     0:00              \_ sleep 1000
 6975 pts/1    S      0:00              \_ su -
 6979 pts/1    S      0:00                  \_ -bash
 7024 pts/1    S      0:00                      \_ su - visitor
 7025 pts/1    S      0:00                          \_ -bash
 7096 pts/1    S      0:00                              \_ su -
 7100 pts/1    S      0:00                                  \_ -bash
 7192 pts/1    T      0:00                                      \_ man bash
 7203 pts/1    T      0:00                                      |   \_ less -s
 7228 pts/1    T      0:00                                      \_ vim /etc/fstab
 7238 pts/1    T      0:00                                      \_ vim /etc/pam.d/
 7257 pts/1    R+     0:00                                      \_ ps f t
[root@station14 ~]# ps --ppid $$
  PID TTY          TIME CMD
 7192 pts/1    00:00:00 man
 7228 pts/1    00:00:00 vim
 7238 pts/1    00:00:00 vim
 7259 pts/1    00:00:00 ps
[root@station14 ~]# pstree
systemd─┬─NetworkManager─┬─dhclient
        │                └─2*[{NetworkManager}]
        ├─2*[abrt-watch-log]
        ├─abrtd
        ├─accounts-daemon───2*[{accounts-daemon}]
        ├─acpid
        ├─at-spi-bus-laun─┬─dbus-daemon───{dbus-daemon}
        │                 └─3*[{at-spi-bus-laun}]
        ├─at-spi2-registr───2*[{at-spi2-registr}]
        ├─atd
        ├─auditd───{auditd}
        ├─automount───4*[{automount}]
        ├─avahi-daemon───avahi-daemon
        ├─caribou───2*[{caribou}]
        ├─chronyd
        ├─colord───2*[{colord}]
        ├─crond
        ├─cupsd
        ├─2*[dbus-daemon───{dbus-daemon}]
        ├─dbus-launch
        ├─evolution-calen───5*[{evolution-calen}]
        ├─evolution-sourc───2*[{evolution-sourc}]
        ├─gconfd-2
        ├─gdm─┬─Xorg───3*[{Xorg}]
        │     ├─gdm-session-wor─┬─gnome-session─┬─abrt-applet───2*[{abrt-applet}]
        │     │                 │               ├─gnome-settings-───4*[{gnome-settings-}]
        │     │                 │               ├─gnome-shell─┬─firefox─┬─Web Content───37*[{Web Conten+
        │     │                 │               │             │         └─59*[{firefox}]
        │     │                 │               │             ├─ibus-daemon─┬─ibus-dconf───3*[{ibus-dco+
        │     │                 │               │             │             ├─ibus-engine-han───2*[{ibu+
        │     │                 │               │             │             └─2*[{ibus-daemon}]
        │     │                 │               │             ├─oosplash─┬─soffice.bin───6*[{soffice.bi+
        │     │                 │               │             │          └─2*[{oosplash}]
        │     │                 │               │             └─6*[{gnome-shell}]
        │     │                 │               ├─gnome-software───3*[{gnome-software}]
        │     │                 │               ├─nautilus───3*[{nautilus}]
        │     │                 │               ├─seapplet
        │     │                 │               ├─ssh-agent
        │     │                 │               ├─tracker-extract───13*[{tracker-extract}]
        │     │                 │               ├─tracker-miner-a───2*[{tracker-miner-a}]
        │     │                 │               ├─tracker-miner-f───3*[{tracker-miner-f}]
        │     │                 │               ├─tracker-miner-u───2*[{tracker-miner-u}]
        │     │                 │               └─3*[{gnome-session}]
        │     │                 └─2*[{gdm-session-wor}]
        │     └─3*[{gdm}]
        ├─gnome-keyring-d───4*[{gnome-keyring-d}]
        ├─gnome-shell-cal───5*[{gnome-shell-cal}]
        ├─gnome-terminal-─┬─bash───su───bash
        │                 ├─bash───csh─┬─sleep
        │                 │            └─su───bash─┬─sleep
        │                 │                        └─su───bash───su───bash───su───bash─┬─man───less
        │                 │                                                            ├─pstree
        │                 │                                                            └─2*[vim]
        │                 ├─gnome-pty-helpe
        │                 └─3*[{gnome-terminal-}]
        ├─goa-daemon───3*[{goa-daemon}]
        ├─goa-identity-se───3*[{goa-identity-se}]
        ├─gpm
        ├─gsd-printer───2*[{gsd-printer}]
        ├─gssproxy───5*[{gssproxy}]
        ├─gvfs-afc-volume───3*[{gvfs-afc-volume}]
        ├─gvfs-goa-volume───2*[{gvfs-goa-volume}]
        ├─gvfs-gphoto2-vo───2*[{gvfs-gphoto2-vo}]
        ├─gvfs-mtp-volume───2*[{gvfs-mtp-volume}]
        ├─gvfs-udisks2-vo───2*[{gvfs-udisks2-vo}]
        ├─gvfsd───2*[{gvfsd}]
        ├─gvfsd-fuse───5*[{gvfsd-fuse}]
        ├─gvfsd-trash───2*[{gvfsd-trash}]
        ├─ibus-x11───2*[{ibus-x11}]
        ├─irqbalance
        ├─lsmd
        ├─lvmetad
        ├─master─┬─pickup
        │        └─qmgr
        ├─mcelog
        ├─mission-control───3*[{mission-control}]
        ├─packagekitd───2*[{packagekitd}]
        ├─polkitd───5*[{polkitd}]
        ├─rngd
        ├─rsyslogd───2*[{rsyslogd}]
        ├─rtkit-daemon───2*[{rtkit-daemon}]
        ├─smartd
        ├─sshd
        ├─systemd-journal
        ├─systemd-logind
        ├─systemd-udevd
        ├─tracker-store───7*[{tracker-store}]
        ├─tuned───4*[{tuned}]
        ├─udisksd───4*[{udisksd}]
        ├─upowerd───2*[{upowerd}]
        ├─wpa_supplicant
        └─xinetd
[root@station14 ~]# fg
vim /etc/pam.d/

[3]+  Stopped                 vim /etc/pam.d/
[root@station14 ~]# fg 1
man bash

[1]+  Stopped                 man bash
[root@station14 ~]# find / &gt; output.txt 2 &gt; errors.txt &amp;
[4] 7262
[root@station14 ~]# jobs
[1]+  Stopped                 man bash
[2]   Stopped                 vim /etc/fstab
[3]-  Stopped                 vim /etc/pam.d/
[4]   Running                 find / 2 &gt; output.txt &gt; errors.txt &amp;
[root@station14 ~]# find: ‘/net/server1/export/home/dsuser1’: Permission denied
find: ‘/net/server1/export/home/dsuser2’: Permission denied
find: ‘/net/server1/export/home/dsuser3’: Permission denied
find: ‘/net/server1/export/home/dsuser4’: Permission denied
find: ‘/net/server1/export/home/dsuser5’: Permission denied
find: ‘/net/server1/export/home/dsuser6’: Permission denied
find: ‘/net/server1/export/home/dsuser7’: Permission denied
find: ‘/net/server1/export/home/dsuser8’: Permission denied
find: ‘/net/server1/export/home/dsuser9’: Permission denied
find: ‘/net/server1/export/home/dsuser10’: Permission denied
find: ‘/net/server1/export/home/dsuser11’: Permission denied
find: ‘/net/server1/export/home/dsuser12’: Permission denied
find: ‘/net/server1/export/home/dsuser13’: Permission denied
find: ‘/net/server1/export/home/dsuser14’: Permission denied
find: ‘/net/server1/export/home/dsuser15’: Permission denied
find: ‘/net/server1/export/home/dsuser16’: Permission denied
find: ‘/net/server1/export/home/dsuser17’: Permission denied
find: ‘/net/server1/export/home/dsuser18’: Permission denied
find: ‘/net/server1/export/home/dsuser19’: Permission denied
find: ‘/net/server1/export/home/dsuser20’: Permission denied
find: ‘/net/server1/export/home/dsuser21’: Permission denied
find: ‘/net/server1/export/home/dsuser22’: Permission denied
find: ‘/net/server1/export/home/dsuser23’: Permission denied
find: ‘/net/server1/export/home/dsuser24’: Permission denied
find: ‘/net/server1/export/home/dsuser25’: Permission denied
find: ‘/net/server1/export/home/dsuser26’: Permission denied
find: ‘/net/server1/export/home/dsuser27’: Permission denied
find: ‘/net/server1/export/home/dsuser28’: Permission denied
find: ‘/net/server1/export/home/dsuser29’: Permission denied
find: ‘/net/server1/export/home/dsuser30’: Permission denied
find: ‘2’: No such file or directory

[4]   Exit 1                  find / 2 &gt; output.txt &gt; errors.txt
[root@station14 ~]# tail -f output.txt
^Z
[4]+  Stopped                 tail -f output.txt
[root@station14 ~]# jobs
[1]-  Stopped                 man bash
[2]   Stopped                 vim /etc/fstab
[3]   Stopped                 vim /etc/pam.d/
[4]+  Stopped                 tail -f output.txt
[root@station14 ~]# find / &amp;&gt; stderrandstdout.txt
^Z
[5]+  Stopped                 find / &amp;&gt;stderrandstdout.txt
[root@station14 ~]# jobs
[1]   Stopped                 man bash
[2]   Stopped                 vim /etc/fstab
[3]   Stopped                 vim /etc/pam.d/
[4]-  Stopped                 tail -f output.txt
[5]+  Stopped                 find / &amp;&gt;stderrandstdout.txt
[root@station14 ~]# bg
[5]+ find / &amp;&gt;stderrandstdout.txt &amp;
[root@station14 ~]# jobs -l
[1]   7192 Stopped                 man bash
[2]   7228 Stopped                 vim /etc/fstab
[3]-  7238 Stopped                 vim /etc/pam.d/
[4]+  7294 Stopped                 tail -f output.txt
[5]   7303 Exit 1                  find / &amp;&gt;stderrandstdout.txt
[root@station14 ~]# fg %2
vim /etc/fstab
[root@station14 ~]# fg %3
vim /etc/pam.d/
[root@station14 ~]# kill %man
[root@station14 ~]# jobs -l
[1]-  7192 Terminated              man bash
[4]+  7294 Stopped                 tail -f output.txt
[root@station14 ~]# kill %{4..6}
-bash: kill: %5: no such job
-bash: kill: %6: no such job
[4]+  Terminated              tail -f output.txt
[root@station14 ~]# pkill file-roller
[root@station14 ~]# ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0  5384  2018  0  80   0 - 29551 wait   pts/1    00:00:00 bash
0 S     0  5996  5384  0  80   0 - 30385 sigsus pts/1    00:00:00 csh
0 T     0  6224  5996  0  80   0 - 27485 signal pts/1    00:00:00 sleep
4 S     0  6702  5996  0  80   0 - 47951 wait   pts/1    00:00:00 su
4 S     0  6975  6703  0  80   0 - 47939 wait   pts/1    00:00:00 su
4 S     0  6979  6975  0  80   0 - 29520 wait   pts/1    00:00:00 bash
4 S     0  7024  6979  0  80   0 - 47951 wait   pts/1    00:00:00 su
4 S     0  7096  7025  0  80   0 - 47939 wait   pts/1    00:00:00 su
4 S     0  7100  7096  0  80   0 - 29553 wait   pts/1    00:00:00 bash
0 R     0  7310  7100  0  80   0 - 37744 -      pts/1    00:00:00 ps</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[group, user]]></title>
            <link>https://velog.io/@yoni_d/group-user</link>
            <guid>https://velog.io/@yoni_d/group-user</guid>
            <pubDate>Wed, 12 Apr 2023 01:58:03 GMT</pubDate>
            <description><![CDATA[<pre><code class="language-bash">733 cat /etc/passwd 
737 cat /etc/group 
738 cat /etc/shadow 
739 groupadd admin 
740 tail /etc/group 
741 head /etc/group 
742 groupadd -g 1313 sales 743 tail /etc/group 
744 groupdel admin 
745 tail /etc/group 746 groupmod -n cloud sales 
747 tail /etc/group 
748 groupmod -g 1212 cloud 
749 tail /etc/group 
752 useradd testuser1 
753 tail /etc/passwd 
754 grep 1002 /etc/group 
755 tail /etc/group 
756 cat /etc/shells 
760 useradd -u 2424 -g cloud -G wheel,gdm,ntp -c &quot;010-111-1111&quot; -s /bin/csh testuser2 761 tail /etc/passwd 
762 tail /etc/group 
763 mkdir /oracledb 
765 useradd -r -s /sbin/nologin -d /oracledb ora 
766 tail /etc/passwd 
769 ll /home/ 770 userdel -r testuser1 
771 userdel testuser2 
772 ll /home/ 773 cd testuser2 
774 cd /home 

&gt; userdel -r 옵션을 사용하지 않으면 user는 삭제되지만, directory는 남아있다. 
[root@station14 home]# ll /home/ 
total 0 
drwx------. 6 guru guru 199 Apr 10 15:52 guru 
drwx------. 3 2424 cloud 78 Apr 12 10:11 testuser2 
drwx------. 5 visitor visitor 128 Apr 10 10:59 visitor 

&gt; -nouser는 계정정보가 없는 것들을 출력해줌 
[root@station14 home]# find /home/ -nouser /home/testuser2 
/home/testuser2/.mozilla 
/home/testuser2/.mozilla/extensions 
/home/testuser2/.mozilla/plugins 
/home/testuser2/.bash_logout 
/home/testuser2/.bash_profile 
/home/testuser2/.bashrc 

&gt; -nouser를 활용해서 rm -rf 명령어를 실행 
[root@station14 /]# find /home -nouser -exec rm -rf {} \; 
find: ‘/home/testuser2’: No such file or directory 
[root@station14 home]# ll 
total 0 
drwx------. 6 guru guru 199 Apr 10 15:52 guru 
drwx------. 5 visitor visitor 128 Apr 10 10:59 visitor 

[root@station14 home]# useradd testuser3
[root@station14 home]# tail /etc/passwd
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
chrony:x:990:984::/var/lib/chrony:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/var/lib/oprofile:/sbin/nologin
guru:x:1000:1000:guru:/home/guru:/bin/bash
visitor:x:1001:1001::/home/visitor:/bin/bash
ora:x:989:983::/oracledb:/sbin/nologin
testuser3:x:1002:1002::/home/testuser3:/bin/bash

[root@station14 home]# usermod -u 3333 -g cloud -G wheel,gdm -s /bin/csh testuser3
[root@station14 home]# tail /etc/passwd
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
chrony:x:990:984::/var/lib/chrony:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
oprofile:x:16:16:Special user account to be used by OProfile:/var/lib/oprofile:/sbin/nologin
guru:x:1000:1000:guru:/home/guru:/bin/bash
visitor:x:1001:1001::/home/visitor:/bin/bash
ora:x:989:983::/oracledb:/sbin/nologin
testuser3:x:3333:1212::/home/testuser3:/bin/csh

[root@station14 home]# id testuser3
uid=3333(testuser3) gid=1212(cloud) groups=1212(cloud),10(wheel),42(gdm)

[root@station14 home]# chage -l testuser3
Last password change                    : Apr 12, 2023
Password expires                    : never
Password inactive                    : never
Account expires                        : never
Minimum number of days between password change        : 0
Maximum number of days between password change        : 99999
Number of days of warning before password expires    : 7

&gt; -M: 패스워드 최대사용기간, -m : 패스워드 최소사용기간, -I : 유예기간
&gt; -E : expire(유효기간 : 저날까지만 근무하는 알바생이라 가정)
[root@station14 home]# chage -M 60 -m 10 -W 5 -I 30 -E 2023-12-31 testuser3;
[root@station14 home]# chage -l testuser3;
Last password change                    : Apr 12, 2023
Password expires                    : Jun 11, 2023
Password inactive                    : Jul 11, 2023
Account expires                        : Dec 31, 2023
Minimum number of days between password change        : 10
Maximum number of days between password change        : 60
Number of days of warning before password expires    : 5


&gt; 패스워드 관련 설정파일
/etc/login.defs
/etc/default/useradd
/etc/skel

[root@station14 home]# vi /etc/login.defs 
     25 PASS_MAX_DAYS   60 
     26 PASS_MIN_DAYS   10
     27 PASS_MIN_LEN    5   -- 패스워드 최소 길이
     28 PASS_WARN_AGE   7
     31 # Min/max values for automatic uid selection in useradd
     32 #
     33 UID_MIN                 10000
     34 UID_MAX                 60000
     35 # System accounts
     36 SYS_UID_MIN               201
     37 SYS_UID_MAX               999
     38 
     39 #
     40 # Min/max values for automatic gid selection in groupadd
     41 #
     42 GID_MIN                 20000
     43 GID_MAX                 60000
     44 # System accounts
     45 SYS_GID_MIN               201
     46 SYS_GID_MAX               999
     60 CREATE_HOME     yes    --해당 user의 홈디렉토리 만들 것인가?


[root@station14 home]# vi /etc/default/useradd 
      1 # useradd defaults file
      2 GROUP=100
      3 HOME=/home              -- home 디렉토리는 SKEL 디렉토리 내용을 그대로 복사해서 user의 홈디렉토리에 만들어짐
      4 INACTIVE=-1                -- 30으로 수정 (값 -1 : 유예기간이 무한대, 30: 유예기간 30일)
      5 EXPIRE=                 
      6 SHELL=/bin/bash
      7 SKEL=/etc/skel
      8 CREATE_MAIL_SPOOL=yes     

&gt; skel디렉토리와 testuser3의 홈디렉토리 비교 -&gt; 똑같다.
[root@station14 home]# ll -a /home/testuser3 /etc/skel
/etc/skel:
total 24
drwxr-xr-x.   3 root root   78 Apr  8 05:24 .
drwxr-xr-x. 138 root root 8192 Apr 12 11:08 ..
-rw-r--r--.   1 root root   18 Dec  7  2016 .bash_logout
-rw-r--r--.   1 root root  193 Dec  7  2016 .bash_profile
-rw-r--r--.   1 root root  231 Dec  7  2016 .bashrc
drwxr-xr-x.   4 root root   39 Apr  8 05:24 .mozilla

/home/testuser3:
total 12
drwx------. 3 testuser3 cloud  78 Apr 12 10:56 .
drwxr-xr-x. 5 root      root   50 Apr 12 10:56 ..
-rw-r--r--. 1 testuser3 cloud  18 Dec  7  2016 .bash_logout
-rw-r--r--. 1 testuser3 cloud 193 Dec  7  2016 .bash_profile
-rw-r--r--. 1 testuser3 cloud 231 Dec  7  2016 .bashrc
drwxr-xr-x. 4 testuser3 cloud  39 Apr  8 05:24 .mozilla


&gt; skel에 수정하면 반영이 될까?
[root@station14 home]# mkdir /etc/skel/Homepage
[root@station14 home]# touch /etc/skel/Manual.txt
[root@station14 home]# cp ~/.vimrc /etc/skel

&gt; group, user 추가
[root@station14 home]# groupadd hdmi
[root@station14 home]# useradd -g hdmi matrix

&gt; matrix 유저의 패스워드 설정
[root@station14 home]# passwd matrix
Changing password for user matrix.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

&gt; matrix 유저 확인 
[root@station14 home]# id matrix
uid=10000(matrix) gid=20000(hdmi) groups=20000(hdmi)

&gt; passward 설정한 거 확인
[root@station14 home]# chage -l matrix
Last password change                    : Apr 12, 2023
Password expires                    : Jun 11, 2023
Password inactive                    : Jul 11, 2023
Account expires                        : never
Minimum number of days between password change        : 10
Maximum number of days between password change        : 60
Number of days of warning before password expires    : 7

&gt; matrix 유저 홈디렉토리 확인
[root@station14 home]# ll -a /home/matrix
total 16
drwx------. 4 matrix hdmi 126 Apr 12 11:18 .
drwxr-xr-x. 6 root   root  64 Apr 12 11:18 ..
-rw-r--r--. 1 matrix hdmi  18 Dec  7  2016 .bash_logout
-rw-r--r--. 1 matrix hdmi 193 Dec  7  2016 .bash_profile
-rw-r--r--. 1 matrix hdmi 231 Dec  7  2016 .bashrc
drwxr-xr-x. 2 matrix hdmi   6 Apr 12 11:17 Homepage
-rw-r--r--. 1 matrix hdmi   0 Apr 12 11:17 Manual.txt
drwxr-xr-x. 4 matrix hdmi  39 Apr  8 05:24 .mozilla
-rw-r--r--. 1 matrix hdmi  14 Apr 12 11:17 .vimrc

&gt; 소유 owner, group 변경
[root@station14 home]# touch /tmp/a.txt
[root@station14 home]# ll /tmp/a.txt 
-rw-r--r--. 1 root root 0 Apr 12 11:45 /tmp/a.txt

[root@station14 home]# chown ora /tmp/a.txt
[root@station14 home]# ll /tmp/a.txt 
-rw-r--r--. 1 ora root 0 Apr 12 11:45 /tmp/a.txt

[root@station14 home]# chgrp hdmi /tmp/a.txt 
[root@station14 home]# ll /tmp/a.txt 
-rw-r--r--. 1 ora hdmi 0 Apr 12 11:45 /tmp/a.txt

&gt; 한번에 변경도 가능
[root@station14 home]# chown root:wheel /tmp/a.txt 
[root@station14 home]# ll /tmp/a.txt 
-rw-r--r--. 1 root wheel 0 Apr 12 11:45 /tmp/a.txt


&gt; ls -l =&gt; -rw-r--r--. 1 root wheel 0 Apr 12 11:45 /tmp/a.txt
-rw-r--r--
첫번째자리 -)
-: 일반파일
d: directory
l: 링크파일
b,c,s,p: /dev에서 보이는 특수 디렉토리파일
    b: block device (dvd..)
    c : character device(terminal, modem, printer능

두번째 rw-)
root유저는 rw가능
    w 퍼미션: 파일 편집이 가능하다는 말. 삭제가 된다는 것을 의미하는 건 아님
    x 퍼미션: 실행할 명령어를 쭉 적어둔 파일을 실행시켜서 파일 내 명령어 실행되도록 하는 파일을 쉘 스크립트함, 즉 파일을 명령어 처럼 사용하겠다. 이럴 때 x 퍼미션을 붙임.

세번째 r--)
wheel의 유저들은 r가능

네번째 r--)
나머지유저들은 r가능


&gt; 공유목적으로 chmod 777로 설정하면, 문제가 될 수 있다. (아무나 다 삭제할 수 있는 권한이 생기게 되므로) -&gt; 원소유자만 삭제할 수 있는 권한을 걸겠다.
u+s =&gt; 4ooo
g+s =&gt; 2ooo
o+t =&gt; 1ooo
[root@station14 home]# ll -d /oracledb
drwxr-xr-x. 2 root root 6 Apr 12 10:13 /oracledb
[root@station14 home]# chmod 1777 /oracledb 
[root@station14 home]# ll -d /oracledb
drwxrwxrwt. 2 root root 6 Apr 12 10:13 /oracledb

[root@station14 home]# touch myapp
[root@station14 home]# ll myapp
-rw-r--r--. 1 root root 0 Apr 12 14:18 myapp

[root@station14 home]# chmod 4755 myapp   (--&gt; u+s)
[root@station14 home]# ll myapp
-rwsr-xr-x. 1 root      root      0 Apr 12 14:18 myapp

[root@station14 home]# chmod g+s myapp
[root@station14 home]# ll myapp
-rwsr-sr-x. 1 root root 0 Apr 12 14:18 myapp

&gt; umask 

[root@station14 home]# umask
0022    -&gt; 0:특수 퍼미션에 마스크 없음 0:소유자에 마스크 없음  2:소유그룹에 w마스크 씌움 2:이외사용자들에게 w마스크 씌움

&gt; umask 수정
[root@station14 home]# umask 027
[root@station14 home]# umask
0027

&gt; lab 해보기 6-15

</code></pre>
]]></description>
        </item>
    </channel>
</rss>