使用fdisk 、gdisk管理分區

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.pswp.cn/web/79270.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/79270.shtml
英文地址,請注明出處:http://en.pswp.cn/web/79270.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【Linux基礎】程序和軟件安裝管理命令

目錄 install命令 which命令 install命令 作用:它是用于安裝或復制文件到指定位置,并且可以同時設置文件的權限、所有者和所屬組等屬性。它通常用于腳本中,用于自動化安裝程序或配置文件的部署。 基本用法: install [選項] 源…

C++模板梳理

目錄 函數模板 類模板 變量模板 模板全特化 模板偏特化 模板顯式實例化解決文件分離問題 折疊表達式 模板的二階段編譯 待決名(dependent name) SFINAE 概念與約束 函數模板 函數模板不是函數,只有實例化的函數模板,編譯器才能生成實際的函數…

數據鏈共享:從印巴空戰到工業控制的跨越性應用

摘要 本文通過對印巴空戰中數據鏈共享發揮關鍵作用的分析,引出數據鏈共享在工業控制領域同樣具有重大價值的觀點。深入闡述 DIOS 工業控制操作系統作為工業數據鏈共享基礎技術的特點、架構及應用優勢,對比空戰場景與工業控制場景下數據鏈共享的相…

巡檢機器人數據處理技術的創新與實踐

摘要 隨著科技的飛速發展,巡檢機器人在各行業中逐漸取代人工巡檢,展現出高效、精準、安全等顯著優勢。當前,巡檢機器人已從單純的數據采集階段邁向對采集數據進行深度分析的新階段。本文探討了巡檢機器人替代人工巡檢的現狀及優勢&#xff0c…

在 Flink + Kafka 實時數倉中,如何確保端到端的 Exactly-Once

在 Flink Kafka 構建實時數倉時,確保端到端的 Exactly-Once(精確一次) 需要從 數據消費(Source)、處理(Processing)、寫入(Sink) 三個階段協同設計,結合 Fli…

當可視化遇上 CesiumJS:突破傳統,打造前沿生產配套方案

CesiumJS 技術基礎介紹 CesiumJS 是一款基于 JavaScript 的開源庫,專門用于創建動態、交互式的地理空間可視化。它利用 WebGL 技術,能夠在網頁瀏覽器中流暢地渲染高分辨率的三維地球和地圖場景。CesiumJS 支持多種地理空間數據格式,包括但不…

RabbitMQ深入學習

繼續上一節的學習,上一節學習了RabbitMQ的基本內容,本節學習RabbitMQ的高級特性。 RocketMQ的高級特性學習見這篇博客 目錄 1.消息可靠性1.1生產者消息確認1.2消息持久化1.3消費者消息確認1.4消費失敗重試機制1.5消息可靠性保證總結 2.什么是死信交換機…

Linux系統:虛擬文件系統與文件緩沖區(語言級內核級)

本節重點 初步理解一切皆文件理解文件緩沖區的分類用戶級文件緩沖區與內核級文件緩沖區用戶級文件緩沖區的刷新機制兩級緩沖區的分層協作 一、虛擬文件系統 1.1 理解“一切皆文件” 我們都知道操作系統訪問不同的外部設備(顯示器、磁盤、鍵盤、鼠標、網卡&#…

在c++中老是碰到string,這是什么意思?

定義一個string類型變量的引用,相當于給現有變量起個別名,與指針還是不一樣的。比如string a;string& ba;這兩句,b與a實際上是一回事,表示的是同一塊內存。 std是系統的一個命名空間(有關命名空間可以參閱namespace_百度百科)…

Day21 奇異值分解(SVD)全面解析

一、奇異值分解概述 奇異值分解是線性代數中一個重要的矩陣分解方法,對于任何矩陣,無論是結構化數據轉化成的“樣本 * 特征”矩陣,還是天然以矩陣形式存在的圖像數據,都能進行等價的奇異值分解(SVD)。 二…

akshare爬蟲限制,pywencai頻繁升級個人做量化,穩定數據源和券商的選擇

做量化,數據和交易接口是策略和自動化交易的基石,而穩定的數據和快人一步的交易接口是個人做量化的催化劑。 之前寫過一篇文章:個人做量化常用的數據,多以爬蟲為主,最近akshare爬蟲限制,pywencai頻繁升級。…

數字簽名與證書

1. 數字簽名與證書 摘要算法用來實現完整性,能夠為數據生成獨一無二的“指紋”,常用的算法是 SHA-2;數字簽名是私鑰對摘要的加密,可以由公鑰解密后驗證,實現身份認證和不可否認;公鑰的分發需要使用數字證書…

Ubuntu22.04安裝顯卡驅動/卸載顯卡驅動

報錯 今日輸入nvidia-smi報錯,在安裝了535和550,包括560都沒辦法解決,但是又怕亂搞導致環境損壞,打算把顯卡卸載然后重新安裝系統默認推薦版本的顯卡驅動 qinqin:~$ nvidia-smi Failed to initialize NVML: Driver/library version mismatch NVML library version: 560.35卸載…

Web 架構之負載均衡全解析

文章目錄 一、引言二、思維導圖三、負載均衡的定義與作用定義作用1. 提高可用性2. 增強性能3. 實現擴展性 四、負載均衡類型硬件負載均衡代表設備優缺點 軟件負載均衡應用層負載均衡代表軟件優缺點 網絡層負載均衡代表軟件優缺點 五、負載均衡算法輪詢算法(Round Ro…

linux下的Redis的編譯安裝與配置

配合做開發經常會用到redis,整理下編譯安裝配置過程,僅供參考! --------------------------------------Redis的安裝與配置-------------------------------------- 下載 wget https://download.redis.io/releases/redis-6.2.6.tar.gz tar…

A2A大模型協議及Java示例

A2A大模型協議概述 1. 協議作用 A2A協議旨在解決以下問題: 數據交換:不同應用程序之間的數據格式可能不一致,A2A協議通過定義統一的接口和數據格式解決這一問題。模型調用:提供標準化的接口,使得外部應用可以輕松調…

關鍵點檢測--使用YOLOv8對Leeds Sports Pose(LSP)關鍵點檢測

目錄 1. Leeds Sports Pose數據集下載2. 數據集處理2.1 獲取標簽2.2 將圖像文件和標簽文件處理成YOLO能使用的格式 3. 用YOLOv8進行訓練3.1 訓練3.2 預測 1. Leeds Sports Pose數據集下載 從kaggle官網下載這個數據集,地址為link,下載好的數據集文件如下…

20250508在WIN10下使用移遠的4G模塊EC200A-CN直接上網

1、在WIN10/11下安裝驅動程序:Quectel_Windows_USB_DriverA_Customer_V1.1.13.zip 2、使用移遠的專用串口工具:QCOM_V1.8.2.7z QCOM_V1.8.2_win64.exe 3、配置串口UART42/COM42【移遠會自動生成連續三個串口,最小的那一個】 AT命令&#xf…

第J7周:ResNeXt解析

🍨 本文為🔗365天深度學習訓練營 中的學習記錄博客🍖 原作者:K同學啊 目標 具體實現 (一)環境 語言環境:Python 3.10 編 譯 器: PyCharm 框 架: Tensorflow (二)具體…

C++之類和對象:初始化列表,static成員,友元,const成員 ……

目錄 const成員函數: 前置和后置重載: 取地址及const取地址操作符重載: 初始化列表: explicit關鍵字: static成員: 友元: 友元函數: 友元類: 內部類&#xff1a…