apt-get install open-iscsi -y
- Establecemos que el servicio inicie al arrancar la maquina
nano /etc/iscsi/iscsid.conf
node.startup = manual
X
node.startup = automatic
- Paso 4: mandamos a descubrir el NAS
PERSEFONE
iscsiadm -m discovery -t sendtargets -p 10.20.210.40
EOS:
iscsiadm -m discovery -t sendtargets -p 10.20.210.41
PERSEFONE
10.20.210.40:3260,1 iqn.1995-05.com.seagate:persefone.iscsi6
10.20.200.40:3260,1 iqn.1995-05.com.seagate:persefone.iscsi6
EOS
10.20.200.41:3260,1 iqn.1995-05.com.seagate:eos.iscsi2
10.20.210.41:3260,1 iqn.1995-05.com.seagate:eos.iscsi2
- Para ver los target descubiertos
iscsiadm -m discovery
PERSEFONE
10.20.210.40:3260 via sendtargets
EOS
10.20.210.41:3260 via sendtargets
- Podemos consultar también la información del target
PERSEFONE
iscsiadm -m node –targetname iqn.1995-05.com.seagate:persefone.iscsi6 -p 10.20.210.40
EOS
iscsiadm -m node –targetname iqn.1995-05.com.seagate:eos.iscsi2 -p 10.20.210.41
# BEGIN RECORD 2.0-874
node.name = iqn.1995-05.com.seagate:eos.iscsi2
node.tpgt = 1
node.startup = automatic
node.leading_login = No
iface.hwaddress = <empty>
iface.ipaddress = <empty>
iface.iscsi_ifacename = default
iface.net_ifacename = <empty>
iface.gateway = <empty>
iface.subnet_mask = <empty>
iface.transport_name = tcp
iface.initiatorname = <empty>
iface.state = <empty>
iface.vlan_id = 0
iface.vlan_priority = 0
iface.vlan_state = <empty>
iface.iface_num = 0
iface.mtu = 0
iface.port = 0
iface.bootproto = <empty>
iface.dhcp_alt_client_id_state = <empty>
iface.dhcp_alt_client_id = <empty>
iface.dhcp_dns = <empty>
iface.dhcp_learn_iqn = <empty>
iface.dhcp_req_vendor_id_state = <empty>
iface.dhcp_vendor_id_state = <empty>
iface.dhcp_vendor_id = <empty>
iface.dhcp_slp_da = <empty>
iface.fragmentation = <empty>
iface.gratuitous_arp = <empty>
iface.incoming_forwarding = <empty>
iface.tos_state = <empty>
iface.tos = 0
iface.ttl = 0
iface.delayed_ack = <empty>
iface.tcp_nagle = <empty>
iface.tcp_wsf_state = <empty>
iface.tcp_wsf = 0
iface.tcp_timer_scale = 0
iface.tcp_timestamp = <empty>
iface.redirect = <empty>
iface.def_task_mgmt_timeout = 0
iface.header_digest = <empty>
iface.data_digest = <empty>
iface.immediate_data = <empty>
iface.initial_r2t = <empty>
iface.data_seq_inorder = <empty>
iface.data_pdu_inorder = <empty>
iface.erl = 0
iface.max_receive_data_len = 0
iface.first_burst_len = 0
iface.max_outstanding_r2t = 0
iface.max_burst_len = 0
iface.chap_auth = <empty>
iface.bidi_chap = <empty>
iface.strict_login_compliance = <empty>
iface.discovery_auth = <empty>
iface.discovery_logout = <empty>
node.discovery_address = 10.20.210.41
node.discovery_port = 3260
node.discovery_type = send_targets
node.session.initial_cmdsn = 0
node.session.initial_login_retry_max = 8
node.session.xmit_thread_priority = -20
node.session.cmds_max = 128
node.session.queue_depth = 32
node.session.nr_sessions = 1
node.session.auth.authmethod = None
node.session.auth.username = <empty>
node.session.auth.password = <empty>
node.session.auth.username_in = <empty>
node.session.auth.password_in = <empty>
node.session.timeo.replacement_timeout = 120
node.session.err_timeo.abort_timeout = 15
node.session.err_timeo.lu_reset_timeout = 30
node.session.err_timeo.tgt_reset_timeout = 30
node.session.err_timeo.host_reset_timeout = 60
node.session.iscsi.FastAbort = Yes
node.session.iscsi.InitialR2T = No
node.session.iscsi.ImmediateData = Yes
node.session.iscsi.FirstBurstLength = 262144
node.session.iscsi.MaxBurstLength = 16776192
node.session.iscsi.DefaultTime2Retain = 0
node.session.iscsi.DefaultTime2Wait = 2
node.session.iscsi.MaxConnections = 1
node.session.iscsi.MaxOutstandingR2T = 1
node.session.iscsi.ERL = 0
node.conn[0].address = 10.20.210.41
node.conn[0].port = 3260
node.conn[0].startup = manual
node.conn[0].tcp.window_size = 524288
node.conn[0].tcp.type_of_service = 0
node.conn[0].timeo.logout_timeout = 15
node.conn[0].timeo.login_timeout = 15
node.conn[0].timeo.auth_timeout = 45
node.conn[0].timeo.noop_out_interval = 5
node.conn[0].timeo.noop_out_timeout = 5
node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144
node.conn[0].iscsi.HeaderDigest = None
node.conn[0].iscsi.DataDigest = None
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD
- Paso 5: actualizamos el nombre de usuario y contraseña
PERSEFONE
iscsiadm -m node --targetname iqn.1995-05.com.seagate:persefone.iscsi6 -p 10.20.210.40 -o update -n node.session.auth.username -v ugit
iscsiadm -m node --targetname iqn.1995-05.com.seagate:persefone.iscsi6 -p 10.20.210.40 -o update -n node.session.auth.password -v CADM8000
EOS
iscsiadm -m node --targetname iqn.1995-05.com.seagate:eos.iscsi2 -p 10.20.210.41 -o update -n node.session.auth.username -v ugit
iscsiadm -m node --targetname iqn.1995-05.com.seagate:eos.iscsi2 -p 10.20.210.41 -o update -n node.session.auth.password -v CADM8000
- Paso 6: Logearnos en el NAS
PERSEFONE
iscsiadm -m node --targetname iqn.1995-05.com.seagate:persefone.iscsi6 -p 10.20.210.40 -l
EOS
iscsiadm -m node --targetname iqn.1995-05.com.seagate:eos.iscsi2 -p 10.20.210.41 -l
PERSEFONE
Logging in to [iface: default, target: iqn.1995-05.com.seagate:persefone.iscsi6, portal: 10.20.210.40,3260] (multiple)
Login to [iface: default, target: iqn.1995-05.com.seagate:persefone.iscsi6, portal: 10.20.210.40,3260] successful.
EOS
Logging in to [iface: default, target: iqn.1995-05.com.seagate:eos.iscsi2, portal: 10.20.210.41,3260] (multiple)
Login to [iface: default, target: iqn.1995-05.com.seagate:eos.iscsi2, portal: 10.20.210.41,3260] successful.
- Podemos comprobar la conexión
dmesg
[60691.168607] sd 3:0:0:0: [sdb] Attached SCSI disk
- Paso 7: le indicamos que se arranque le servicio de forma automática
PERSEFONE
iscsiadm -m node --targetname iqn.1995-05.com.seagate:persefone.iscsi6 -p 10.20.210.40 -o update -n node.conn[0].startup -v automatic
EOS
iscsiadm -m node --targetname iqn.1995-05.com.seagate:eos.iscsi2 -p 10.20.210.41 -o update -n node.conn[0].startup -v automatic
- Paso 8: reiniciamos el servicio
/etc/init.d/open-iscsi restart
o
/etc/init.d/open-iscsi stop
/etc/init.d/open-iscsi start
- Paso 9: Creamos las reglas para que se monte automáticamente
nano /etc/udev/rules.d/z99_open-iSCSI.rules
ENV{ID_PATH}=="*iscsi*", RUN+="/bin/mount -a -O _netdev"
- Paso 10: creamos una carpeta para mondar el disco
PERSEFONE
mkdir /media/PERSEFONE
EOS
mkdir /media/EOS
- Paso 11: le damos permisos
chmod 777 -R /media/PERSEFONE
chmod 777 -R /media/EOS
- Paso 12: formatear el disco
- Paso 12.1: consultamos los discos disponibles
fdisk -l
Disco /dev/sdb: 14,4 TiB, 15824000000000 bytes, 30906250000 sectores
Unidades: sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico/físico): 512 bytes / 512 bytes
Tamaño de E/S (mínimo/óptimo): 512 bytes / 8388608 bytes
- Paso 12.2: instalamos la herramienta «parted»
apt-get update && apt-get install parted -y
- Paso 12.3: Ingresamos a la herramienta parted para el disco sdb
parted /dev/sdb
- Paso 12.4: Le establecemos una tabla de particiones
GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
- Paso 12.5: Establecemos el medida
(parted) unit TB
- Paso 12.6: Creamos la partición
(parted) mkpart primary 0TB 14.4TB
(parted) quit
- Paso 12.8: Ahora si volvemos a ejecutar fdisk, vemos que ya tenemos una partición «sdj1»
fdisk -l
Disco /dev/sdb: 14,4 TiB, 15824000000000 bytes, 30906250000 sectores
Unidades: sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico/físico): 512 bytes / 512 bytes
Tamaño de E/S (mínimo/óptimo): 512 bytes / 8388608 bytes
Tipo de etiqueta de disco: gpt
Identificador del disco: D3176449-1DCB-4423-A4C2-4742A2C793D3
Disposit. Comienzo Final Sectores Tamaño Tipo
/dev/sdb1 16384 27343749119 27343732736 12,8T Sistema de ficheros de Linux
- Paso 12.9: Establecemos un sistema de archivos (puede tardar un tiempo)
mkfs.ext4 /dev/sdb1
mke2fs 1.43.4 (31-Jan-2017)
Se está creando un sistema de ficheros con 3417966592 bloques de 4k y 427249664 nodos-i
UUID del sistema de ficheros: 8fa49292-0045-4400-b223-1074a7e22609
Respaldo del superbloque guardado en los bloques:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000
Reservando las tablas de grupo: hecho
Escribiendo las tablas de nodos-i: hecho
Creando el fichero de transacciones (262144 bloques): hecho
Escribiendo superbloques y la información contable del sistema de ficheros: hecho
- Paso 12.10: Le creamos una etiqueta
PERSEFONE
e2label /dev/sdb1 PERSEFONE
EOS
e2label /dev/sdb1 EOS
- Paso 13: Determinamos el UUID
blkid
PERSEFONE
/dev/sdb1: LABEL="PERSEFONE" UUID="2f600eef-90f6-419f-afd5-360ffe09e372" TYPE="ext4" PARTLABEL="primary" PARTUUID="18537375-9cc6-4cc0-b504-0f56d8ca1a6c"
EOS
/dev/sdb1: LABEL="EOS" UUID="8fa49292-0045-4400-b223-1074a7e22609" TYPE="ext4" PARTLABEL="primary" PARTUUID="269da57d-08f6-4003-98c0-81a992c62ba9"
- Paso 14: abrimos el «fstab»
nano /etc/fstab
PERSEFONE
UUID=2f600eef-90f6-419f-afd5-360ffe09e372 /media/PERSEFONE ext4 _netdev 0 0
EOS
UUID=8fa49292-0045-4400-b223-1074a7e22609 /media/EOS ext4 _netdev 0 0
reboot
- Ahora podemos ejecutar el comando, para ver el espacio de alamcenamiento
df -h
S.ficheros Tamaño Usados Disp Uso% Montado en
udev 2,0G 0 2,0G 0% /dev
tmpfs 396M 5,5M 391M 2% /run
/dev/sda2 28G 3,3G 23G 13% /
tmpfs 2,0G 305M 1,7G 16% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup
/dev/sdb1 13T 40M 12T 1% /media/EOS
tmpfs 396M 0 396M 0% /run/user/1000