在Linux系统中,创建分区通常涉及使用磁盘分区工具,如fdisk
、parted
等。以下是使用fdisk
命令创建分区的基本步骤和相关概念:
/dev/sdb
磁盘进行分区。n
创建新分区。w
保存分区表并退出。q
不保存并退出。假设我们要在/dev/sdb
上创建一个10GB的主分区:
sudo fdisk /dev/sdb
在fdisk
命令行界面中:
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +10G
Created a new partition 1 of type 'Linux' and of size 10 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
通过以上步骤和示例,你应该能够在Linux系统中成功创建分区。
领取专属 10元无门槛券
手把手带您无忧上云