View

Ubuntu iSCSI 연결

rura6502 2021. 2. 23. 21:23

Install open-iscsi

apt-get install open-iscsi -y

Edit config

vi /etc/iscsi/iscsid.conf

#node.startup=manual
node.startup=automatic

Discovery and Login

# discovery
iscsiadm -m discovery -t st -p ___STORAGE_IP_ADDRESS___

# set authentication
iscsiadm -m node \
    --targetname ___IQN___ \
    --portal ___STORAGE_IP_ADDRESS___ \
    --op=update \
    --name node.session.auth.username \
    --value="id_password_same" \
&& \
iscsiadm -m node \
    --targetname ___IQN___ \
    --portal ___STORAGE_IP_ADDRESS___ \
    --op=update \
    --name node.session.auth.password \
    --value="id_password_same"

# login
iscsiadm -m node \
    --targetname ___IQN___ \
    --portal ___STORAGE_IP_ADDRESS___ \
    --login

# check
fdisk -l


# 위 설정 내용은 /etc/iscsi/nodes/{IQN}/default 파일에 저장된다.

Full script

export STORAGE_IP_ADDRESS=___STORAGE_IP_ADDRESS___
export STORAGE_IQN=___IQN___
export IQN_USER_ID="id_password_same"
export IQN_USER_PW="id_password_same"
&& sed -i 's/^node.startup = manual$/node.startup = automatic/' /etc/iscsi/iscsid.conf \
&& iscsiadm -m discovery -t st -p ${STORAGE_IP_ADDRESS} \
&& iscsiadm -m node \
    --targetname ${STORAGE_IQN} \
    --portal ${STORAGE_IP_ADDRESS} \
    --op=update \
    --name node.session.auth.username \
    --value=${IQN_USER_ID} \
&& \
iscsiadm -m node \
    --targetname ${STORAGE_IQN} \
    --portal ${STORAGE_IP_ADDRESS} \
    --op=update \
    --name node.session.auth.password \
    --value=${IQN_USER_PW} \
&& iscsiadm -m node \
    --targetname ${STORAGE_IQN} \
    --portal ${STORAGE_IP_ADDRESS} \
    --login \
$$ fdisk -l

Logout and Disconnect

# logout, 연결 끊김
iscsiadm -m node \
    --targetname ${IQN} \
    --portal ${STORAGE_IP_ADDRESS} \
    --logout \

'infrastructure' 카테고리의 다른 글

Unix Socket vs TCP Socket  (0) 2021.03.02
DNS 개념, 용어 정리  (0) 2020.12.12
Share Link
reply