I’m adding a disk to an ubuntu machine and creating a new partition which uses the whole disk.
GNU Parted 2.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/sdb: unrecognised disk label
So I make a new dos partition
(parted) mklabel
New disk label type? msdos
(parted) print
Model: - (scsi)
Disk /dev/sdb: 53.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
(parted) mkpart primary ext4 0 -1
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?
You should align the first partition at block 64
(parted) mkpart primary ext4 64 -1
mkpart syntax is: mkpartfs part-type fs-type start-mb end-mb
so this just wastes the first 64 MB of space on the disk. Setting the start at 1 avoids the error message as well.
mkpart primary ext4 1 -1
(parted)
And your error free. Go forth and partition.
Thanks to Stefan.
This is why I put stuff on the internet.
14 responses to “Warning: The resulting partition is not properly aligned for best performance.”
Hm, that just wastes the first 64MB of your device. Though not optimal either, a
(parted) mkpart primary ext4 1 -1
at least only wastes 1MB.
I see what you mean.
Thanks for the feedback.
Just a post to say thanks cause this post got me out of serious chronic headaches :)
Thanks for the info on how you guys used Parted. There is lacking documentation on how to properly format these Advance Format drives that lie to the OS.
parted -a optimal /dev/sdb
(parted) u s
(parted) mkpart primary linux-swap 1 1G
(parted) mkpart primart ext4 1953792s -1
(parted) p
Model: ATA WDC WD10EARS-00Y (scsi)
Disk /dev/sdb: 1953525168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 2048s 1953791s 1951744s primary linux-swap(v1)
2 1953792s 1953525167s 1951571376s primary ext4
This seemed to solve all of my performance problems.
[…] this excellent post on how to format a drive larger than 2TB. Supporting information was taken from this blog post with regard to how the drive alignment works. Finally this article from IBM was a good read on […]
thanks that helped me partition my 2TB hard drive.
for some reason the debian squeeze’s fdisk does support GPT partitions but after creation i didnt see it in /dev/sdb1. only saw /dev/sdb
after using parted the problem solved.
thanks!
You can change the units to sectors by typing “unit s” while in parted.
Thanks for the tip.
Thanks, man. I hate when I´m confronted with warnings, and your tip helped me solve it with no problems.
Percents work as well and get auto aligned.
(parted) mkpart
Partition name? []? data
File system type? [ext2]? ext4
Start? 0%
End? 100%
Thanks for the tip Sam. Didn’t know it would accept percents.
Awsome tip. Easiest way to partition a 2TB+ drive; sure wish the help would mention this.
Holy Todeol, so glad I clicked on this site first!
Thanks guys, the percents tip is the one that fixed it for me. Was trying to create a partition to fill a disk on a VM and no combination of sectors seemed to be working, and even defining a "correct" start of a divisible by 8 sector and 100% was failing.