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?

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
| improve this answer | |

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
| improve this answer | |
  • How can it make sense to specify 0% and 100%? – G-Man Says 'Reinstate Monica' Dec 14 '18 at 17:40
  • 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 – Michail Alexakis Dec 14 '18 at 17:58
  • 1
    You mean, create one partition that spans the entire physical disk?  (Destroying the six other partitions that already exist?) – G-Man Says 'Reinstate Monica' Dec 14 '18 at 18:00
  • 1
    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. – G-Man Says 'Reinstate Monica' Dec 14 '18 at 18:22
  • 3
    Downvoted because this a dangerous command that destroys existing partitions. – Niklas Holm Feb 20 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.