已整理-parted分区命令工具使用

 

parted 分区工具,适用于gpt分区模式

GPT分区模式:最多可以划分128个主分区,最大支持18EB

复制代码
# parted
(parted) select /dev/sdb             #选择sdb这块磁盘
(parted) mktable gpt               #如果是MBR,就选:msdos
(parted) print                   #打印磁盘信息
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags

(parted) mkpart                   #创建一个分区
Partition name? []? data              #分区名字
File system type? [ext2]? xfs           #分区格式
Start? 10MB                      #开始位置,从磁盘的第10MB开始创建分区
End? 2G                        #到2G的位置,分区大小等2038MB
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore               #忽略
(parted) print                   #打印当前分区信息
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start   End      Size   File system   Name     Flags
1    10.5MB   2000MB     1989MB           data

 

(parted) mkpart                 #再次创建1个分区
Partition name? []? Misic
File system type? [ext2]? xfs
Start? 2G                     #从2G位置开始
End? 5G                      #到5G这个位置结束
(parted) print                  #打印
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number     Start     End       Size       File system     Name     Flags
1        10.5MB    2000MB      1989MB                 data
2        2000MB    5000MB      3000MB                 Misic
复制代码

常用操作:

help disk_set         #查看disk_set的帮助
rm 2               #删除第2个分区
disk_set 2 lvm         #设置第2个分区为lvm卷,这个只是一个标识而已

 

posted on   tengq  阅读(507)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示