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
  • 9
  • Welcome to AskUbuntu! Based on your question and comments below it appears that you are operating under a misconception. Either you were misinformed or misunderstood. The idea is to make the start of the second partition 1 sector (allocation unit) beyond the **end** of the previous partition. If you want a quality answer you should respond to requests for further information like [this one](https://askubuntu.com/questions/1141285/error-while-creating-partition-parted-fdisk#comment1892294_1141287) by [edit]ing that info into your question. Thank you for helping us help you! – Elder Geek May 08 '19 at 00:53
  • At the risk of repeating my self, no, beyond the **end** of the previous partition nowhere near the start. Please read and comprehend [this comment.](https://askubuntu.com/questions/1141285/error-while-creating-partition-parted-fdisk?noredirect=1#comment1892420_1141285) Best of luck to you! – Elder Geek May 09 '19 at 19:10

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
  • 1
  • 1
    It does not automatically move an existing partition, and you cannot have overlapping partitions. If you want a new partition at beginning of drive it should start at sector 2048 for alignment. Since an older drive alignment not critical, but will save warning messages all the time about alignment. better to see details by sector `sudo parted /dev/sda unit s print` – oldfred May 07 '19 at 17:58
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
  • 35,476
  • 25
  • 95
  • 181
  • @Qasim Pay close attention to the command and output in the code block above and the explanation that follows. I think it should be clear that the size is **(end -start+1)xSectorSize** I hope that helps. – Elder Geek May 10 '19 at 14:28