iscsi-分区类型
iSCSI簡介(Internet SCSI):
iSCSI 小型計算機系統接口,IBM公司研發,用于在IP網絡上運行SCSI協議;解決了 SCSI需要直連存儲設備的局限性;可以不停機擴展存儲容量,iSCSI 將 SCSI 接口與 Ethernet 技術結合,使服務器可與使用 IP 網絡的存儲裝置互相交換數據;基于 TCP/IP 協議,創建 SAN,以數據塊級別在多個數據存儲網絡間進行傳輸
iSCSI 主要功能:
在 TCP/IP 網絡上的主機系統(initiator 啟動器)和存儲設備(target 目標器)之間進行數據的封裝和可靠傳輸。
iSCSI 啟動器是客戶端設備,啟動器可以由軟件或硬件實現;
·軟件:iscsi-initiator-utils(RPM 免費提供的 Linux-Open-iSCSI 驅動)
·硬件:iSCSI HBA(或 TCP 卸載引擎[TOE] 卡) -> 本質使一個專用以太網卡,
其上的 SCSI ASIC 可以從系統CPU內卸載所有工作(TCP 和 SCSI 命令)
iSCSI 目標是 iSCSI 網絡的“服務器”組件。通常為一個存儲設備
環境準備
兩臺RHEL虛擬機(拍初始化快照):
-
node1(192.168.22.77)target端(?iSCSI服務端)
- client1(192.168.22.107)initiator端(?iSCSI客戶端)
一、iSCSI配置
target端分區
[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 40G 0 disk ├─sda1 8:1 0 512M 0 part /boot └─sda2 8:2 0 25.5G 0 part ├─rhel-swap 253:0 0 512M 0 lvm [SWAP]└─rhel-root 253:1 0 25G 0 lvm / sr0 11:0 1 3.6G 0 rom /mnt/cdrom [root@localhost ~]# 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.Command (m for help): pDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0009ed86Device Boot Start End Blocks Id System /dev/sda1 * 2048 1050623 524288 83 Linux /dev/sda2 1050624 54544383 26746880 8e Linux LVMCommand (m for help): n Partition type:p primary (2 primary, 0 extended, 2 free)e extended Select (default p): Using default response p Partition number (3,4, default 3): First sector (54544384-83886079, default 54544384): Using default value 54544384 Last sector, +sectors or +size{K,M,G} (54544384-83886079, default 83886079): +5G Partition 3 of type Linux and of size 5 GiB is setCommand (m for help): pDisk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0009ed86Device Boot Start End Blocks Id System /dev/sda1 * 2048 1050623 524288 83 Linux /dev/sda2 1050624 54544383 26746880 8e Linux LVM /dev/sda3 54544384 65030143 5242880 83 LinuxCommand (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. [root@localhost ~]# partprobe /dev/sda [root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 512M 0 part /boot
├─sda2 8:2 0 25.5G 0 part
│ ├─rhel-swap 253:0 0 512M 0 lvm [SWAP]
│ └─rhel-root 253:1 0 25G 0 lvm /
└─sda3 8:3 0 5G 0 part
sr0 11:0 1 3.6G 0 rom /mnt/cdrom
配置yum倉庫(all)
vim /etc/yum.repos.d/a.repo [a] name=a baseurl=file:///mnt/cdrom enabled=1 gpgcheck=0 [root@localhost ~]# mkdir /mnt/cdrom [root@localhost ~]# mount /dev/sr0 /mnt/cdrom mount: /dev/sr0 is write-protected, mounting read-only [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# yum repolist Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. a | 4.1 kB 00:00:00 (1/2): a/group_gz | 134 kB 00:00:00 (2/2): a/primary_db | 3.4 MB 00:00:00 repo id repo name status a a 4,371 repolist: 4,371?
關閉防火墻及selinux(all)
[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl disable firewalld rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@localhost ~]# setenforce 0target端配置:
?
1.安裝targetcli
[root@node1 ~]# yum -y install targetcli2. 運行targetcli
[root@localhost ~]# targetcli2.1 創建后端存儲
/> backstores/block create name=nsd dev=/dev/sda32.2 創建target
/> iscsi/ create iqn.2019-06.vip.kklinux:node1注意:IQN 的格式為:iqn.年份-月份.反向域名:自定義標識
如:iqn.2019-06.vip.kklinux:node1;其中的字母均應為小寫,即使輸入時包含大寫,命令執行后,系統會自動轉換成小寫。?
2.3 創建lun邏輯單元
/iscsi> cd /iscsi/iqn.2019-06.vip.kklinux:node1/tpg1/luns /iscsi/iqn.20...de1/tpg1/luns> create /backstores/block/nsd2.4 配置acl訪問控制(設置訪問服務時客戶端聲稱的名字)
/iscsi> cd /iscsi/iqn.2019-06.vip.kklinux:node1/tpg1/acls/iscsi/iqn.20...de1/tpg1/acls>create iqn.2019-06.vip.kklinux:client1
//客戶端配置的名稱應與上面一致
如果需要配置用戶和密碼
cd /iscsi/iqn.2019-06.vip.kklinux:node1/tpg1/acls/iqn.2019-06.vip.kklinux:client1 /iscsi/iqn.20...kklinux:client1> set auth userid=username /iscsi/iqn.20...kklinux:client1> set auth password=password2.5 退出
/iscsi/iqn.20...de1/tpg1/acls> exit3. 重啟target服務,并設置開機自啟
systemctl restart target systemctl enable targetinitiator端配置:
?
1. 裝包iscsi-initiator-utils
[root@client1 ~]# yum install -y iscsi-initiator-utils2. 修改配置文件
[root@client1 ~]# vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2019-06.vip.kklinux:client1 //名稱應與服務端acl配置的名稱一致 如果target端配置了用戶和密碼還需添加
node.session.auth.authmethod = CHAP node.session.auth.username = username node.session.auth.password = password?
3. 重啟服務 iscsid?
[root@client1 ~]# systemctl restart iscsid //更新IQN標識。注意是:iscsid4. 發現服務端IQN
[root@client1~]# iscsiadm -m discovery -t st -p 192.168.22.77192.168.22.77:3260,1 iqn.2019-06.vip.kklinux:node1
5. 識別服務端共享
?
[root@client1 ~]# systemctl restart iscsi [root@client1 ~]# systemctl enable iscsi [root@client1 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 60G 0 disk ├─sda1 8:1 0 2M 0 part ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 34G 0 part ├─rhel-root 253:0 0 30G 0 lvm /└─rhel-swap 253:1 0 4G 0 lvm [SWAP] sdb 8:16 0 5G 0 disk sr0 11:0 1 3.5G 0 rom /mnt/cdrom?
轉載于:https://www.cnblogs.com/kunges/p/iscsi_disk.html
總結
以上是生活随笔為你收集整理的iscsi-分区类型的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第八章 指针实验
- 下一篇: Reparameterization T