腾讯云服务器是目前市场上非常受欢迎的云服务器之一。它的强大性能、可靠性和灵活性都备受用户好评。而在使用云服务器的过程中,分配硬盘空间是非常重要的一个环节。因此,本文将介绍腾讯云服务器如何分割硬盘。
一、腾讯云服务器硬盘的类型
在进行分割硬盘之前,我们需要了解腾讯云服务器的硬盘类型。目前腾讯云服务器的硬盘类型主要有两种:云硬盘和本地硬盘。
1.云硬盘:云硬盘是一种网络硬盘,数据存储在云服务器集群的存储系统中。云硬盘具有高可靠性、高可用性、弹性扩展、灵活付费等特点,适用于需要大量存储的应用场景。
2.本地硬盘:本地硬盘是指腾讯云服务器物理主机上的硬盘,数据存储在服务器硬盘上。本地硬盘性能更为优越,但可靠性较低,适用于需要高性能的应用场景。
了解了这两种硬盘类型的区别,我们下面来介绍如何针对不同硬盘类型进行硬盘分割。
二、云硬盘的分区
云服务器的云硬盘支持多种分区方案,本节将详细介绍如何对云硬盘进行分区。
1.挂载云硬盘
在分区之前,我们需要先挂载云硬盘。
在腾讯云服务器控制台中,进入“云硬盘”页面,找到要分区的硬盘,然后单击右侧的“挂载”按钮。
接着,在弹出的“配置云服务器挂载点”页面中,选择要挂载到的云服务器和挂载点,然后单击“确定”按钮。
2.制作分区
云服务器操作系统的分区工具有很多,本文以CentOS系统为例介绍如何进行分区。
首先,通过命令lsblk查看硬盘信息:
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 38.8G 0 part
├─centos-root 253:0 0 36.8G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
其中,sda是我们要分区的硬盘。现在该硬盘已经被分成三个分区:/boot/efi、/boot和/。我们需要再将剩余的空间划分为新的分区。
使用fdisk工具对硬盘进行分区:
[root@localhost ~]# fdisk /dev/sda
然后,输入m命令查看帮助信息,看一下有哪些命令可用。我们需要进行的是新建分区,所以输入n命令。
[root@localhost ~]# fdisk /dev/sda
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): m
…
Command (m for help): n
接着,根据提示选择分区的类型和位置。
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p):
Using default response p
Partition number (3-4, default 3):
First sector (2101248-83886079, default 2101248):
Using default value 2101248
Last sector, sectors or size{K,M,G} (2101248-83886079, default 83886079):
Using default value 83886079
Partition 3 of type Linux and of size 39.7 GiB is set
最后,我们需要将分区写入硬盘并退出fdisk。
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
三、本地硬盘分区
对于本地硬盘,我们也可以参考上一节中的fdisk工具进行分区。唯一不同的是,在使用fdisk工具进行分区之前,需要先对本地硬盘进行初始化。
1.初始化本地硬盘
在进行分区之前,我们需要对本地硬盘进行初始化。初始化过程会将本地硬盘格式化为一个全新的分区。
首先,使用fdisk工具对硬盘进行分区:
[root@localhost ~]# fdisk /dev/sdb
然后,输入m命令查看帮助信息,看一下有哪些命令可用。我们需要进行的是全新分区,所以输入o命令。
[root@localhost ~]# 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): m
…
Command (m for help): o
接着,将分区写入硬盘并退出fdisk。
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
现在,我们就可以对本地硬盘进行分区了。
2.制作分区
与云硬盘的分区方法相同。使用fdisk工具对本地硬盘进行分区:
[root@localhost ~]# fdisk /dev/sdb
然后,输入m命令查看帮助信息,看一下有哪些命令可用。我们需要进行的是新建分区,所以输入n命令。
[root@localhost ~]# 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): m
…
Command (m for help): n
接着,根据提示选择分区的类型和位置。最后,我们需要将分区写入硬盘并退出fdisk。
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
四、总结
通过本文的介绍,我们可以了解到在使用腾讯云服务器时,如何针对不同的硬盘类型进行硬盘分区。无论是云硬盘还是本地硬盘,我们都可以使用fdisk工具对硬盘进行分区。希望这篇文章能够对读者有所帮助。
转转请注明出处:https://www.yunxiaoer.com/119635.html