init do projeto.
This commit is contained in:
commit
35d9823716
44
README.md
Normal file
44
README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
## ISCSI Conector
|
||||||
|
#### 📌 Sobre o Projeto
|
||||||
|
|
||||||
|
Script utilizado para facilitar conexão de discos ISCSI em linux baseados em Debian/Ubuntu.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### 🛠️ Requisitos mínimos
|
||||||
|
---
|
||||||
|
|
||||||
|
- Debian/Ubuntu > 14.0
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### 🚀 Como usar
|
||||||
|
---
|
||||||
|
|
||||||
|
- Acesse seu terminal;
|
||||||
|
- Clone o repositorio:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://git.instantti.com.br/instant/iscsi_connector.git
|
||||||
|
```
|
||||||
|
|
||||||
|
- acesse o diretorio:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd iscsi_connector/
|
||||||
|
```
|
||||||
|
- Execute o comando:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sh iscsi_connect.sh <IP_DO_TARGET_ISCSI>
|
||||||
|
```
|
||||||
|
|
||||||
|
- IP_DO_TARGET_ISCSI: Endereço IP do ISCSI que deseja montar.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
// Ex:
|
||||||
|
sh iscsi_connect.sh 172.20.100.20
|
||||||
|
```
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
> - O script em questão é interativo, então ao executar siga o passo-a-passo dele.
|
||||||
36
iscsi_connect.sh
Normal file
36
iscsi_connect.sh
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
IP_ALVO="$1"
|
||||||
|
|
||||||
|
if [ -z "$IP_ALVO" ]; then
|
||||||
|
echo "❌ Uso: $0 <IP_DO_TARGET_ISCSI>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verifica se está sendo executado como root
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "❌ Este script precisa ser executado como root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔍 Verificando se o open-iscsi está instalado..."
|
||||||
|
if ! dpkg -l | grep -q open-iscsi; then
|
||||||
|
echo "⚙️ Instalando pacote open-iscsi..."
|
||||||
|
apt update && apt install -y open-iscsi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "📡 Descobrindo targets iSCSI no IP $IP_ALVO..."
|
||||||
|
iscsiadm -m discovery -t sendtargets -p "$IP_ALVO"
|
||||||
|
|
||||||
|
echo
|
||||||
|
read -p "🧠 Digite o IQN que deseja conectar (copie e cole da linha acima): " IQN
|
||||||
|
|
||||||
|
echo "🔗 Conectando ao IQN $IQN..."
|
||||||
|
iscsiadm -m node -T "$IQN" -p "$IP_ALVO" --login
|
||||||
|
|
||||||
|
echo "📌 Habilitando reconexão automática no boot..."
|
||||||
|
iscsiadm -m node -T "$IQN" -p "$IP_ALVO" --op update -n node.startup -v automatic
|
||||||
|
|
||||||
|
echo "✅ Conexão realizada com sucesso. Use 'lsblk' ou 'dmesg | grep sd' para verificar o disco."
|
||||||
Loading…
x
Reference in New Issue
Block a user