I am following the instructions here: https://help.ubuntu.com/community/InstallingANewHardDrive

It says:

4) Create one partition occupying all the space on the drive:

(parted) mkpart primary 0 0

5) Check that the results are correct:

(parted) print

However when I do this I get:

$sudo parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) unit GB
(parted) mkpart primary 0 0
(parted) print
Model: ATA Some SSD (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      0.00GB  0.00GB  0.00GB               primary

The Start and End of 0GB and Size of 0GB is making me think this isn't correct. I would have thought the size should have been 240GB (or close to it). Are these instructions correct? If not, what is the correct way to make a single partition that covers the entire disk?


Your mkpart line is wrong. The parameters are: partition-name, start-position and size.

In parted, run

`rm primary` 
`mkpart primary 2048s 100%`

to remove the old, wrong, partition and recreate a new that spans the whole disk.

  • What does p1 and 2048s stand for? – User Sep 12 '18 at 8:06
  • p1 is the partition name, you can use any name, p1, primary or what you like. 2048s is the start sector for the partiton. This is needed for some disks / disk-arrays to get proper alignment of the partiton and optimal IO performance. This post explains how to calculate this value: rainbow.chard.org/2013/01/30/… – Soren A Sep 12 '18 at 8:13
  • If you are in doubt of what commands or parameters does, read the manual-page: man parted. – Soren A Sep 12 '18 at 8:14
  • The man page on Ubuntu says the first parameter of mkpart is part-type should be one of "primary", "logical", or "extended". Is using an arbitrary name correct? – User Sep 12 '18 at 8:29
  • 1
    Primary / logical extended is only for MSDOS / MBR partitioning. The line I initially wrote will work, but I have changed the answer so that it matches what the manual says ;-) – Soren A Sep 12 '18 at 8:36

Using 0% for the start causes parted to automatically align the sectors for best performance:

(parted) mkpart primary 0% 100%

Credits to comments in article at https://rainbow.chard.org/2013/01/30/how-to-align-partitions-for-best-performance-using-parted/

PS: u could also specify the filesystem type in same command, e.g for xfs:

(parted) mkpart primary xfs 0% 100%

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.