// Install related software. kmod-XFS and xfsprogs are components of the XFS file system.
yum install binutils iscsi-initiator-utils kmod-xfs xfsprogs
// Start the iscsi service
service iscsi start
// Check whether the storage server's iSCSI is online
iscsiadm -m discovery --type sendtargets --portal 192.168.2.30
The result returned after the preceding command is entered is as follows:
192.168.2.30: 3260,1 iqn.1986-03.com. IBM: 2145. v37001.node2
// Set Automatic iSCSI login upon startup
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
// Display the current connection
iscsiadm -m session
The result returned after the preceding command is entered is as follows:
TCP: [1] 192.168.2.30: 3260,1 iqn.1986-03.com. IBM: 2145. v37001.node2 (non-flash)
// Check whether the bucket is displayed in the disk list
fdisk -l
The following shows my bucket
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
// Use the parted command to partition
Parted/dev/SDB mklabel GPT // create ID mkpart primary 0% 100% // allocate all space print // display the current partition quit // exit
// Format the hard disk with The mkfs. ext4 command
Mkfs. ext4-T largefile/dev/sdb1 parameter description:-T largefile is much faster to format large files.
The output returned after the preceding command is entered is as follows:
[[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,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,
4096000,796 2624, 11239424,204 80000, 23887872,716 63616, 78675968,
102400000,214 990848, 512000000,550 73 1776, 644972544,193 4917632,
2560000000,385 5122432, 5804752896
Allocating group tables: Done
Writing inode tables: Done
Creating Journal (32768 blocks): Done
Writing superblocks and filesystem accounting information: Done
// Mount
mount /dev/sdb1 /iscsi/
Automatic mounting upon startup
Edit/Etc/fstabFile, add the following code:
UUID = bdef610b-0f6c-4888-b3ea-7dc986109604/iSCSI ext4 defaults, _ netdev 0 0 Note: Be sure to add _ netdev or the system will not be able to start, _ netdev means that after the network is attached.
CentOS-7 Mount iSCSI Network Storage