tldr/pages/linux/parted.md

38 lines
946 B
Markdown
Raw Permalink Normal View History

2020-12-11 21:06:23 +00:00
# parted
> A partition manipulation program.
2021-06-24 21:35:40 +01:00
> See also: `partprobe`.
2020-12-11 21:06:23 +00:00
> More information: <https://www.gnu.org/software/parted/parted.html>.
- List partitions on all block devices:
`sudo parted --list`
2021-03-19 14:10:13 +00:00
- Start interactive mode with the specified disk selected:
2020-12-11 21:06:23 +00:00
`sudo parted {{/dev/sdX}}`
2021-03-19 14:10:13 +00:00
- Create a new partition table of the specified label-type:
2020-12-11 21:06:23 +00:00
2021-03-19 14:10:13 +00:00
`sudo parted --script {{/dev/sdX}} mklabel {{aix|amiga|bsd|dvh|gpt|loop|mac|msdos|pc98|sun}}`
2020-12-11 21:06:23 +00:00
2021-03-19 14:10:13 +00:00
- Show partition information in interactive mode:
2020-12-11 21:06:23 +00:00
`print`
- Select a disk in interactive mode:
`select {{/dev/sdX}}`
- Create a 16 GB partition with the specified filesystem in interactive mode:
2020-12-11 21:06:23 +00:00
2021-03-19 14:10:13 +00:00
`mkpart {{primary|logical|extended}} {{btrfs|ext2|ext3|ext4|fat16|fat32|hfs|hfs+|linux-swap|ntfs|reiserfs|udf|xfs}} {{0%}} {{16G}}`
2020-12-11 21:06:23 +00:00
2021-03-19 14:10:13 +00:00
- Resize a partition in interactive mode:
2020-12-11 21:06:23 +00:00
`resizepart {{/dev/sdXN}} {{end_position_of_partition}}`
2021-03-19 14:10:13 +00:00
- Remove a partition in interactive mode:
2020-12-11 21:06:23 +00:00
`rm {{/dev/sdXN}}`