Linux command
parted 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo parted -l
Example
sudo parted /dev/sdX mklabel gpt
Example
sudo parted /dev/sdX -s mklabel gpt mkpart "boot" 0% 500MiB mkpart "system" 500MiB 100%
Example
sudo parted /dev/sdX set 1 boot on
Example
sudo parted /dev/sdX
Example
sudo parted /dev/sdX print
说明
parted is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS (MBR) and GPT. It can be used to create space for new operating systems, reorganize disk usage, and copy data to new hard disks.
参数
- -h, --help
- Display help message.
- -l, --list
- List partition layout on all block devices.
- -m, --machine
- Show machine-parseable output.
- -j, --json
- Show JSON output.
- -s, --script
- Never prompt for user intervention.
- -f, --fix
- Auto-answer "fix" to exceptions in script mode.
- -v, --version
- Display version information.
- -a, --align _TYPE_
- Set alignment for new partitions (none, cylinder, minimal, optimal).
FAQ
What is the parted command used for?
parted is a program to manipulate disk partitions. It supports multiple partition table formats, including MS-DOS (MBR) and GPT. It can be used to create space for new operating systems, reorganize disk usage, and copy data to new hard disks.
How do I run a basic parted example?
Run `sudo parted -l` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -h, --help do in parted?
Display help message.