0

I am a bit new to creating partitions on the terminal and i would like to learn, so basically i was creating a partition using the parted command and i used the mkpart option to create a new primary partition. But i got an unusual error message while doing this. This is my output:

(parted) print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 729GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number  Start   End     Size    Type      File system  Flags
 1      1049kB  300GB   300GB   primary   ext4         boot

(parted) mkpart
Partition type? primary/extended? primary
File system type? ext4
Start? 1050
End? 30000
Warning: You requested a partition from 1050MB to 30.0GB (sector 2050781..58593750). The closest location we can manage is 300GB to 300GB (sector 585936896..585936896).
Is this still acceptable to you?
Yes/No?
  • I did the start at 1050 (because the previous partition starts at 1049) and i did the end at 30GB as i wanted it (30000MB)

  • I have been told that i have to do the Start value as one more than the previous partition's start value and i should do the end value at the size i want in MB as parted uses MB by default.

Any help will be greatly appreciated :)

programmer
  • 130
  • 1
  • 9

2 Answers2

1

I can clearly see that there is already a partition from 1049kB to 300GB from your print command. So you cannot make a partition there unless you delete that partition. You can use the start value for new partition as one more than the previous partition's end value and not the start value.

SR810
  • 136
0

Perhaps an example will help you:

Here's what oldfred was trying to convey with this comment.

sudo parted /dev/nvme1n1 unit s print
Model: Force MP300 (nvme)
Disk /dev/nvme1n1: 234441648s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start      End         Size        File system  Name     Flags
 1      2048s      66684927s   66682880s   ext4
 2      66684928s  234440703s  167755776s  ext4         Scratch

The unit s part of the command indicates that you want to see sectors rather than "human readable" output. Note that partition 2 starts at (partition 1 end sector+1) p1 ends at 66684927 and p2 starts at 66684927+1 or 66684928

There's a good answer on alignment here,which oldfred also alluded to in his comment.

If anything in this answer is unclear to you please drop a comment and I'll do my best to clarify.

Elder Geek
  • 36,752