乐趣区

关于华为云:华为云之EVS云硬盘的使用与快速入门

@TOC

一、EVS 云硬盘介绍

云硬盘(Elastic Volume Service)是一种为 ECS、BMS 等计算服务提供持久性块存储的服务,通过数据冗余和缓存减速等多项技术,提供高可用性和持久性,以及稳固的低时延性能。您能够对云硬盘做格式化、创立文件系统等操作,并对数据做长久化存储。

二、购买 ECS 云服务器

1. 创立 windows 零碎的 ECS 云主机

2. 创立 Linux 零碎的 ECS 云主机

三、创立 EVS 云硬盘

创立两块云硬盘,一块挂载 windows 应用,一块挂载 linux 应用

四、云硬盘挂载 windows 零碎的 ECS

1. 挂载云硬盘 windows

2. 登录到 windows 的 ECS 云主机

3. 查看磁盘列表

4. 初始化磁盘

5. 新建卷

6. 查看新加卷

7. 向磁盘写入数据

五、云硬盘挂载 Linux 零碎的 ECS

1. 挂载到 Linux 零碎的云主机

2. 进入 Linux 云主机

3. 查看磁盘列表

[root@ecs-b15f ~]# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  40G  0 disk 
└─vda1 253:1    0  40G  0 part /
vdb    253:16   0  10G  0 disk 

3. 磁盘分区

[root@ecs-b15f ~]# fdisk /dev/vdb
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 0xb7e5d6cb.

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-20971519, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): 
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

4. 格式化磁盘


[root@ecs-b15f ~]# mkfs.ext4 /dev/vdb1
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=0 blocks
655360 inodes, 2621184 blocks
131059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

5. 挂载分区


[root@ecs-b15f ~]# mount /dev/vdb1 /data/
[root@ecs-b15f ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        486M     0  486M   0% /dev
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           496M  6.8M  489M   2% /run
tmpfs           496M     0  496M   0% /sys/fs/cgroup
/dev/vda1        40G  2.1G   36G   6% /
tmpfs           100M     0  100M   0% /run/user/0
/dev/vdb1       9.8G   37M  9.2G   1% /data

6. 向磁盘写入数据

[root@ecs-b15f ~]# cd /data/
[root@ecs-b15f data]# touch file100
[root@ecs-b15f data]# ll
total 16
-rw-r--r-- 1 root root     0 Oct 21 21:39 file100
drwx------ 2 root root 16384 Oct 21 21:37 lost+found

六、云硬盘 EVS 快照

1. 创立磁盘快照

2. 查看快照列表

3. 删除文件

[root@ecs-b15f data]# ls
file100  lost+found
[root@ecs-b15f data]# rm -rf file100
[root@ecs-b15f data]# ll
total 16
drwx------ 2 root root 16384 Oct 21 21:37 lost+found
[root@ecs-b15f data]# 

4. 卸载分区

umount /data

5. 卸载云硬盘

6. 应用快照复原磁盘

7. 从新挂载 linux 云主机

8. 查看数据恢复状况

[root@ecs-b15f ~]# mount /dev/vdb1 /data
[root@ecs-b15f ~]# cd /data/
[root@ecs-b15f data]# ls
file100  lost+found
[root@ecs-b15f data]# 
退出移动版