Service side:
First take out a piece of partition/dev/sda5
# Yum Search Target
# yum Install scsi-target-utils.x86_64-y//service-side packages
# vim/etc/tgt/targets.conf//Edit the configuration of the server side
<target redhat:1>//share out the name of this partition is Redhat:1
Backing-store/dev/sda5
</target>
/ETC/INIT.D/TGTD Restart//Restart service
Installation of the client:
# Yum Search iSCSI Find to iSCSI package and install
[Email protected] conf.d]# iscsiadm-m discovery-t st-p 192.168.3.60//First discover this partition on the server
Starting iscsid: [OK]
192.168.3.60:3260,1 redhat:1
[Email protected] conf.d]#
[[email protected] conf.d]# iscsiadm-m node-t redhat:1-P 192.168.3.60-l//use to enter this partition
Logging in to [Iface:default, Target:redhat:1, portal:192.168.3.60,3260] (multiple)
Login to [Iface:default, Target:redhat:1, portal:192.168.3.60,3260] successful.
disk/dev/sda:209 MB, 209715200 bytes
# FDISK-CU/DEV/SDA
[Email protected] conf.d]# partx-d/DEV/SDA
Error deleting partitions 2-256:blkpg:no such device or address
[Email protected] conf.d]# partx-a/DEV/SDA
# MKFS.EXT4/DEV/SDA1
[Email protected] conf.d]# mount/dev/sda1/mnt/
[[email protected] conf.d]# DF
Filesystem 1k-blocks used Available use% mounted on
/dev/mapper/volgroup-lv_root 6926264 1557096 5017324 24%/
Tmpfs 244988 0 244988 0%/dev/shm
/DEV/VDA1 495844 33487 436757 8%/boot
/DEV/SDA1 197338 5646 181504 4%/mnt
# umount/mnt/
# iscsiadm-m node-t redhat:1-P 192.168.3.60-u
# fdisk-l//SDA1 is no more
#/ETC/INIT.D/ISCSI Restart
# Fdisk-l//reboot and find it back again.
disk/dev/sda:209 MB, 209715200 bytes
# iscsiadm-m node-t redhat:1-P 192.168.3.60-u
# iscsiadm-m node-t redhat:1-P 192.168.3.60-o Delete
#/ETC/INIT.D/ISCSI Restart
# fdisk-l
No, it won't come back.