You are not logged in.
Pages: 1
Hi,
I just bought a 4TB Western Digital Blue for backup purposes.
While using fdisk for partitioning and checking my partition layout so far, I noticed that I got the error "Partition 1 does not start on physical sector boundary"
Looking on the internet I found that modern drives have sector sizes of 4096 bytes instead of 512 bytes.
All of them where cases where they pointed out that if they would print the current layout in fdisk they would see "Sector size (logical/physical): 512 bytes / 4096 bytes"
I however, get "Sector size (logical/physical): 512 bytes / 512 bytes".
Using GPT partitoning table (like I should)
Command (m for help): p
Disk /dev/sdf: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: EZRZ-00GXCB0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 282340FB-69D2-D74A-9FD7-190571BBE289
Device Start End Sectors Size Type
/dev/sdf1 65535 104921534 104856000 50G Linux filesystem
Partition 1 does not start on physical sector boundary.
Using dos partition table
Command (m for help): p
Disk /dev/sdf: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: EZRZ-00GXCB0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0xd189fc48
Device Boot Start End Sectors Size Id Type
/dev/sdf1 65535 104921534 104856000 50G 83 Linux
Partition 1 does not start on physical sector boundary.
I found how to solve this issue, by using the -b option to specify the sector size:
sudo fdisk -b 4096 /dev/sdf
And then proceed to take the same steps of creating a gpt partion table, and creating a new partition from the default first sector location, size of 50G.
No error this time.
Command (m for help): p
Disk /dev/sdf: 3.65 TiB, 4000787030016 bytes, 976754646 sectors
Disk model: EZRZ-00GXCB0
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 949A502D-C5D0-4C40-B0FD-B73C9F7C9D54
Command (m for help): n
Partition number (1-128, default 1):
First sector (256-976754640, default 256):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (256-976754640, default 976754640): +50G
Created a new partition 1 of type 'Linux filesystem' and of size 50 GiB.
Command (m for help): p
Disk /dev/sdf: 3.65 TiB, 4000787030016 bytes, 976754646 sectors
Disk model: EZRZ-00GXCB0
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: 949A502D-C5D0-4C40-B0FD-B73C9F7C9D54
Device Start End Sectors Size Type
/dev/sdf1 256 13107455 13107200 50G Linux filesystem
So all is well, but I can't figure out why I got this error in the first place since I had listed "Sector size (logical/physical): 512 bytes / 512 bytes"
Could this have something to do that I was using a optical disk with an USB adapter instead of a sata connector?
Last edited by CoreCat (2020-01-25 16:36:04)
Offline
Sometimes drives reports (or kernel detects) bad optimal alignment values and then all programs that try to honor optimal alignment (might include fdisk, parted, mkfs, ...) do bad things by default. In your case it reports optimal I/O size 33553920 bytes ( 65535 sectors ) and that's just bull. Ignore the optimal alignment. Manually make sure everything is in MiB alignment (multiple of 2048 sectors), also tell filesystems to pretend it's 4K sectors anyway.
USB adapter
USB-SATA adapters are also known to change the logical block size (512e to 4K or vice versa) which is bad as it affects how the partition table is interpreted (even for GPT, they didn't get rid of that unfortunately...)
If you change the sector size you might have to rewrite the partition table.
Last edited by frostschutz (2020-01-03 15:09:18)
Offline
frostschutz, thank you very much for the quick reply.
So if I understand it correctly the problem lies with the drive reporting an optimal alignment of 512 bytes which fdisk then abides by by default, but then for some reason it notices the misalignment afterwards.
How does fdisk detect the misalignment when it think 512 is the right sector size?
tell filesystems to pretend it's 4K sectors anyway
So what I was doing in the end (with the -b option of 4096) was the right way to go?
Manually make sure everything is in MiB alignment (multiple of 2048 sectors)
Why a multiple of 2048? I thought it should be 4096.
(edit)
I think I found the answer in this post: https://bbs.archlinux.org/viewtopic.php?id=169595
I was confused about sector size and partition start. The default sector size = 512. And 512 * 2048 = 1048576 (1MiB)
I'm now however using a sector size of 4096, so I should start from the 256th sector, so I leave 1048595 bytes of headspace, as by convention. (256 * 4096 = 1048595)
So what I have now should be right:
Disk /dev/sdf: 3.65 TiB, 4000787030016 bytes, 976754646 sectors
Disk model: EZRZ-00GXCB0
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: gpt
Disk identifier: B28D8CB8-5171-F44B-92A5-CC246ADF92EC
Device Start End Sectors Size Type
/dev/sdf1 256 511 256 1M Linux filesystem
/dev/sdf2 512 13107711 13107200 50G Linux filesystem
/dev/sdf3 13107712 34079231 20971520 80G Linux filesystem
/dev/sdf4 34079232 217580031 183500800 700G Linux filesystem
USB-SATA adapters are also known to change the logical block size (512e to 4K or vice versa) which is bad as it affects how the partition table is interpreted (even for GPT, they didn't get rid of that unfortunately...)
So does that mean I should not use an USB-adapter to prevent future issues when I know it changes the logical block size?
Last edited by CoreCat (2020-01-03 17:05:17)
Offline
In the end I used gdisk instead of fdisk.
With gdisk I never got the message "Partition 1 does not start on physical sector boundary" even tough I did exactly the same.
Offline
Pages: 1