Below is my hard disk shown in gnu parted:

(parted) print free                                                       
Model: ATA HGST HTS541075A9 (scsi)
Disk /dev/sda: 750GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system     Name                     
       17.4kB  1049kB  1031kB  Free Space
1      1049kB  538MB   537MB   fat32           EFI System Partition  boot
2      538MB   468GB   467GB   ext4
       468GB   520GB   52.4GB  Free Space
6      520GB   527GB   6353MB  linux-swap(v1)
4      527GB   527GB   524MB   ext4
5      527GB   744GB   217GB                                         lvm
3      744GB   750GB   6352MB
    750GB   750GB   892kB   Free Space


You can see I have 52.4GB space (fourth entry). I want to create a partition in this. I know mkpart is the command for it.

Its syntax is


But my problem is I don't know what value is should give for START and END. What value should I use?

  • This is not a direct answer, but cfdisk allows to do that extremely easy: you just press on the Free space, and it asks you about the needed partition size (100% by default, so you don't have to calculate anything). Apr 27, 2023 at 9:31

2 Answers 2

Number  Start   End     Size    File system
        468GB   520GB   52.4GB  Free Space

Well, as you can see Start is 468GB and End is 520GB. Now, parted defaults to MB so you'll have to specify the unit:

unit GB mkpart primary ntfs 468 520

or append unit suffix to the start/end numbers:

mkpart primary ext2 468GB 520GB

Alternatively, you can list the values in MB with

unit MB print free

and then use the start/end values without any unit/suffix e.g.

mkpart primary ext2 468012 520008
  • I wish I could upvote this five times. Clean, simple, useful. Thanks.
    – jorfus
    Dec 11, 2023 at 20:04

Another solution would be to use percentage unit (%) to specify sizes:

 sudo parted -s /dev/sdX mkpart primary 0% 100%

If a label is not present in the disk device, you will need to create it first. For example:

 sudo parted -s /dev/sdX mklabel msdos

Caution! 0% and 100% points correspondingly to the start and to the end of entire physical disk, and not just free space. So if you run sudo parted -s /dev/sdX mkpart primary 0% 100%, this will destroy all existing partitions.

  • 1
    well, it is a simple (but quite common) use case where you want to span over all available space (from 0% to 100%) to create a partition Dec 14, 2018 at 17:58
  • 1
    You mean, create one partition that spans the entire physical disk?  (Destroying the six other partitions that already exist?) Dec 14, 2018 at 18:00
  • 4
    No, the question title asks ''how to create a partition in free space'' (emphasis added).  If your command destroys existing partitions, then it's not using just the disk's free space. Dec 14, 2018 at 18:22
  • 10
    Downvoted because this a dangerous command that destroys existing partitions. Feb 20, 2020 at 14:45
  • 1
    Also downvoted for it's dangerous and comes with no warning or proper explanation. The use of percentage is a nice advice but the offered command -- to this question -- should be preceded by proper text/warning.
    – Brandt
    Mar 24, 2021 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .