Centos6.6 Mount iscsi Storage
To solve the company's backup and log problems, we have specially set up a backup server and prepared 8 TB storage space for use. Now we will mount iscsi storage on the client.
1. The client installs the iscsi installation package and starts
Yuminstall binutils iscsi-initiator-utils kmod-xfs xfsprogs
Service iscsi start
Kmod-xfs xfsprogs is the component of the xfs file system.
2. Configure initiatiorname
Add the target name to initiatorname. iscsi.
Vim/etc/iscsi/initiatorname. iscsi
InitiatorName = iqn.1994-05.com. redhat: 677b9f2936f8
3. target found
[root@usvr119 data]# iscsiadm -m discovery -t sendtargets -p 192.168.3.16192.168.3.16:3260,1 iqn.2001-05.com.equallogic:0-af1ff6-dce2985d0-95e004e6a155508d-bak-disk01
4. log on to the target
Iscsiadm-m node-T iqn.2001-05.com. equallogic: 0-af1ff6-dce2985d0-95e004e6a155508d-bak-disk01-p 192.168.3.16: 3260 -- login
5. Check whether the storage is mounted.
[root@usvr119 data]# fdisk -lDisk /dev/sdb: 8796.1 GB, 8796100362240 bytes255 heads, 63 sectors/track, 1069398 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytes
6. Partition with parted
Parted/dev/sdb
Mklabel gpt: Set the partition to gpt.
Mkpart primary 0% 100% divides the space into a partition
Print
Quit
Note: fdisk supports disks smaller than 2 TB. parted is required for disks larger than 2 TB.
7. format the partition
Mkfs. ext4-T largefile/dev/sdb1
Note:-T largefile is much faster to format large files.
View the uuid of a disk
Blkid/dev/sdb1
/Dev/sdb1: UUID = "27f0ec37-d7ab-4c93-b9e3-cd09ddd9e340" TYPE = "ext4"
8. Attach a hard disk
Mount-t ext4/dev/sdb1/data
9. automatic mounting upon startup
Log on to/etc/rc. local first.
Vim/etc/rc. lcoal
Iscsiadm-m node-T iqn.2001-05.com. equallogic: 0-af1ff6-dce2985d0-95e004e6a155508d-bak-disk01-p 192.168.3.16: 3260 -- login
Vim/etc/fstab
UUID = 27f0ec37-d7ab-4c93-b9e3-cd09ddd9e340/data ext4 defaults 0 0
Note: The first 0 is about dump, and the second 0 is about fsck. After the start, fsck/dev/sdb1 is displayed, in this case, the startup fails because no mounting is available.