前提:需要买一个数据盘。。。

首先通过命令 fdisk -l 确认当前服务器的硬盘列表

Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VBS fileIO
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x74ef0e45

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1  *     2048 209715166 209713119  100G 83 Linux

Disk /dev/sdb: 300 GiB, 322122547200 bytes, 629145600 sectors
Disk model: VBS fileIO
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

可以看到需要挂载的数据盘名称,数据盘名称一般是 /dev/sdb

运行命令 mkfs.ext4 /dev/sdb 格式化数据盘为ext4文件系统(假设数据盘的设备名称是/dev/sdb

[root@ecs-160263-0001 ~]# mkfs.ext4 /dev/sdb
mke2fs 1.46.4 (18-Aug-2021)
Creating filesystem with 78643200 4k blocks and 19660800 inodes
Filesystem UUID: ffc47d08-5101-4019-a44d-0068670a45d4
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616

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

运行命令 mkdir /ssd_01 创建一个用于挂载云盘的目录(取ssd_01的原因是,数据盘的类型是通用SSD,01用来标序)
运行命令 mount /dev/sdb /ssd_01 将云盘挂载到 /ssd_01 目录
最后可以用 df -h 确认一下

[root@ecs-160263-0001 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           7.4G     0  7.4G   0% /dev/shm
tmpfs           7.4G   25M  7.4G   1% /run
tmpfs           4.0M     0  4.0M   0% /sys/fs/cgroup
/dev/sda1        99G  3.6G   91G   4% /
tmpfs           7.4G     0  7.4G   0% /tmp
/dev/sdb        295G   28K  280G   1% /ssd_01

可以看到数据盘已经在里面了~


Jinyun
36 声望1 粉丝