[SOLVED] alignment is offset by 512 bytes. This may result in very poor performance
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
# mkfs.ext4 /dev/sde1
Disk /dev/sde: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 95E1A3B8-DC2A-4FE6-B523-185BB88396DD
Device Start End Sectors Size Type
/dev/sde1 65535 9765632489 9765566955 4.6T Linux filesystem
Partition 1 does not start on physical sector boundary.
when I went to format, I got:
Code:
# mkfs.ext4 /dev/sde1
mke2fs 1.43.1 (08-Jun-2016)
/dev/sde1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
It formatted successfully, but I'm concerned about the performance warning. How would I better re-partition as suggested?
Device Start End Sectors Size Type
/dev/sde1 65535 9765632489 9765566955 4.6T Linux filesystem
Partition 1 does not start on physical sector boundary.
I think that happens because sector 65535 is not a multiple of 8, 65536 is. Start the partition at sector 4096 or 2048. I have a 3TB HDD with one partition starting at sector 2048, and never got that message when I created the partition:
Code:
# fdisk -l /dev/sdc
Disk /dev/sdc: 2.7 TiB, 3000592982016 bytes, 5860533168 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: gpt
Disk identifier: D0070DA0-049B-4D51-8EB4-685954188CA2
Device Start End Sectors Size Type
/dev/sdc1 2048 5860533134 5860531087 2.7T Linux filesystem
I've always used fdisk or gdisk, which now will automatically select the best starting point for the drive to make sure it is aligned (I think older versions of at least fdisk didn't do proper alignment on the relatively new 4k sectored disks). It seems that parted doesn't do that automatically (or at least not with the way you called it... there might be different options that will attempt proper alignment).
But that's interesting that mkfs catches the misalignment. I didn't know it did that.
To give more information on Diantre's post, if you look at the fdisk output, it shows that your physical sector size is 4096. That means you need to have all your partition splits be on multiples of 4096. If you divide 65535 (your starting sector) by 4096, you get 15.9997, which means it's not properly aligned. For it to be aligned, you'd want it in multiples of 4096. So if we take 4096 and multiply it by 16 (which that first space is typically reserved for the partition table), you get the 65535 sector that Diantre provided.
However, using multiples of 8 could hurt because it may still not be aligned by the 4096 sector size, you want to make sure it is in multiples of your physical sector size, which in the case of this drive, is 4096.
[CODE]I think that happens because sector 65535 is not a multiple of 8, 65536 is. Start the partition at sector 4096 or 2048. I have a 3TB HDD with one partition starting at sector 2048, and never got that message when I created the partition:
So, in my parted command, for the offset I have "0%" (I just monkey-typed from an example). Should I explicitly set that to 4096? E.g.:
Code:
# parted -a opt /dev/sde mkpart primary 4096 5000G
The man page has:
Quote:
mkpart part-type [fs-type] start end
Make a part-type partition for filesystem fs-type (if specified), beginning at start and ending at end (by
default in megabytes). part-type should be one of "primary", "logical", or "extended".
I read this as the start/end parameters are in megabytes, not sectors. Confused!
Supposedly, the "-a opt" parameter is supposed to "aligns to a multiple of the physical block size in a way that guarantees optimal performance." But I guess it's not doing that!
I've never used parted, but from what I've read online, it seems like your command should've worked and provided the proper alignment. I don't know why it didn't. That might be something to raise to the parted developers. In the meantime, it may be wise to use something like gdisk to partition your drive as I've never had alignment issues with that.
I have vague memories of 0% not doing what it might be imagined to. I think if you do it interactively (with -a opt) it'll tell you what to use. Try 1M.
(parted) select /dev/sde
Using /dev/sde
(parted) align-check opt
Partition number? 1
1 aligned
(parted) print
Model: Seagate BUP SL (scsi)
Disk /dev/sde: 5001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 33.6MB 5000GB 5000GB ext4 primary
The align-check says it's aligned. The `print` shows the start at 33.6M. When I tried "1M" manually, it said the closet offset would be 33.6M - did I want to try that.
Maybe it's OK after all? Hmmmm ...
running gdisk and taking defaults gives me a starting sector of 40:
Code:
Command (? for help): p
Disk /dev/sde: 9767541167 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 95E1A3B8-DC2A-4FE6-B523-185BB88396DD
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9767541133
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 40 9767541133 4.5 TiB 8300 Linux filesystem
There is a job running against this drive at the moment, but perhaps I'll try the gdisk settings tomorrow and see what happens.
To give more information on Diantre's post, if you look at the fdisk output, it shows that your physical sector size is 4096. That means you need to have all your partition splits be on multiples of 4096. If you divide 65535 (your starting sector) by 4096, you get 15.9997, which means it's not properly aligned. For it to be aligned, you'd want it in multiples of 4096. So if we take 4096 and multiply it by 16 (which that first space is typically reserved for the partition table), you get the 65535 sector that Diantre provided.
However, using multiples of 8 could hurt because it may still not be aligned by the 4096 sector size, you want to make sure it is in multiples of your physical sector size, which in the case of this drive, is 4096.
That "4096" physical sector size is in bytes. The "65535" starting offset is in units of 512-byte logical sectors. You just need the starting offset to be a multiple of 8. (8*512 = 4096)
OK, I repartitioned the disk using gdisk and took the defaults:
Code:
# gdisk -l /dev/sde
GPT fdisk (gdisk) version 1.0.0
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sde: 9767541167 sectors, 4.5 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 95E1A3B8-DC2A-4FE6-B523-185BB88396DD
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 9767541133
Partitions will be aligned on 8-sector boundaries
Total free space is 6 sectors (3.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 40 9767541133 4.5 TiB 8300 Linux filesystem
It put the starting sector at 40 (40* 512 = 20480). I got no warnings about alignment issues either from gdisk or mkfs.
I didn't know about gdisk and have been using parted for my GPT drives. gdisk is great! Works just like fdisk and is therefore familiar and less complex that parted. Plus, it apparently works better and doesn't create mis-aligned sectors by default!
[SOLVED] alignment is offset by 512 bytes. This may result in very poor performance
I encountered this same weird issue this evening when attempting format a brand new, pre-NTSC-formatted 8TB Seagate external USB HD using Linux Mint 18.1.
Notice how the error occurred when I targeted "/dev/sdc1" (i.e. the 1st partition on the drive) but the error does not occur when I target simply "/dev/sdc" (i.e. the whole drive itself).
Code:
$ sudo mkfs.ext4 -T largefile4 -L 'The Sweet Stuff' /dev/sdc1
mke2fs 1.42.13 (17-May-2015)
/dev/sdc1 alignment is offset by 3072 bytes.
This may result in very poor performance, (re)-partitioning suggested.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.