Thursday, February 22, 2024
rated 0 times [  6] [ 0]  / answers: 1 / hits: 3068  / 3 Years ago, sat, july 24, 2021, 6:29:55

I've just installed ubuntu 12.04. I didn't put my data yet, I want before to make sure that the installation is fine. And I get Disk Utility warning about misaligned partition.

I have / on sda1 and sda2 is extended partition with sda5 for swap and sda6 for /home. There is no other partition on the disc. From other questions about the same problem I've understood that I should boot my computer from live USB and fix the problem with gParted. The problem is that when I boot my computer from live USB stick and enter try mode, both primary partitions are mounted, so I can't do any operation on it.

Since I don't have any data yet, I can even re-install the system, but I should know how do set the installer to align the partitions in right way. I've chosen not to use the install option without partitioning, since I'd like to have /home on separate partition. I could also try to fix it with the present installation, but I don't know how to unmount swap partition (and I'm not sure if it's reasonable).

Here is the output of fdisk -lu:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00027dec

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 29999103 14998528 83 Linux
/dev/sda2 30001150 625141759 297570305 5 Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5 30001152 33998847 1998848 82 Linux swap / Solaris
/dev/sda6 34000896 625141759 295570432 83 Linux

Disk is ATA ST320LT007-9ZV142


More From » installation


Actually, Frank is only partially correct. The problem is not that MiB alignment was chosen; that's actually the correct alignment. (Selecting cylinder alignment would definitely be wrong.) When using MiB alignment, partitions are aligned to 1MiB boundaries -- that is, they start on sectors whose numbers are multiples of 2048. Since 2048 is a multiple of 8, this means that all partitions begin on multiples of 8, which is required for optimum performance on Advanced Format disks. Most modern hard disks are Advanced Format models, so as a general rule you should use 1MiB (or at least 8-sector) alignment on modern disks. For further information on this, see this article I wrote on the subject for IBM developerWorks.

If you check the start sector numbers, you'll see that they all align on 2048-sector boundaries, except for one: /dev/sda2. It seems that fdisk is now providing a warning about this, with its Partition 2 does not start on physical sector boundary message. This message is a false alarm. Yes, it's true that it doesn't fit on an 8-sector boundary (30001150 / 8 = 3750143.75); but /dev/sda2 is also an exception to the rule I've just laid out. It's an extended partition, which means that it's a placeholder for logical partitions. The speed problems associated with misaligned partitions occur because filesystem data structures are read and written in 4KiB (8-sector) chunks; but the only data accessed directly through /dev/sda2 is the pointer to the first partition it contains, and that's a 512-byte data structure, so it occupies only part of a physical sector no matter what the extended partition's start point is. What's more, this data structure is read once when the computer boots and is rarely written. Thus, it doesn't matter what the alignment is on extended partitions, and any tool that complains about their misalignment is causing concern without reason.

[#31304] Sunday, July 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 461
Total Questions: 126
Total Answers: 117

Location: Saudi Arabia
Member since Fri, Jul 1, 2022
2 Years ago
rtbrbab questions
Fri, May 5, 23, 14:22, 10 Months ago
Tue, Nov 16, 21, 14:41, 2 Years ago
Thu, Mar 23, 23, 20:47, 12 Months ago
Sat, Jun 18, 22, 21:36, 2 Years ago