ISCSI 网络磁盘共享

本文详细介绍了如何通过ISCSI技术设置服务端和客户端,实现远程机房的硬盘共享。首先在服务端创建逻辑卷,然后共享磁盘,并解决在客户端登录时可能出现的问题。最后,验证共享设备并演示了如何撤回共享分区。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ISCSI技术实现了物理硬盘设备与TCP/TP网络传输的相互结合,使得客户可以通过互联网方便的获得到远程机房提供的共享存储资源

使用硬盘共享设备

1、服务端设定
(1)下载服务(yum源版本需和下载版本一至,否则服务不可用)
在这里插入图片描述
在这里插入图片描述

(2)新建一个逻辑卷用于共享

[root@shareserver ~]# fdisk -l ##查看现有分区
Disk /dev/sda: 9663 MB, 9663676416 bytes, 18874368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00094fb4
Device Boot Start End Blocks Id System
/dev/sda1 2048 411647 204800 83 Linux
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x79ecac8f
Device Boot Start End Blocks Id System

(3)新建一个逻辑卷

[root@shareserver ~]# 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.
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 (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +1G
Partition 1 of type Linux and of size 1 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition ‘Linux’ to ‘Linux LVM’
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x79ecac8f
Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 8e Linux LVM
Command (m for help): wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@shareserver ~]#

(4)新建物理卷/逻辑卷组以及逻辑卷

[root@shareserver ~]# pvcreate /dev/sdb1
Physical volume “/dev/sdb1” successfully created
[root@shareserver ~]# vgcreate vg0 /dev/sdb1
Volume group “vg0” successfully created
[root@shareserver ~]# vgdisplay
— Volume group —
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 496.00 MiB
PE Size 4.00 MiB
Total PE 124
Alloc PE / Size 0 / 0
Free PE / Size 124 / 496.00 MiB
VG UUID qE6TbE-7irb-Cedc-FMg4-u1ui-s9EN-RfXo1I
[root@shareserver ~]# lvcreate -l 124 -n lv0 vg0
WARNING: ext4 signature detected on /dev/vg0/lv0 at offset 1080. Wipe it? [y/n]: y
Wiping ext

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值