Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
parted DEVICE opens a prompt; parted DEVICE COMMAND runs one command. Unlike fdisk, parted writes every change at once. Positions are start and end (like 1MiB 1GiB); use MiB/GiB for exact powers of 1024 and good alignment.
-s (script mode) never asks questions — so be careful.
Zo schrijf je het
parted [OPTION]... [DEVICE [COMMAND [ARGUMENT]...]...]Belangrijkste delen
print[free|all]- Show the table (and free space or all devices).
mklabelgpt|msdos- New empty partition table (deletes all partitions).
mkpart[NAME|TYPE] [FSTYPE]STARTEND- New partition (GPT: a name; MBR: primary/extended/logical).
rmN- Remove partition N.
resizepartNEND- Change the end of a partition.
nameNNAME- Name a GPT partition.
setNFLAGon|off- Set a flag: boot, esp, lvm, raid, swap, bios_grub, msftdata …
toggleNFLAG- Toggle a flag.
typeNTYPE-UUID- Set the GPT type UUID (newer parted).
unitUNIT- Units: s, B, KiB, MiB, GiB, %, compact …
align-checkminimal|optimalN- Check alignment.
rescueSTARTEND- Find a lost partition.
disk_set/disk_toggleFLAG- Flags of the whole disk.
selectDEVICE- Choose another disk.
quit- Leave.
Opties 8
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Show a disk
parted /dev/vdb printTable type, partitions, sizes and flags.
2New GPT table
parted -s /dev/vdb mklabel gptDeletes all partitions on the disk at once.
3Create partitions in one go
parted -s /dev/vdb mkpart data xfs 1MiB 2GiB parted -s /dev/vdb mkpart swap linux-swap 2GiB 3GiBGPT: the first word is the partition name.
4A partition for LVM
parted -s /dev/vdb mkpart pv1 3GiB 100% parted -s /dev/vdb set 3 lvm on100% = to the end of the disk.
5Show free space in MiB
parted /dev/vdb unit MiB print freeWhere can a new partition go?
6MBR with logical partitions
parted -s /dev/vdc mklabel msdos mkpart primary 1MiB 1GiB mkpart extended 1GiB 100% mkpart logical 1GiB 2GiBMore commands in one line.
7Grow a partition to the end of the disk
parted /dev/vdb resizepart 3 100%After a VM disk was made bigger; then grow the PV or file system.
8EFI system partition
parted -s /dev/vdd mkpart ESP fat32 1MiB 601MiB set 1 esp onFor a UEFI boot disk.
9List all disks
parted -lEvery disk with its table.
10JSON for automation
parted -j /dev/vdb print | jq '.disk.partitions[].size'Newer parted versions.
Niets past bij dit filter.
Let op
- parted writes at once: there is no "quit without saving".
mkpartdoes not create a file system; use mkfs afterwards (the FSTYPE word only sets the type).
Exitcodes
0 :: Done. 1 :: Error.