rhce 20 配置 ISCSI 的客户端

rhce 20 配置 ISCSI 的客户端 有更新!

配置system2使其能链接在system1上提供的 并符合以下要求:
1. ISCISI设备在系统启动的期间自动加载

2. 块设备ISCISI上包含一个大小为2100MIB的分区,并格式化为ext4

3. 此分区挂载在/mnt/data上 同时在系统启动的期间自动挂载


安装 ISCSI 客户端工具

    yum install iscsi-initiator-utils.i686 -y


    vim /etc/iscsi/initiatorname.iscsi

通过 ==man iscsiadm== 查找命令发现服务端 ISCSI 并连接

       Discover targets at a given IP address:

            iscsiadm --mode discoverydb --type sendtargets --portal --discover

       Login, must use a node record id found by the discovery:

            iscsiadm --mode node --targetname --portal --login


            iscsiadm --mode node --targetname --portal --logout

    [root@system2 Desktop]# iscsiadm --mode discoverydb --type sendtargets --portal --discover,1
    [root@system2 Desktop]# iscsiadm --mode node --targetname --portal --login
    Logging in to [iface: default, target:, portal:,3260] (multiple)
    Login to [iface: default, target:, portal:,3260] successful.
    [root@system2 Desktop]# lsblk 
    sda      8:0    0   20G  0 disk 
    ├─sda1   8:1    0  9.8G  0 part /
    └─sda2   8:2    0    2G  0 part [SWAP]
    sdb      8:16   0    3G  0 disk 

按照要求,对已成功获取的 ==sdb== 进行分区

    [root@system2 Desktop]# fdisk /dev/sdb
    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.
    Device does not contain a recognized partition table
    Building a new DOS disklabel with disk identifier 0xaeacfbad.
    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1): 
    First sector (8192-6291455, default 8192): 
    Using default value 8192
    Last sector, +sectors or +size{K,M,G} (8192-6291455, default 6291455): +2100MIB
    Unsupported suffix: 'MIB'.
    Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)
                2^N: K  (KibiByte), M  (MebiByte), G  (GibiByte)
    Last sector, +sectors or +size{K,M,G} (8192-6291455, default 6291455): +2100MB     
    Partition 1 of type Linux and of size 2 GiB is set
    Command (m for help): w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    Syncing disks.
    [root@system2 Desktop]# partprobe 
    [root@system2 Desktop]# mkdir /mnt/data
    [root@system2 Desktop]# mkfs.ext4 /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=0 blocks, Stripe width=1024 blocks
    128256 inodes, 513024 blocks
    25651 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=526385152
    16 block groups
    32768 blocks per group, 32768 fragments per group
    8016 inodes per group
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376, 294912
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done 


    [root@system2 Desktop]# vim /etc/fstab 
    /dev/sdb1                       /mnt/data               ext4    _netdev                         0 0
    [root@system2 Desktop]# mount -a
    [root@system2 Desktop]# df -hT
    Filesystem       Type      Size  Used Avail Use% Mounted on
    /dev/sda1        xfs       9.8G  3.1G  6.7G  32% /
    devtmpfs         devtmpfs  765M     0  765M   0% /dev
    tmpfs            tmpfs     773M  176K  773M   1% /dev/shm
    tmpfs            tmpfs     773M  8.9M  765M   2% /run
    tmpfs            tmpfs     773M     0  773M   0% /sys/fs/cgroup
    /dev/sdb1        ext4      1.9G  5.9M  1.8G   1% /mnt/data