Академический Документы
Профессиональный Документы
Культура Документы
hostname:
ip:
physical:
Client
server.ol.com
172.16.7.1/16
Host-only
Server/Linux
client.ol.com
172.16.7.8/16
Host-only
%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Server172.16.7.1/16 server.ol.com
Physical
# nmtui
# service network restart
# ifconfig | grep -A1 flag
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.7.1 netmask 255.255.0.0 broadcast 172.16.255.255
...
# hostnamectl set-hostname server.ol.com
# echo 172.16.7.1 server.ol.com >> /etc/hosts
# cat /etc/hosts
...
172.16.7.1 server.ol.com
# 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 0x5f2dafdd.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1400M
Partition 1 of type Linux and of size 1400 MiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
|
| o- iqn.2014-06.com.ol:client [Mapped LUNs: 1]
|
| o- mapped_lun0 [lun0 block/server.zoidberg (rw)]
|
o- luns ............................. [LUNs: 1]
|
| o- lun0 . [block/server.zoidberg (/dev/sdb1)]
|
o- portals ....................... [Portals: 1]
|
o- 172.16.7.1:3260 ..................... [OK]
o- loopback ............................ [Targets: 0]
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
# firewall-cmd --reload
success
Client172.16.7.8/16 client.ol.com
Physical
# nmtui
# service network restart
# ping -c1 172.16.7.1
PING 172.16.7.1 (172.16.7.1) 56(84) bytes of data.
# sed -i 's/=.*/=iqn.2014-06.com.ol:client/'
/etc/iscsi/initiatorname.iscsi
# cat /etc/iscsi/initiatorname.iscsi
InitiatorName= iqn.2014-06.com.ol:client
iscsi.service
# chkconfig iscsid on
Note: Forwarding request to 'systemctl enable iscsid.service'.
ln -s '/usr/lib/systemd/system/iscsid.service'
'/etc/systemd/system/multi-user.target.wants/iscsid.service'
# ls -l /var/lib/iscsi/{send_targets,nodes}
# fdisk -l | grep sd
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sda1 *
2048
1026047
512000 83 Linux
/dev/sda2
1026048 251658239 125316096 8e Linux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/sdc: 2147 MB, 2147483648 bytes, 4194304 sectors
# fdisk /dev/sdc
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 0xc432d66d.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-4194303, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +1400M
Partition 1 of type Linux and of size 1.4 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1
=
=
data
=
=
naming
=version 2
log
=internal log
=
lazy-count=1
isize=256
agcount=4, agsize=89600 blks
sectsz=512
attr=2, projid32bit=1
crc=0
bsize=4096
blocks=358400, imaxpct=25
sunit=0
swidth=0 blks
bsize=4096
ascii-ci=0 ftype=0
bsize=4096
blocks=2560, version=2
sectsz=512
sunit=0 blks,
realtime
=none
extsz=4096
blocks=0, rtextents=0
# blkid /dev/sdc1
/dev/sdc1: UUID="423c522b-7ee8-4372-8df0-56680ca8a0bc" TYPE="xfs"
# mkdir /mnt/data
# echo -e
'UUID=423c522b-7ee8-4372-8df0-56680ca8a0bc\t/mnt/data\txfs\
tdefaults,_netdev\t0 0' >> /etc/fstab
# tail -n 2 /etc/fstab
/dev/mapper/rhel-swap swap
UUID=423c522b-7ee8-4372-8df0-56680ca8a0bc
defaults,_netdev 0 0
swap
defaults
/mnt/data
0 0
xfs
# mount -a
# findmnt /mnt/data
TARGET
SOURCE
/mnt/data /dev/sdc1 xfs
FSTYPE OPTIONS
rw,relatime,seclabel,attr2,inode64,noquota