CentOS-7掛載iscsi網路儲存

來源:互聯網
上載者:User

標籤:initiator   inode   tables   安裝   參數   很多   ima   自動   eating   

// 安裝相關軟體,其中kmod-xfs、xfsprogs為xfs檔案系統的組件。

yum install binutils iscsi-initiator-utils kmod-xfs xfsprogs

//啟動iscsi服務

service iscsi start

//查看儲存伺服器的iscsi是否線上

iscsiadm -m discovery --type sendtargets --portal 192.168.2.30

如下是輸入上面的命令後返回的結果:
192.168.2.30:3260,1 iqn.1986-03.com.ibm:2145.v37001.node2

//設定開機自動登陸iscsi

iscsiadm -m node -T iqn.1986-03.com.ibm:2145.v37001.node2 -p 192.168.2.30:3260 --op update -n node.startup -v automatic

//顯示當前的串連

iscsiadm -m session

如下是輸入上面的命令後返回的結果:
tcp: [1] 192.168.2.30:3260,1 iqn.1986-03.com.ibm:2145.v37001.node2 (non-flash)

//查看儲存空間是否已經顯示在磁碟列表中

fdisk -l

如下顯示了我儲存的空間
Disk /dev/sdb: 32985.3 GB, 32985348833280 bytes, 64424509440 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk label type: gpt

//用parted命令進行分區

parted /dev/sdb          mklabel gpt                     //建立標識mkpart primary 0% 100%          //分配所有空間print                           //顯示當前分區quit                            //退出

//用mkfs.ext4命令格式化硬碟

mkfs.ext4 -T largefile /dev/sdb1參數說明:-T largefile對格式化大檔案速度要快很多

如下是輸入上面的命令後返回的輸出:
[[email protected] ~]# mkfs.ext4 -T largefile /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=8 blocks, Stripe width=8 blocks
31457280 inodes, 8053063168 blocks
402653158 blocks (5.00%) reserved for the super user
First data block=0
245760 block groups
32768 blocks per group, 32768 fragments per group
128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000, 3855122432, 5804752896

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

//掛載

mount /dev/sdb1 /iscsi/

開機自動掛載

編輯/etc/fstab檔案,加入如下代碼:

UUID=bdef610b-0f6c-4888-b3ea-7dc986109604 /iscsi ext4 defaults,_netdev 0 0 注意:一定要加_netdev不然系統會無法啟動,_netdev的意思是等有了網路之後再掛載。

CentOS-7掛載iscsi網路儲存

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.