Create one partition occupying all the space on the drive with gparted?

13,049

Solution 1

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%

Solution 2

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.

Share:
13,049

Related videos on Youtube

User
Author by

User

Updated on September 18, 2022

Comments

  • User
    User over 1 year

    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?

  • User
    User over 5 years
    What does p1 and 2048s stand for?
  • Soren A
    Soren A over 5 years
    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
    Soren A over 5 years
    If you are in doubt of what commands or parameters does, read the manual-page: man parted.
  • User
    User over 5 years
    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?
  • Soren A
    Soren A over 5 years
    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 ;-)