0

I just got a hard disk from my friend. Since it's only 160GB, I assume it's a pretty old one. Now I'm going to format it and make it a fresh hard disk through raspberry pi. But I notice the primary partition starts from 1049kB:

root@raspberrypi:/dev# parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: External USB 3.0 (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  160GB   160GB   primary

When I check the disk partition table (cfdisk /dev/sda), it only shows sda1 and doesn't show the free space.

How can I merge the primary with the free space? I tried deleting the partition and recreating a new one. But it failed and remained unchanged.

And just curious... why does the free space start at 32.3kB? I've seen this number in many hard disks but just couldn't find an answer yet.

0

This is done due to ‘partition alignment’ which tries to align a page with a block. This tends to improve performance, as requests for data tend to not cross page boundaries. If you start a partition at 0, it can result in multiple requests to the storage system to get a block of data.

If you really need your extra MB of data, your easiest way if you don’t care about the data is to delete the partition and run fdisk with parameters which ignore the alignment of new partitions. Those parameters vary based on your version.

If fdisk is doing this for you, just let it- it’s there to improve performance.

As for the why 32.3kb start for the free space, this is based on the post-MBR gap (after the 512 byte MBR region and before the start of your first partition) on the drive to align the first partition correctly and DOS compatibility cylinder alignment issues are satisfied in the partition table. The post-MBR gap of about 1 to 2 MiB is recommended to provide sufficient room for embedding GRUB’s core.img. Most partitioning tools these days support 1MB partition alignment to obtain this space as well as to satisfy other non-512 byte sector issues (which are unrelated to embedding of core.img).

Hence 32.3kb to allow post-MBR gap and DOS compatibility, free space to allow room for your boot loader and DOS compatibility, and 1MB start for partition alignment which improves performance by reducing the number of requests for a block of data.

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.