Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Logical sector size
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Albion
n00b
n00b


Joined: 07 Feb 2012
Posts: 31
Location: England

PostPosted: Tue Jul 30, 2013 11:51 am    Post subject: Logical sector size Reply with quote

Good hello all,

I just began working through the manual and saw a message on fdisk that said

"The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.22.2)."

I once read that many drive manufacturers purposefully give misleading drive geometry details so as to fit ever larger capacities and faster speeds, etc into the system.

On sdc I get a warning at the top saying it's 3.0TB's and so is too large for DOS partition. Not a problem though as I wasn't planning on using it. Is fdisk the best utulity to use for creating drive partitions?

The system has 2 X 1TB and 1 X 3TB Western Digital drives.

I plan to spread the installation over the smaller drives and keep the larger unit for my home partition.

Any suggestions?

Thanks in advance.

Regards,

A.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Tue Jul 30, 2013 1:50 pm    Post subject: Reply with quote

As in a recent thread https://forums.gentoo.org/viewtopic-t-964488-highlight-.html

1. Most modern partitioning software will partition on 1MB boundaries and will thus automatically meet the requirements for aligning to physical sectors.

2. MSDOS/BIOS's partitioning scheme can only handle up to 2TB. Going beyond this requires using a new partition format which is not completely backwards compatible - which is GPT partitioning much like what's used for EFI. I do not own any drives larger than this but I have used parted on a EFI machine.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Tue Jul 30, 2013 4:04 pm    Post subject: Re: Logical sector size Reply with quote

Albion wrote:
"The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted.


Starting in late 2009, some disks began using sector sizes that are larger than the typical size of 512 bytes. (These disks are known as "Advanced Format" disks.) Typically, such disks use 4096-byte sectors. To maintain compatibility with software that assumes 512-byte sectors, though, such drives' firmware translates the actual 4096-byte physical sectors into eight 512-byte sectors. It's also important to know that many filesystem data structures are also 4096 bytes in size. The critical point is this: If the 4096-byte filesystem data structures straddle two physical sectors, performance can be degraded. For instance, consider a write operation of just one of these data structures: Two physical sectors must be read, modified, and written back to the disk. (The drive's firmware handles this; the OS just writes the eight 512-byte logical sectors.) This contrasts with the case in which the filesystem data structures align with the physical sectors, in which case the new data structure can be written directly as a single 4096-byte physical sector.

In order to properly align filesystem data structures, the partitions that hold the filesystems must begin on 8-sector boundaries. For instance, beginning a partition on sector 40 works well (40 = 8 * 5), whereas beginning a partition on sector 63 does not work well (63 is not evenly divisible by 8). This is because the filesystem data structures are not just sized in multiples of 4096 bytes, but they're laid out on multiples of that value, so if a filesystem begins on an 8-sector boundary, its important data structures will also align on such boundaries. Most modern partitioning tools align partitions on 1MiB (2048-sector) boundaries by default. Since 2048 is a multiple of 8, this works fine with Advanced Format disks. The value 2048 is used because there are similar issues with some types of RAID arrays and with SSDs, but that require larger alignment values. Aligning on 2048-sector boundaries works well with most such disks.

As a practical matter, there can be real performance pentalties when using such disks with improper alignment. The details vary greatly from one filesystem to another, and probably from one kernel to another and from one disk to another.

Quote:
I once read that many drive manufacturers purposefully give misleading drive geometry details so as to fit ever larger capacities and faster speeds, etc into the system.


This is an entirely different issue. In the old days, disk access was done using a triplet of numbers: cylinder, head, and sector (CHS). Modern disks, though, use a logical block address (LBA) instead. Because of the peculiar way in which CHS values were designed, hardware and software went through a series of changes to LBA that redefined its mappings to disk sectors. Such changes are largely a thing of the past, though. This is because, in terms of the common Master Boot Record (MBR) partitioning system, CHS values are encoded in a 24-bit value (with some values being illegal), whereas LBA uses a 32-bit field. Thus, CHS values max out at a bit under 2^24 sectors, or about 8GB; but LBA values max out at 2^32 sectors, or 2TiB. Thus, CHS values are useless for describing modern disks -- even many USB flash drives are larger than 8GB.

Quote:
On sdc I get a warning at the top saying it's 3.0TB's and so is too large for DOS partition. Not a problem though as I wasn't planning on using it. Is fdisk the best utulity to use for creating drive partitions?


As noted, MBR's LBA values max out at 2TiB. (Some utilities refer to MBR partitions as "msdos partitions" or something similar.) The newer GUID Partition Table (GPT), though, uses 64-bit LBA values, which pushes the disk-size limit up to 8ZiB, which is big enough to last us for a while (probably another two or three decades, assuming disk sizes increase at the same rate they've done over the past couple of decades).

Until very recently, Linux fdisk didn't support GPT at all, and is therefore not a good choice for partitioning disks that are larger than 2TiB. The very latest versions of fdisk do support GPT, but my Gentoo system uses util-linux 2.22.2, which still lacks that support. If you want to manipulate GPT disks, you should instead use gdisk (in the gptfdisk package) or a libparted-based tool (such as parted or GParted; there's also GNU fdisk, which is libparted-based). The gdisk utility uses GPT by default, but with a libparted-based tool, you may need to explicitly tell it to create a GPT, particularly if you're starting with a completely blank disk.

Quote:
The system has 2 X 1TB and 1 X 3TB Western Digital drives.

I plan to spread the installation over the smaller drives and keep the larger unit for my home partition.


For any disk larger than 2TiB, you should use GPT. There are some potential pitfalls when booting from such disks on some BIOSes; see this page for details. If your firmware is EFI-based, booting in EFI mode is in some respects a cleaner approach, but you'll need to learn more to get this to work. See my page on EFI booting for details. Since you say you plan to boot from the 1TB disks, you'll probably be able to boot in either mode (assuming your firmware supports both modes) with little trouble.

Note that the GPT/MBR issues are unrelated to the Advanced Format issues -- that is, if you're using an Advanced Format disk, you should align your partitions using the same rules for either partition table type. (One partial exception: Alignment is unimportant for MBR extended partitions, just for primary and logical partitions. GPT doesn't use the primary/extended/logical partition distinction.)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Tue Jul 30, 2013 4:45 pm    Post subject: Reply with quote

I think recent fdisk versions should default to 1MiB boundaries, but you'll need to ensure that it's in that mode.

I just worry about using new the fdisk on my ST351AX HDD. Wasting 1MB is a sizeable chunk of the 40MB HDD :D
(In this case you can always revert back to C/H/S for such old HDDs)
Back to top
View user's profile Send private message
Albion
n00b
n00b


Joined: 07 Feb 2012
Posts: 31
Location: England

PostPosted: Wed Jul 31, 2013 11:26 am    Post subject: Reply with quote

Thanks to all who've posted a reply with help to my query. It's greatly appreciated.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum