tldr/pages/linux/parted.md

37 lines
920 B
Markdown
Raw Normal View History

2020-12-11 21:06:23 +00:00
# parted
> A partition manipulation program.
> 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}}`
2021-03-19 14:10:13 +00:00
- Create a 16GB 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}}`