반응형
iscsi 와 iscsid 차이
목차
iscsi 란
iscsi.service는 iscsi device를 scanning 하고 장치에 로그인 하거나, 중지 시 logout 을 담당합니다.
iscsid 란
iscsid.service는 설정의 자동 로그인/로그아웃을 관리하는 데 사용됩니다. iscsid.service는 iscsid의 lifecycle을 관리하며 iscsi.service에서 수동으로 iscsadm 명령을 실행할 때 소켓 활성화를 사용하여 자동으로 시작됩니다.
요약하자면, iscsid.service는 iscsid 데몬 실행을 담당합니다., iscsi.service는 /var/lib/iscsi 하위의 설정 값을 기반으로 target에 연결하도록 iscsid에게 요청합니다.
iscsi, iscsid Service 파일 확인
- iscsi.service 파일 확인
# cat /usr/lib/systemd/system/iscsi.service
[Unit]
Description=Login and scanning of iSCSI devices
Documentation=man:iscsid(8) man:iscsiadm(8)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service
Before=remote-fs-pre.target
Wants=remote-fs-pre.target iscsi-shutdown.service
ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes
ConditionDirectoryNotEmpty=|/sys/class/iscsi_session
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/libexec/iscsi-mark-root-nodes
ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
ExecReload=-/sbin/iscsiadm -m node --loginall=automatic
[Install]
WantedBy=sysinit.target
- iscsid.service 파일 확인
# cat /usr/lib/systemd/system/iscsid.service
[Unit]
Description=Open-iSCSI
Documentation=man:iscsid(8) man:iscsiadm(8)
DefaultDependencies=no
Conflicts=shutdown.target
After=network.target iscsiuio.service
Before=remote-fs-pre.target
[Service]
Type=forking
PIDFile=/var/run/iscsid.pid
ExecStart=/usr/sbin/iscsid
ExecStop=/sbin/iscsiadm -k 0 2
[Install]
WantedBy=multi-user.target
iscsi 연결 중 daemon stop, start 진행
iscsi device discovery , login
- iscsi device discover 진행
# ls -al /var/lib/iscsi/nodes/
total 0
drwxr-xr-x 2 root root 6 Aug 28 16:05 .
drwxr-xr-x 8 root root 90 Feb 13 2024 ..
# iscsiadm -m node
iscsiadm: No records found
# iscsiadm -m session
iscsiadm: No active sessions.
# sudo iscsiadm -m discovery -t st -p 200.200.10.181
200.200.10.181:3260,1 iqn.2024-02.com.data:test-data
200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd
# ls -al /var/lib/iscsi/nodes/
total 0
drwxr-xr-x 4 root root 80 Aug 28 16:05 .
drwxr-xr-x 8 root root 90 Feb 13 2024 ..
drw------- 3 root root 35 Aug 28 16:05 iqn.2024-02.com.data:test-data
drw------- 3 root root 35 Aug 28 16:05 iqn.2024-02.com.sbd:test-sbd
# iscsiadm -m node
200.200.10.181:3260,1 iqn.2024-02.com.data:test-data
200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd
# iscsiadm -m session
iscsiadm: No active sessions.
- iscsi device login 진행
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.sbd:test-sbd -p 200.200.10.181:3260 --login
Logging in to [iface: default, target: iqn.2024-02.com.sbd:test-sbd, portal: 200.200.10.181,3260]
Login to [iface: default, target: iqn.2024-02.com.sbd:test-sbd, portal: 200.200.10.181,3260] successful.
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.data:test-data -p 200.200.10.181:3260 --login
Logging in to [iface: default, target: iqn.2024-02.com.data:test-data, portal: 200.200.10.181,3260]
Login to [iface: default, target: iqn.2024-02.com.data:test-data, portal: 200.200.10.181,3260] successful.
# iscsiadm -m session
tcp: [3] 200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd (non-flash)
tcp: [4] 200.200.10.181:3260,1 iqn.2024-02.com.data:test-data (non-flash)
- discovery 전에 login을 할 경우 login 불가
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.data:test-data -p 200.200.10.181:3260 --login
iscsiadm: No records found
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.sbd:test-sbd -p 200.200.10.181:3260 --login
iscsiadm: No records found
# sudo iscsiadm -m discovery -t st -p 200.200.10.181
200.200.10.181:3260,1 iqn.2024-02.com.data:test-data
200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.data:test-data -p 200.200.10.181:3260 --login
Logging in to [iface: default, target: iqn.2024-02.com.data:test-data, portal: 200.200.10.181,3260]
Login to [iface: default, target: iqn.2024-02.com.data:test-data, portal: 200.200.10.181,3260] successful.
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.sbd:test-sbd -p 200.200.10.181:3260 --login
Logging in to [iface: default, target: iqn.2024-02.com.sbd:test-sbd, portal: 200.200.10.181,3260]
Login to [iface: default, target: iqn.2024-02.com.sbd:test-sbd, portal: 200.200.10.181,3260] successful.
iscsi device logout, delete
- iscsi logout
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.sbd:test-sbd -p 200.200.10.181:3260 --logout
Logging out of session [sid: 3, target: iqn.2024-02.com.sbd:test-sbd, portal: 200.200.10.181,3260]
Logout of [sid: 3, target: iqn.2024-02.com.sbd:test-sbd, portal: 200.200.10.181,3260] successful.
# sudo iscsiadm --mode node --targetname iqn.2024-02.com.data:test-data -p 200.200.10.181:3260 --logout
Logging out of session [sid: 4, target: iqn.2024-02.com.data:test-data, portal: 200.200.10.181,3260]
Logout of [sid: 4, target: iqn.2024-02.com.data:test-data, portal: 200.200.10.181,3260] successful.
# iscsiadm -m node
200.200.10.181:3260,1 iqn.2024-02.com.data:test-data
200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd
# iscsiadm -m session
iscsiadm: No active sessions.
- iscsi device delete
# iscsiadm --mode node --targetname iqn.2024-02.com.sbd:test-sbd -p 200.200.10.181:3260 -o delete
# iscsiadm --mode node --targetname iqn.2024-02.com.data:test-data -p 200.200.10.181:3260 -o delete
# iscsiadm -m node
iscsiadm: No records found
# iscsiadm -m session
iscsiadm: No active sessions.
iscsi, iscsid 데몬 재시작 시 iscsi 연결 상태 확인
- iscsi login 상태에서 iscsi 데몬 재시작을 진행하더라도 iscsi connection은 끊어지지 않음
# iscsiadm -m session
tcp: [5] 200.200.10.181:3260,1 iqn.2024-02.com.data:test-data (non-flash)
tcp: [6] 200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd (non-flash)
# systemctl status iscsi
● iscsi.service - Login and scanning of iSCSI devices
Loaded: loaded (/usr/lib/systemd/system/iscsi.service; enabled; vendor preset: disabled)
Active: active (exited) since Wed 2024-08-28 15:42:18 KST; 29min ago
Docs: man:iscsiadm(8)
man:iscsid(8)
Process: 935 ExecStart=/usr/sbin/iscsiadm -m node --loginall=automatic (code=exited, status=0/SUCCESS)
Main PID: 935 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 11348)
Memory: 0B
CGroup: /system.slice/iscsi.service
...
# systemctl stop iscsi
# systemctl status iscsi
● iscsi.service - Login and scanning of iSCSI devices
Loaded: loaded (/usr/lib/systemd/system/iscsi.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Wed 2024-08-28 16:12:02 KST; 1s ago
Docs: man:iscsiadm(8)
man:iscsid(8)
Process: 935 ExecStart=/usr/sbin/iscsiadm -m node --loginall=automatic (code=exited, status=0/SUCCESS)
Main PID: 935 (code=exited, status=0/SUCCESS)
...
# iscsiadm -m session
tcp: [5] 200.200.10.181:3260,1 iqn.2024-02.com.data:test-data (non-flash)
tcp: [6] 200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd (non-flash)
- iscsid login 상태에서 iscsi 데몬 재시작을 진행하더라도 iscsi connection은 끊어지지 않음
# systemctl status iscsid
● iscsid.service - Open-iSCSI
Loaded: loaded (/usr/lib/systemd/system/iscsid.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2024-08-28 15:42:18 KST; 30min ago
Docs: man:iscsid(8)
man:iscsiuio(8)
man:iscsiadm(8)
Main PID: 1128 (iscsid)
Status: "Ready to process requests"
Tasks: 1 (limit: 11348)
Memory: 11.4M
CGroup: /system.slice/iscsid.service
└─1128 /usr/sbin/iscsid -f
...
# systemctl stop iscsid
Warning: Stopping iscsid.service, but it can still be activated by:
iscsid.socket
# systemctl status iscsid
● iscsid.service - Open-iSCSI
Loaded: loaded (/usr/lib/systemd/system/iscsid.service; disabled; vendor preset: disabled)
Active: inactive (dead) since Wed 2024-08-28 16:12:41 KST; 1min 43s ago
Docs: man:iscsid(8)
man:iscsiuio(8)
man:iscsiadm(8)
Process: 1128 ExecStart=/usr/sbin/iscsid -f (code=exited, status=0/SUCCESS)
Main PID: 1128 (code=exited, status=0/SUCCESS)
Status: "Ready to process requests"
...
# iscsiadm -m session
tcp: [5] 200.200.10.181:3260,1 iqn.2024-02.com.data:test-data (non-flash)
tcp: [6] 200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd (non-flash)
iscsi, iscsid 데몬 기동 별 iscsi session connection
- iscsi enable / iscsid disable
# systemctl list-unit-files | grep iscsi
iscsi-onboot.service disabled
iscsi-shutdown.service static
iscsi.service enabled
iscsid.service disabled
iscsiuio.service disabled
iscsid.socket disabled
iscsiuio.socket disabled
### 서버 재기동
# iscsiadm -m session
tcp: [1] 200.200.10.181:3260,1 iqn.2024-02.com.data:test-data (non-flash)
tcp: [2] 200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd (non-flash)
# iscsiadm -m node
200.200.10.181:3260,1 iqn.2024-02.com.data:test-data
200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd
- iscsi disable / iscsid enable
# systemctl list-unit-files | grep iscsi
iscsi-onboot.service disabled
iscsi-shutdown.service static
iscsi.service disabled
iscsid.service enabled
iscsiuio.service disabled
iscsid.socket enabled
iscsiuio.socket disabled
### 서버 재기동
# iscsiadm -m session
iscsiadm: No active sessions.
# iscsiadm -m node
200.200.10.181:3260,1 iqn.2024-02.com.data:test-data
200.200.10.181:3260,1 iqn.2024-02.com.sbd:test-sbd
참고 문서 :
https://unix.stackexchange.com/questions/216239/iscsi-vs-iscsid-services
반응형
'리눅스 > 개념' 카테고리의 다른 글
[LINUX]특수 권한 및 파일 설정 (1) | 2023.12.07 |
---|---|
[LINUX]라우팅 매트릭 및 최적 경로 (2) | 2023.11.18 |
[오픈스택] TripleO란? (0) | 2023.03.10 |
[LINUX] ANSIBLE (앤서블)이란? (0) | 2022.02.27 |
[LINUX]HA Pacemaker란? (0) | 2021.01.06 |