LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 12-05-2016, 09:02 PM   #1
bsmith52
LQ Newbie
 
Registered: Nov 2016
Posts: 26

Rep: Reputation: Disabled
Problem if LFS partition (MBR) not on physical sector boundary?


I have been trying to get LFS going, but encountering problems. This is the 3rd time that I have started the process. I don't want to make any incorrect assumptions.

Instead of using lsblk to find my logical partition to mount, I used fdisk -l. This is the output:

Code:
root@silver:/home/bill# fdisk -l

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0x1b27c934

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 372738047 372736000 177.8G 83 Linux
/dev/sda2       960210942 976771071  16560130   7.9G  5 Extended
/dev/sda3       372738048 942082047 569344000 271.5G 83 Linux
/dev/sda4       942082048 960208895  18126848   8.7G 82 Linux swap / Solaris
/dev/sda5       960210944 976771071  16560128   7.9G 82 Linux swap / Solaris

Partition 3 does not start on physical sector boundary.
sda3 was created by gPartd, and I aligned it with the Mib option.

I just wanted to confirm that there is no problem here - that is, I won't have problems further along the process with this condition.

BTW, I am using Debian 8.1, and it is loaded in sda1.

Thanks in advance.
 
Old 12-06-2016, 09:35 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by bsmith52 View Post
Code:
root@silver:/home/bill#Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0x1b27c934

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 372738047 372736000 177.8G 83 Linux
/dev/sda2       960210942 976771071  16560130   7.9G  5 Extended
/dev/sda3       372738048 942082047 569344000 271.5G 83 Linux
/dev/sda4       942082048 960208895  18126848   8.7G 82 Linux swap / Solaris
/dev/sda5       960210944 976771071  16560128   7.9G 82 Linux swap / Solaris

Partition 3 does not start on physical sector boundary.
That's totally bizarre, since it's partition 2, not 3, that is misaligned. That misalignment doesn't matter. The only thing misaligned is the 1-sector extended partition header. With the exception of use by partitioning tools, that gets read just once when the system boots and is never written.
 
Old 12-08-2016, 07:01 PM   #3
bsmith52
LQ Newbie
 
Registered: Nov 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Thanks for the feedback. I noticed the mis-alignment of the extended partition (sda2). But I know ZERO about how MBR extended partitions work. Could it be a bug in fdisk? MBR is not used so much now, so maybe a bug crept into the software undetected during testing.

In any case, I will proceed under the assumption that this will not cause me a problem during the build.s

Best regards and thanks.
 
Old 12-09-2016, 08:56 AM   #4
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
The warning tells you that a partition is not aligned on a physical sector boundary, i.e., a disk "hardware" sector. On a traditional harddisk, you would not run into this issue, since logical sectors are equal to physical sectors: both are 512 bytes.

Computer systems and operating systems generally assume hard-coded sector sizes of 512 bytes, and this assumption is so omnipresent that it is nearly impossible to change without hard work and global coordination.

Modern harddisks, however, use physical sectors of 2048 bytes (i.e., 8 logical sectors); you can see that in the fdisk output, on the "Sector size (logical/physical):" line. Physical disk I/O is, therefore, done in 2048-byte chunks (i.e., 8 logical sectors at a time). For optimal performance, it is generally assumed that disk partitions had better be aligned on physical sector boundaries, so that, when the start of the partition is to be read (or updated), the first eight logical sectors can be read (or written) in one operation.

The warning about the misalignment simply means that there is a partition that does not begin on a physical sector boundary (i.e., on a multiple of eight logical sectors). There's nothing really wrong with this, except that disk I/O performance may be adversely affected when misaligned data structures are to be accessed.

Due to these new developments, and to the expectations that future disks will likely use even larger physical sectors (e.g., perhaps 16, 32, 64 KiB, maybe even 1 MiB?), the generally recommended "best practice" nowadays is to align all partitions on 1-MiB boundaries (i.e, multiples of 2048 logical, 512-byte, sectors).

Last edited by luvr; 12-09-2016 at 01:16 PM.
 
Old 12-09-2016, 10:47 AM   #5
bsmith52
LQ Newbie
 
Registered: Nov 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Thanks for your insight and historical perspective. Thanks for confirming for me that the LFS build will not be adversely affected by this warning - only potential inefficiencies.

Will there be inefficiencies since the only partition not aligned on a 2048 byte boundary is the sda2 partition (which defines the start of the extended partition)? rknichols says no. This is still puzzling as fdisk points out the the sda3 partition is the one that is not aligned properly.

This LFS build has been great for keeping my "little gray cells" (Hercule Poirot) active (I'm 64, and wrote my first computer program in 1971). I'm on my 4th build, and have yet to get past the temporary system. Thanks for everyone's help!
 
Old 12-09-2016, 11:04 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by bsmith52 View Post
This is still puzzling as fdisk points out the the sda3 partition is the one that is not aligned properly.
That is a bug in fdisk. It is quite clear that sda3 is properly aligned (372738048 is an exact multiple of 8).
 
Old 12-09-2016, 01:36 PM   #7
luvr
Member
 
Registered: May 2005
Location: Boom - The Home Town of Tomorrowland, Belgium
Distribution: Slackware, Xubuntu
Posts: 459
Blog Entries: 2

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by bsmith52 View Post
Will there be inefficiencies since the only partition not aligned on a 2048 byte boundary is the sda2 partition (which defines the start of the extended partition)? rknichols says no.
rknichols is right. Whether or not the extended partition is properly aligned, doesn't really matter, since (if I remember correctly) only its very first sector holds any significant data anyway; it represents the head of the linked list of logical partitions that are contained in the extended partition.

Quote:
This is still puzzling as fdisk points out the the sda3 partition is the one that is not aligned properly.
As rknichols points out, fdisk is mistaken. It probably notices that the containing extended partition is improperly aligned, and incorrectly reports an issue with the first logical partition that it holds. In my opinion, it could just as well ignore improper alignment of the extended partition, because that is entirely inconsequential.
 
Old 12-13-2016, 04:55 PM   #8
bsmith52
LQ Newbie
 
Registered: Nov 2016
Posts: 26

Original Poster
Rep: Reputation: Disabled
Thanks for the explanation.

Liniux has so many details/things to learn. I believe that I could spend the rest of my life learning it, and still only know about 10% of what there is to know.
 
  


Reply

Tags
partition



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Partition 3 does not start on physical sector boundary. gruncleJim Linux - Hardware 25 08-28-2021 10:02 PM
Partition does not start on physical sector boundary bogeyman2007 Linux - Hardware 9 07-06-2015 07:13 PM
[SOLVED] Partition 2 does not start on physical sector boundary czezz Linux - General 4 01-29-2014 09:44 AM
Partition X does not start on physical sector boundary. berkov Linux - Newbie 5 04-17-2013 08:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 05:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration