gparted 创建分区 / mkfs 格式化分区为某filesystem

gparted 命令:

(parted) mkpart part-type fs-type start end
part-type is one of primary, extended or logical, and is meaningful only for MBR partition tables.
fs-type is an identifier chosen among those listed by entering help mkpart as the closest match to the file system that you will use.
The mkpart command does not actually create the file system: the fs-type parameter will simply be used by parted to set a 1-byte code that is used by boot loaders to “preview” what kind of data is found in the partition, and act accordingly if necessary. See also Wikipedia:Disk partitioning#PC partition types.
Tip: Most Linux native file systems map to the same MBR partition type code (0x83), so it is perfectly safe to e.g. use ext2 for an ext4-formatted partition.
start is the beginning of the partition from the start of the device. It consists of a number followed by a unit, for example 1MiB means start at 1 MiB.
end is the end of the partition from the start of the device (not from the start value). It has the same syntax as start, for example 100% means end at the end of the device (use all the remaining space).

gparted 实践:

背景:我是vmware上安装好的debian,后面打算分出一部分来实验linux from scratch

步骤1:

首先用fdisk -l 查询以下现在磁盘的使用情况,我的情况是:

root@peng:/home/peng# fdisk -l
Disk /dev/sda: 70 GiB, 75161927680 bytes, 146800640 sectors
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: 0x4f34802b

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048 103811071 103809024 49.5G 83 Linux
/dev/sda2       103811072 104857599   1046528  511M  5 Extended
/dev/sda5       103813120 104857599   1044480  510M 82 Linux swap / Solaris

步骤2:

参数1: 你想在哪个设备上操作,我是/dev/sda
参数2:使用生成分区mkpart
参数3:选择主分区primary
参数4:文件系统选择ext4
参数5:磁盘起点选择50G以后,系统会自动帮你分配合适的位置
参数6:该分区的终点懒得指明了,我要用剩下的所有,所以这里填100%

parted /dev/sda mkpart primary ext4 50G 100%
步骤3 格式化分区为ext4格式:

mkfs /dev/sda3 -t ext4

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用gparted进行分区的简单教程: 1. 下载并安装gparted 首先,您需要从gparted官方网站(https://gparted.org/download.php)下载最新版本的gparted。安装方式会因您使用的操作系统而有所不同。 2. 启动gparted 启动gparted,您将看到一个列表,其中包含您的硬盘驱动器和分区。请注意,gparted将显示所有硬盘驱动器和分区,所以请务必小心,以免意外删除或格式化重要数据。 3. 选择要分区的驱动器 从列表中选择要分区的驱动器。如果您不确定,请查看设备的详细信息,以了解驱动器的大小和分区状态。 4. 创建分区 右键单击驱动器上的未分配空间,并选择“新建分区”。在创建分区之前,请确保您了解所需分区的大小和文件系统类型。请注意,创建分区将删除该区域中的所有数据。 5. 更改分区大小 如果您需要更改现有分区的大小,请右键单击分区并选择“调整大小/移动”。在此过程中,请确保您不会覆盖其他分区或未分配的空间。 6. 格式化分区 如果您创建了新分区或更改了现有分区的大小,则需要格式化分区,以使其能够存储文件。右键单击分区并选择“格式化到”选项。选择所需的文件系统类型,并为分区设置一个名称。 7. 应用更改 完成任何分区更改后,请单击菜单中的“应用所有操作”按钮,以将更改应用到硬盘驱动器中。请注意,此操作无法撤销,因此在操作之前,请务必备份重要数据。 以上是使用gparted进行分区的简单教程。请注意,对分区进行任何更改都存在风险,因此在操作之前,请务必备份数据。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值