云服务器硬盘如何分区

云服务器硬盘如何分区?一般我们在安装云服务器操作系统的过程中,已经对系统硬盘进行了分区,但如果新添加了一块硬盘,想要正常使用,在 Linux 中有专门的分区命令 fdisk 和 parted。

其中 fdisk 命令较为常用,但不支持大于 2TB 的分区;如果需要支持大于 2TB 的分区,则需要使用 parted 命令,当然 parted 命令也能分配较小的分区。我们先来看看如何使用 fdisk 命令进行分区。

fdisk 命令的格式如下:

[root@localhost ~]# fdisk ~l
#列出系统分区
[root@localhost ~]# fdisk 设备文件名
#给硬盘分区

注意,千万不要在当前的硬盘上尝试使用 fdisk,这会完整删除整个系统,一定要再找一块硬盘,或者使用虚拟机。

以硬盘 /dev/sdb 为例做练习,命令如下:

[root@localhost ~]# fdisk /dev/sdb
#给/dev/sdb分区
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xed7e8bc7.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated.it's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').
Command (m for help):m
#交互界面的等待输入指令的位置,输入 m 得到帮助
Command action
#可用指令
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
I list known partition types m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verity the partition table
w write table to disk and exit
x extra functionality (experts only)

注意这里的分区命令是 “fdisk /dev/sdb”,这是因为硬盘并没有分区,使用 fdisk 命令的目的就是建立分区。

西部数码云服务器简单易用,稳定可靠,主机vCPU、内存各项性能指标业界领先,满足不断变化的用户需求。云服务器产品链接 https://www.west.cn/cloudhost/

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-62778877-8261;邮箱:jenny@west.cn。本站原创内容未经允许不得转载,或转载时需注明出处::西部数码资讯门户 » 云服务器硬盘如何分区

赞 (0)