使用fdisk 、gdisk管理分区

news2025/5/11 8:14:32
fdisk 管理分区
fdisk 命令工具默认将磁盘划分为 mbr 格式的分区
命令: fdisk 设备名 fdisk 命令以交互方式进行操作的,在菜单中选择相应功能键即可
[root@localhost ~]# fdisk /dev/sda
# sda 进行分区
Command (m for help):
# 进入 fdisk 交互界面进行分区
Command (m for help): m
# 输入 m 可查看帮助信息
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): n
# 输入 n 创建新分区
Partition type
p primary (0 primary, 0 extended, 4 free)
# 输入 p 创建主分区
e extended (container for logical partitions)
# 输入 e 创建扩展分区
Select (default p): p
# 输入 p 创建主分区
Partition number (1-4, default 1): 1
# 选择主分区号,输入 1 表示第一个主分区
First sector (2048-10485759, default 2048):
# 直接按回车从当前第 2048 个扇区开始分区
Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): +300M
# 设置第一个分区为 300M
Created a new partition 1 of type 'Linux' and of size 300 MiB.
# 一个主分区创建完成,大小为 300M
Command (m for help): p
# 输入 p 查看分区信息
Disk /dev/sda: 5 GiB, 5368709120 bytes, 10485760 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: 0x5bb0744f
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 616447 614400 300M 83 Linux
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 616447 614400 300M 83 Linux
/dev/sda2 616448 10485759 9869312 4.7G 0 Empty
# 有两个分区,其中新添加的 sda2 有误,需要删除
Command (m for help): d
# 输入 d 删除分区
Partition number (1,2, default 2): 2
# 输入 2 ,选择需要删除的是第二个分区
Partition 2 has been deleted.
Command (m for help): p
Disk /dev/sda: 5 GiB, 5368709120 bytes, 10485760 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: 0x5bb0744f Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 616447 614400 300M 83 Linux
# 查看现有分区,有误的 sda2 已删除
# 创建一个扩展分区
Command (m for help): n
# 输入 n 创建新分区
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e
# 输入 e 创建扩展分区
Partition number (2-4, default 2): 2
# 选择分区号,输入 2 表示第二个分区
First sector (616448-10485759, default 616448):
# 直接按回车从当前第 616448 个扇区开始分区
Last sector, +sectors or +size{K,M,G,T,P} (616448-10485759, default 10485759): +500M
# 添加一个 500M 的分区
Created a new partition 2 of type 'Extended' and of size 500 MiB.
Command (m for help): p
Disk /dev/sda: 5 GiB, 5368709120 bytes, 10485760 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: 0x5bb0744f
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 616447 614400 300M 83 Linux
/dev/sda2 616448 1640447 1024000 500M 5 Extended
# 输入 p 查看,新增一个 500M 的扩展分区
Command (m for help): w
# 所有分区设置完成后,输入 w 保存,即可退出 fdisk 交互界面
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
使用 gdisk 管理分区
gdisk 命令工具默认将磁盘划分为 GPT 格式的分区
[root@localhost ~]# gdisk /dev/sda
# 进入 gdisk 交互界面
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present Command (? for help): ?
# 输入 ? 可查看帮助信息
b
back up GPT data to a file
c
change a partition's name
d
delete a partition
i
show detailed information on a partition
l
list known partition types
n
add a new partition
o
create a new empty GUID partition table (GPT)
p
print the partition table
q
quit without saving changes
r
recovery and transformation options (experts only)
s
sort partitions
t
change a partition's type code
v
verify disk
w
write table to disk and exit
x
extra functionality (experts only)
?
print this menu
#gdisk 创建新分区(默认 GPT 格式)
Command (? for help): n
# 输入 n 创建新分区
Partition number (1-128, default 1):
# 输入分区编号,默认为 1 ,因为是 /dev/sda 硬盘的第一块分区
First sector (34-10485726, default = 2048) or {+-}size{KMGTP}: # 输入扇区的开始位置,选择默认即
可,也可手动指定
Last sector (2048-10485726, default = 10485726) or {+-}size{KMGTP}: +300M
#
入扇区的结束位置,一般都是指定磁盘大小,这里输入 +300M 表示新分区大小为 300M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
# 默认即可,分区完成后可以修改
Changed type of partition to 'Linux filesystem'
Command (? for help): p
# 输入 p 查看分区情况
Disk /dev/sda: 10485760 sectors, 5.0 GiB
Model: VMware Virtual S
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 61FA16FB-FAD8-4873-A857-BD387FE0A592
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 10485726
Partitions will be aligned on 2048-sector boundaries
Total free space is 9871293 sectors (4.7 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 616447 300.0 MiB 8300 Linux filesystem Command (? for help): w
# 输入 w 保存分区并退出 gdisk 交互界面
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2372968.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

如何通过C# 获取Excel单元格的数据类型

在处理 Excel 文件时,了解单元格的数据类型有助于我们正确地解析和处理数据。Free Spire.XLS 是一款功能强大且免费的.NET 组件,支持高效地操作 Excel 文件,包括读取单元格类型。本文将详细介绍如何使用 Free Spire.XLS 来获取 Excel 单元格的…

Fiori学习专题三十九:使用标准模板创建一个应用程序

之前的课程我们按照教程一步一步创建了我们的一个应用程序,但是总不能每次开发都像这样子来做,那样就太慢了。事实上MVC架构的应用程序,是有很多模板,今天我们就按照模板来创建一个应用程序。 开发工具还是使用vscode,…

模型 启动效应

系列文章分享模型,了解更多👉 模型_思维模型目录。刺激先行激活,后续认知更顺畅。 1 启动效应的应用 1.1 求职面试中对面试官的影响 背景:一家知名公司在招聘过程中发现,面试官对候选人的评价往往受到多种因素的影响…

【前端分享】CSS实现3种翻页效果类型,附源码!

使用 css 可以实现多种翻页效果&#xff0c;比如书本翻页、卡片翻转等。以下是两种常见的翻页效果实现&#xff1a; 效果 1&#xff1a;书本翻页效果 通过 transform 和 rotateY 实现 3D 翻页效果。 html 结构 <divclass"book"> <divclass"page pa…

vue使用rules实现表单校验——校验用户名和密码

编写校验规则 常规校验 const rules {username: [{ required: true, message: 请输入用户名, trigger: blur },{ min: 5, max: 16, message: 长度在 5 到 16 个字符, trigger: blur }],password: [{ required: true, message: 请输入密码, trigger: blur },{ min: 5, max: 1…

diy装机成功录

三天前&#xff0c;我正式开启了这次装机之旅&#xff0c;购入了一颗性能强劲的 i5-12400 CPU&#xff0c;一块绘图能力出色的 3060ti 显卡&#xff0c;还有技嘉主板、高效散热器、16G 内存条、2T 固态硬盘&#xff0c;以及气派的机箱和风扇&#xff0c;满心期待能亲手打造一台…

【 Redis | 实战篇 缓存 】

目录 前言&#xff1a; 1.认识缓存 2.添加Redis缓存 2.1.根据id查询商铺缓存 2.2.优化根据id查询商铺缓存 3.缓存更新策略 3.1.三种策略 3.2.策略选择 3.3.主动更新的方案 3.4. Cache Aside的模式选择 3.5.最佳实践方案 4.缓存三大问题 4.1.缓存穿透 4.1.1.介绍 …

2025年全新 GPT 4.5 AI 大模型 国内免费调用

一、中转账号注册 第一步&#xff1a;打开宙流AI中转站&#xff0c;网站地址如下&#xff1a; 宙流AI中转站 按照上图中的操作步骤&#xff0c;通过邮箱进行账号注册&#xff0c;注册完毕后&#xff0c;网站初始会分配0.4刀的免费额度&#xff0c;获取额度后&#xff0c;即可…

“睿思 BI” 系统介绍

“睿思 BI” 商业智能系统是由成都睿思商智科技有限公司自主研发的企业数据分析系统&#xff0c;以下是对该系统的详细介绍&#xff1a; 功能模块 &#xff1a; • 数据集成与准备 &#xff1a;支持数据导入、数据填报、数据 ETL 等功能&#xff0c;可抽取企业在经营过程中产生…

虚假AI工具通过Facebook广告传播新型Noodlophile窃密木马

网络安全公司Morphisec的研究人员发现&#xff0c;攻击者正利用虚假人工智能&#xff08;AI&#xff09;平台传播名为Noodlophile Stealer的新型信息窃取木马。这种复杂攻击手法利用AI工具的热度诱骗用户下载恶意软件&#xff0c;窃取浏览器凭证、加密货币钱包&#xff0c;并可…

麦科信获评CIAS2025金翎奖【半导体制造与封测领域优质供应商】

在苏州举办的2025CIAS动力能源与半导体创新发展大会上&#xff0c;深圳麦科信科技有限公司凭借在测试测量领域的技术积累&#xff0c;入选半导体制造与封测领域优质供应商榜单。本届大会以"新能源芯时代"为主题&#xff0c;汇集了来自功率半导体、第三代材料应用等领…

指针运算典型例题解析

1.题目1 该代码运行的结果是什么&#xff1f; #include <stdio.h> int main() { int a[5] { 1, 2, 3, 4, 5 }; int *ptr (int *)(&a 1); printf( "%d,%d", *(a 1), *(ptr - 1)); return 0; } 解析&#xff1a; 运行结果&#xff1a; 2.题目2 在X86…

DAX 权威指南1:DAX计算、表函数与计算上下文

参考《DAX 权威指南 第二版》 文章目录 二、DAX简介2.1 理解 DAX 计算2.2 计算列和度量值2.3 变量2.3.1 VAR简介2.3.2 VAR的特性 2.4 DAX 错误处理2.4.1 DAX 错误类型2.4.1.1 转换错误2.4.1.2 算术运算错误2.4.1.3 空值或 缺失值 2.4.2 使用IFERROR函数拦截错误2.4.2.1 安全地进…

使用 NV‑Ingest、Unstructured 和 Elasticsearch 处理非结构化数据

作者&#xff1a;来自 Elastic Ajay Krishnan Gopalan 了解如何使用 NV-Ingest、Unstructured Platform 和 Elasticsearch 为 RAG 应用构建可扩展的非结构化文档数据管道。 Elasticsearch 原生集成了行业领先的生成式 AI 工具和提供商。查看我们的网络研讨会&#xff0c;了解如…

20250508在WIN10下使用移远的4G模块EC200A-CN直接上网

1、在WIN10/11下安装驱动程序&#xff1a;Quectel_Windows_USB_DriverA_Customer_V1.1.13.zip 2、使用移远的专用串口工具&#xff1a;QCOM_V1.8.2.7z QCOM_V1.8.2_win64.exe 3、配置串口UART42/COM42【移远会自动生成连续三个串口&#xff0c;最小的那一个】 AT命令&#xf…

C++(6):逻辑运算符

目录 1. 代码示例 示例 1&#xff1a;基础用法 示例 2&#xff1a;条件判断 2. 短路求值&#xff08;Short-Circuit Evaluation&#xff09; 代码示例 3. 实际应用场景 场景 1&#xff1a;输入合法性验证 场景 2&#xff1a;游戏状态判断 4. 注意事项 逻辑运算符用于组…

NXP iMX8MP ARM 平台多屏幕克隆显示测试

By Toradex秦海 1). 简介 NXP i.MX8MP ARM SoC 支持 3 路 Display Controller 分别提供 DSI/HDMI/LVDS 显示输出&#xff0c;在 Yocto Linux BSP 下采用 Wayland Backend 基于 DRM subsystem 显示驱动&#xff0c;前端默认基于 Weston Compositor。因此在默认情况下连接多个屏…

【数据结构】——栈

一、栈的概念和结构 栈其实就是一种特殊的顺序表&#xff0c;其只允许在一端进出&#xff0c;就是栈的数据的插入和删除只能在一端进行&#xff0c;进行数据的插入和删除操作的一端称为栈顶&#xff0c;另一端称为栈底。栈中的元素遵循先进后出LIFO&#xff08;Last InFirst O…

Navicat中保存的数据库密码找回 Java 8

导出数据库连接打开导出的connections.ncx文件找到加密的password放入java程序中解密即可 package com.asia.card.cloud.enterprise.api;import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.nio.cha…

vs code管理员权限启动问题

vs code非管理员启动可以正常启动用管理员启动vs code&#xff0c;会提示 解决办法 找到argv.json文件在argv.json文件中添加 "disable-chromium-sandbox": true重启vs code即可