应用场景
服务器IP地址为:192.168.0.32,API端口号为1443,WEB端口号为2443,安装路径为/mnt/stor(挂载磁盘/dev/vdd),数据目录为/mnt/storage01(挂载磁盘/dev/vdc)、/mnt/storage02(挂载磁盘/dev/vda)。
创建卷:本地模式的卷luna1,对应iSCSI Target为targeta,卷容量为100G;缓存模式卷lunb1,对应iSCSI Target为targetb,卷容量为200G;存储模式卷lunc1,对应iSCSI Target为targetc,卷容量为300G。
缓存模式和存储模式卷对应的OOS存储桶为:hblocktest3。
HBlock系统名称为stor1,HBlock登录用户名为storuser,登录密码为hblock12@。
操作步骤
说明
以HBlock 4.0为例。
完成以下准备工作:安装路径/mnt/stor,数据目录/mnt/storage01、/mnt/storage02。OOS存储桶hblocktest3,AK/SK,前缀stor1。
将安装包放到服务器欲安装HBlock的目录下并解压缩,进入解压缩后的文件夹。
[root@hblockserver stor]# ls CTYUN_HBlock_Plus_4.0.0_x64.zip [root@hblockserver stor]# unzip CTYUN_HBlock_Plus_4.0.0_x64.zip …… [root@hblockserver stor]# cd CTYUN_HBlock_Plus_4.0.0_x64 [root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]#安装并初始化HBlock。
安装HBlock。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor install -w 2443 Do you agree with HBlock User Agreement? [Yes/No] Used in Chinese mainland, follow https://www.ctyun.cn/portal/protocol/10073150 Otherwise, follow https://www.esurfingcloud.com/portal/protocol/20692906 y Installing HBlock... Installed successfully. When all servers are installed, please initialize HBlock in any of the following ways: 1. Use web portal to initialize HBlock. The https port is 2443. 2. Use management API (POST /rest/v1/system/setup) to initialize HBlock. The https port is 1443. 3. Use command line (stor setup) to initialize HBlock. Type 'stor --help setup' for more information.初始化HBlock。
密码可以按交互式输入,使用交互式输入密码时,以密文形式显示。[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor setup -n stor1 -u storuser -s 192.168.0.32:/mnt/storage01,/mnt/stor Please enter password: ********* Start to setup HBlock, please wait. Processing... Setup successfully and the HBlock services have been started. Welcome to HBlock! You are using a 30-day trial version. Please follow the steps to get a license. 1. Run "stor info --serial-id" to get the serial ID of the HBlock 2. Contact the software vendor to obtain a license 3. Run "stor license add -k KEY" to import the license Type 'stor --help' to get more information, such as managing LUNs, targets, servers, etc.查询服务器。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor server ls -n hblock_1 Server Name: hblockserver Server ID: hblock_1 Status: Connected Public Address: 192.168.0.32:3260 Cluster Address: 192.168.0.32 Recent Start Time: 2025-12-26 10:25:05 Version: 4.0.0 Parameters: {"maxMemoryRatio":0.95,"maxMemorySize":9223372036853727232} Disk Path(s): +-----+-------------------+---------------+----------------+---------------------+----------------+---------------+---------------+ | No. | Path | Used Capacity | Total Capacity | Used Capacity Quota | Capacity Quota | Health Status | Health Detail | +-----+-------------------+---------------+----------------+---------------------+----------------+---------------+---------------+ | 1. | /mnt/storage01(*) | 19.37 GiB | 93.29 GiB | 4 KiB | Unlimited | Healthy | - | | 2. | /mnt/stor | 1.17 GiB | 93.29 GiB | 4 KiB | Unlimited | Healthy | - | +-----+-------------------+---------------+----------------+---------------------+----------------+---------------+---------------+
获取软件许可证并加载。
HBlock软件提供30天试用期,过期后仅部分功能可用。您可以通过下列步骤获取软件许可证并加载。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor info --serial-id HBlock serial ID: HBlock serial ID: 0A769770-1528-49B8-A82D-D1CB71333FFB-0201-040000 [root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor license add -k ****** Import license successfully. Customer name: Customer ABC As the operating entity utilizing the HBlock to run your business, you bear the responsibility for the network and information security of the business you are operating. The current system time: 2025-12-26 11:31:29 +--------------------------------------+---------------+-----------+-----------+----------------------+ | LicenseId | Account | Type | Status | MaximumLocalCapacity | +--------------------------------------+---------------+-----------+-----------+----------------------+ | qws2b6a9-f3fb-4098-a6b3-3652a5a76530 | test@ctyun.cn | Perpetual | Effective | 2 PiB | +--------------------------------------+---------------+-----------+-----------+----------------------+ License qws2b6a9-f3fb-4098-a6b3-3652a5a76530 (Effective): Usage: +----------------------+--------------------------+-----------------------+-----------+ | MaximumLocalCapacity | MaintenanceEffectiveTime | MaintenanceExpireTime | Status | +----------------------+--------------------------+-----------------------+-----------+ | 2 PiB | 2025-12-26 11:25:05 | 2026-12-26 11:25:05 | Effective | +----------------------+--------------------------+-----------------------+-----------+创建iSCSI Target并查询。
创建iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor target add -n targeta --max-sessions 3 -c chap-test -p ****** -s on Created target targeta successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) [root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor target add -n targetb --max-sessions 2 Created target targetb successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260) [root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor target add -n targetc Created target targetc successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260)查询iSCSI Target。
查询所有iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor target ls +-----+-------------+--------------+----------------------------------------------------------+-------------------+ | No. | Target Name | Max Sessions | ISCSI Target | CHAP | +-----+-------------+--------------+----------------------------------------------------------+-------------------+ | 1. | targeta | 3 | iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) | chap-test,Enabled | | 2. | targetb | 2 | iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260) | Disabled | | 3. | targetc | 1 | iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260) | Disabled | +-----+-------------+--------------+----------------------------------------------------------+-------------------+查询指定iSCSI Target,例如查询targeta。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor target ls -n targeta Target Name: targeta Max Sessions: 3 Create Time: 2025-12-26 12:28:05 iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) Reclaim Policy: Delete CHAP: chap-test,test1test2024,Enabled
创建卷并查询。
创建卷。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor lun add -n luna1 -p 100 -t targeta Created LUN luna1 successfully. [root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor lun add -n lunb1 -t targetb -p 200 -m Cache -B hblocktest3 -E oos-cn.ctyunapi.cn -A cb22b08b1f9229f85874 -S ************** --sign-version v4 --region cn -X stor1 Created LUN lunb1 successfully. [root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor lun add -n lunc1 -t targetc -p 300 -m Storage -B hblocktest3 -E oos-cn.ctyunapi.cn -A cb22b08b1f9229f85874 -S ************** --sign-version v4 --region cn -X stor1 Created LUN lunc1 successfully.查询卷。
查询所有卷。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor lun ls +-----+--------------+--------------+----------+--------+-----------------------------------------------------------------+----------------+---------------+----------+ | No. | LUN Name | Storage Mode | Capacity | Status | Target | Snapshot Count | Snapshot Size | Is Clone | +-----+--------------+--------------+----------+--------+-----------------------------------------------------------------+----------------+---------------+----------+ | 1. | luna1(LUN 0) | Local | 100 GiB | Normal | iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260,Active) | 0 | 0 B | | | 2. | lunb1(LUN 0) | Cache | 200 GiB | Normal | iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260,Active) | 0 | 0 B | | | 3. | lunc1(LUN 0) | Storage | 300 GiB | Normal | iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260,Active) | 0 | 0 B | | +-----+--------------+--------------+----------+--------+-----------------------------------------------------------------+----------------+---------------+----------+查询指定卷,例如查询卷luna1。
[root@hblockserver CTYUN_HBlock_Plus_4.0.0_x64]# ./stor lun ls -n luna1 LUN Name: luna1 (LUN 0) Storage Mode: Local Capacity: 100 GiB Status: Normal iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260,Active) Create Time: 2025-12-26 13:28:05 Local Sector Size: 4096 Bytes Data Health: 100% normal, 0% low redundancy, 0% error Write Policy: WriteBack WWID: 33fffffffce6bc2a6 UUID: lun-uuid-9885d5c6-23f7-4739-b580-fc5a233ea3bd Path: /mnt/storage01 Snapshot Count: 0 Snapshot Size: 0 B (Note: Snapshot size may vary due to LUN issues or parent snapshot deletion.)