首页 > 代码库 > 分区命令parted
分区命令parted
[root@localhost ~]# man parted
parted is a disk partitioning and partition resizing program. It allows you to create, destroy, resize, move and copy ext2, linux-swap, FAT, FAT32, and reiserfs parti-
tions. It can create, resize, and move Macintosh HFS partitions, as well as detect jfs, ntfs, ufs, and xfs partitions. It is useful for creating space for new operating
systems, reorganising disk usage, and copying data to new hard disks.
This manual page documents parted briefly. Complete documentation is distributed with the package in GNU Info format; see near the bottom.
用法:
parted [options] [device [command [options...]...]]
-h, --help 显示此求助信息
-l, --list 列出所有设别的分区信息
-i, --interactive 在必要时,提示用户
-s, --script 从不提示用户
-v, --version 显示版本
[root@localhost ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help‘ to view a list of commands.
(parted) ?
align-check TYPE N check partition N for TYPE(min|opt) alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition
quit exit program
rescue START END rescue a lost partition near START and END
resize NUMBER START END resize partition NUMBER and its file system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
unit UNIT set the default unit to UNIT
version display the version number and copyright information of GNU Parted
align-check TYPE N 对其检查
check NUMBER 检查分区
cp [FROM-DEVICE] FROM-MINOR TO-MINOR #将文件系统复制到另一个分区
help [COMMAND] #打印通用求助信息,或关于 COMMAND 的信息
mklabel 标签类型 #创建新的磁盘标签 (分区表)
mkfs MINOR 文件系统类型 #在 MINOR 创建类型为“文件系统类型”的文件系统
mkpart 分区类型 [文件系统类型] 起点和终止点 #创建一个分区
mkpartfs 分区类型 文件系统类型 起始点 终止点 #创建一个带有文件系统的分区
move MINOR 起始点 终止点 #移动编号为 MINOR 的分区
name MINOR 名称 #将编号为 MINOR 的分区命名为“名称”
print [MINOR] #打印分区表,或者分区
quit #退出程序
rescue 起始点 终止点 #挽救临近“起始点”、“终止点”的遗失的分区
resize MINOR 起始点 终止点 #改变位于编号为 MINOR 的分区中文件系统的大小
rm MINOR #删除编号为 MINOR 的分区
select 设备 #选择要编辑的设备
set MINOR 标志 状态 #改变编号为 MINOR 的分区的标志
举例:
将磁盘/dev/sdb划分出一个3T的GPT分区:
查看是否分区成功:
格式化分区:
挂载分区并查看分区大小:
本文出自 “Linux” 博客,请务必保留此出处http://zhangshijie.blog.51cto.com/806066/1574450
分区命令parted