

Then, to grow the (ext2/3/4) filesystem on the partition (if size is not specified, it will default to the size of the partition): Where number is the number of the partition you are growing, and end is the new end of the partition (which needs to be larger than the old end).

To grow a partition (in parted interactive mode): If you are growing a partition, you have to first resize the partition and then resize the filesystem on it, while for shrinking the filesystem must be resized before the partition to avoid data loss. These instructions apply to partitions that have ext2, ext3, ext4, or btrfs filesystems.As of parted v4.2 resizepart may need the use of #Interactive mode.You can only move the end of the partition with parted.(parted) mkpart primary linux-swap 20GiB 24GiB (parted) mkpart primary ext3 100MiB 20GiB In the final example below, separate /boot (100 MiB), / (20 GiB), swap (4 GiB), and /home (all remaining space) partitions will be created: In the following instance, a 20 GiB / partition will be created, followed by a /home partition using all the remaining space:

(parted) mkpart "home partition" ext4 24.5GiB 100%įor a minimum single primary partition using all available disk space, the following command would be used: (parted) mkpart "swap partition" linux-swap 20.5GiB 24.5GiB (parted) mkpart "home partition" ext4 20.5GiB 100%Īnd for separate / (20 GiB), swap (4 GiB), and /home (all remaining space) partitions: (parted) mkpart "root partition" ext4 301MiB 20.5GiB (parted) mkpart " my partition label" ext4 301MiB 100%įor separate / (20 GiB) and /home (all remaining space) partitions: For one other partition using 100% of remaining space: The remaining partition scheme is entirely up to you. (parted) mkpart "EFI system partition" fat32 1MiB 301MiB If creating a new EFI system partition, use the following commands (the recommended size is at least 300 MiB): In every instance, a special bootable EFI system partition is required. (Discuss in Talk:Parted) UEFI/GPT examples Reason: Explain the boot, legacy_boot and esp flags and their different usage on MBR and GPT. To create a new Master Boot Record/MS-DOS partition table instead, use: To then create a new GUID Partition Table, use the following command: Open each device whose partition table must be (re)created with: Recreating the partition table of a device is also useful when the partition scheme needs to be restructured from scratch. You need to (re)create the partition table of a device when it has never been partitioned before, or when you want to change the type of its partition table. Thus, when creating a partition, you should prefer to specify units of bytes (“B”), sectors (“s”), or IEC binary units like “MiB”, but not “MB”, “GB”, etc. Contrast that with a partition start request of “4GB”, which may actually resolve to some sector up to 500MB before or after that point. If you know exactly what you want, or to see exactly what Parted is doing, it helps to specify partition endpoints in sectors (with the "s" suffix) and give the "unit s" command so that the partition endpoints are displayed in sectors.Īs of parted-2.4, when you specify start and/or end values using IEC binary units like “MiB”, “GiB”, “TiB”, etc., parted treats those values as exact, and equivalent to the same number specified in bytes (i.e., with the “B” suffix), in that it provides no “helpful” range of sloppiness. (For example, create a partition starting at 10.352Mb, not 10.4Mb) If the calculated values differ too much, Parted will ask you for confirmation. Since many partitioning systems have complicated constraints, Parted will usually do something slightly different to what you asked. If you do not give a parameter to a command, Parted will prompt you for it. When finished, or if wishing to implement a partition table or scheme for another device, exit from parted with:Īfter exiting, the command-line prompt will change back to #. To see a list of the available commands, enter: You will notice that the command-line prompt changes from a hash ( #) to (parted): this also means that the new prompt is not a command to be manually entered when running the commands in the examples. In order to start operating on a device, execute: Interactive mode simplifies the partitioning process and reduces unnecessary repetition by automatically applying all partitioning commands to the specified device. Note: Options (like -help) can only be specified on the command line.
