0

I'm trying to partition my hard disk to make it usable. I'm following the steps given in this link to partition my hard disk. I'm doing this by providing the number of partitions as 1 and choosing the default options for next two prompts when it asks me to enter the beginning and ending sector number. Now this makes the hard disk usable but the hard disk speed is terribly slow. I could see the significant difference in I/O time taken between my primary (which has five partitions in it as sda1, sda2... sda5) and secondary partition (which has only one partition sdb1) in it.

  1. Why do we need to partition the hard disk before using it? Why do we really do it?
  2. Will the number of partitions impact the I/O speed? From my understanding, the number of partitions is to having different disks in Windows like C:, D:, E: which helps the user to organize the content well. Please correct me if I'm wrong.
  3. Last but not the least, how to improve the I/O speed with secondary partition? And what value should we input in the place of beginning and ending partition number?
2
  • 1
    What exactly are your "primary (which has five partitions in it as sda1, sda2 .. sda5) and secondary partition (which has only one partition sdb1)"? It sounds & looks like they're different physical drives, I'm not at all surprised they would have different speeds.
    – Xen2050
    Mar 2, 2019 at 12:32
  • Yes they are different physical drives. One comes along with the machine by default. Another one is added my me which I meant as secondary hard disk.
    – Tom Taylor
    Mar 2, 2019 at 12:36

2 Answers 2

4

You don't provide a number of partitions when partitioning a hard disk. Some specific partitioning tool might ask that for their own purpose, but most don't and I don't know any one that does. In the link there's also absolutely no mention of the number of partitions, only the partition number which is... just the numbering for the partition you want to work with. There are 4 entries for the partitions in the MBR, that's the reason for the number 1-4 in the line Partition number (1-4):.

Why do we need to partition the hard disk before using it? Why do we really do it?

Because a disk is just a surface with random magnetized data. HDD manufacturers do a low-level formatting first to divide that surface to fixed areas containing data blocks. When you buy the HDD home you'll have access to those blocks, which is basically like pages in a notebook. Now to write data you need a defined structure to store what you've written, otherwise you don't know which pages you wrote the physics lessons, or data sheet for this month...

So the partitions is like sections in the notebook, and each partition has its own metadata to record whether a specific block is blank or used for what data

Will the number of partitions impact the I/O speed?

No. Probably yes in the ancient times when you didn't have enough memory to store information about partitions in RAM, but that's pretty much nonsense nowadays. The position of a partition will, however. But only on rotational disks, not on solid storage devices (flash memory)

how to improve the I/O speed with secondary partition? And what value should we input in the place of beginning and ending partition number?

You generally can't do anything. If it's much slower, there was probably some issues with your partitioning process, like misalignment. Older partitioning software uses the CHS system (cluster - head - sector), so they align partitions to the begin of each track or head. Modern drives use LBA which result in a different alignment. Calculated the sector number manually might also result in a misalignment if you don't know the correct way to do that

So what you need to do is use a GUI tool instead of command line like that. Partitioning is a risky process if you don't know what to do. Even when I'm well-versed in CLI, I always use a GUI partitioner for a better visualized view while partitioning. You might want to do that if you need to do a mass automatic partitioning on multiple machines, which is not your case

Just open a 3rd party disk partitioning software like Gparted, MiniTool® Partition Wizard Home Edition or EaseUS® Partition Master, select resize partition and they'll automatically align it correctly

That link from 2006 is also very old and outdated, use a newer one. But you also shouldn't even need to partition before installing like that, unless you want to repartition the disk. For any OSes in the last decades you already have the option to partition the disk during installation. They can create the necessary partitions, align them properly and add more partitions if you want

Edit:

sda and sdb are different drives, thus obviously there might big differences between them due to the properties in interface, cache, disk type... For example if the first drive is an SSD and the second one is HDD then there would be a huge difference in speed (400-4000 MB/s vs 100-200 MB/s), IOPS (~100000 IOPS vs 50-100 IOPS) and latency (10-100 μs vs 10-15 ms)

Besides, secondary partition (which has only one partition sdb1) in it doesn't make sense, because a partition can't contain another partition (except extended partition which is a container for logical partitions)

3

1) Why do we need to partition the hard disk before using it? Why do we really do it?

Multiple partitions are used for various reasons:

  • Disk space reservation: partitions are fixed-size; if you accidentally fill up /home to the brim and it's a separate partition, it will not affect the '/' partition and the OS will still have space for itself.

  • Ability to use different filesystems: e.g. you can use traditional ext4 for '/' but something fancy for '/var' or '/home'.

    Usually the firmware and/or the bootloader only understand a very limited set of filesystems – e.g. UEFI machines only understand FAT32, but you certainly don't want to make the entire disk FAT32, so you have a small FAT32 partition with just the EFI-related files in it. Same goes for BIOS systems; many bootloaders only understand simple things like ext2 and wouldn't be able to load the kernel from zfs or btrfs.

  • Ability to have multiple operating systems on a single disk.

  • Taking advantage of the disk's physical properties, as described in more detail later.

Why partition a disk when you only want to have one partition? Well, that's not technically required for the disk to work, but it's usually done for consistency. When you already have a partition table and everything, going from 1 partition to multiple (or back) is easy. But if the entire disk is unpartitioned and simply mkfs'd, trying to partition it later can be very troublesome.

On BIOS/MBR systems, having a partition table also generally has the side effect that there's some unused space between the table and the 1st partition. Historically, the GRUB bootloader installed itself into that space. It's not really neat, but... that's what GRUB expects to be able to do on MBR disks. (Fortunately it no longer does the same on GPT disks, taking a regular partition instead.)

I'm doing this by providing the number of partitions as 1

That's not the total partition count; that's the ordinal number of the partition you're creating. The total doesn't need to be specified upfront.

I could see the significant difference in I/O time taken between my primary (which has five partitions in it as sda1, sda2 .. sda5) and secondary partition (which has only one partition sdb1) in it.

Do you mean primary and secondary disks? sda and sdb represent disks, not partitions. (And partitions having their own partitions won't make much sense.)

Most of it is likely caused by the disks themselves being physically different. Check what models they are, etc.. For example, a 7200rpm disk will be faster than a 5400rpm disk of the same age, and a modern 5400rpm disk will still be faster than a 15-year-old 5400rpm disk due to increased data density, and a "healthy" disk will be faster than a disk with many reallocated bad sectors due to the latter needing to make many detours when reading data. I'd expect a SATA/AHCI-connected disk to work faster than an IDE-connected disk as well.

But...

2) Will the number of partitions impact the I/O speed?

The number of partitions, by itself, will not. Neither will the partition type ("primary" vs "secondary" is just a hack to get around limitations in the old MBR partitioning format, it doesn't affect the working of a partition itself).

But as you've noticed, areas closer to the "beginning" of the disk work faster than areas near the "end" of the disk, because they tend to physically correspond to the outer and inner areas of the actual spinning disk.

So when you have one large partition across the entire disk, the OS will distribute files more or less evenly throughout the physical disk area; some of them will be in the 'fast' end, some in the 'slow' end. But when you have several small partitions, the 1st partition (first by starting sector, not by list position) will get all the benefits.

(disclaimer: this is probably total nonsense)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .