ctengel / objectindex

Index your objects
GNU General Public License v3.0
1 stars 0 forks source link

parted misaligned partitions #50

Open ctengel opened 11 months ago

ctengel commented 11 months ago

In following the README, seems like incorrect alignment is possible

parted output:

Model: Seagate Backup+ Hub BK (scsi)
Disk /dev/sda: 8002GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name          Flags
 1      33.6MB  8002GB  8002GB  ext4         xyz

fdisk output:

Disk /dev/sda: 7.28 TiB, 8001563221504 bytes, 15628053167 sectors
Disk model: Backup+ Hub BK  
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: ...

Device     Start         End     Sectors  Size Type
/dev/sda1  65535 15628000379 15627934845  7.3T Linux filesystem

Partition 1 does not start on physical sector boundary.

mkfs output:

mke2fs 1.46.2 (28-Feb-2021)
/dev/sda1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Creating filesystem with 1953491855 4k blocks and 244187136 inodes

gdisk seems to yield better results:

GPT fdisk (gdisk) version 1.0.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 15628053167 sectors, 7.3 TiB
Model: Backup+ Hub BK  
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): ...
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 15628053133
Partitions will be aligned on 2048-sector boundaries
Total free space is 15628053100 sectors (7.3 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name

Command (? for help): n
Partition number (1-128, default 1): 
First sector (34-15628053133, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-15628053133, default = 15628053133) or {+-}size{KMGTP}: 
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.
$ sudo mkfs.ext4 /dev/sda1
mke2fs 1.46.2 (28-Feb-2021)
Creating filesystem with 1953506385 4k blocks and 244191232 inodes
...
ctengel commented 10 months ago

basically - every start sector should be multiple of 2048, and every end sector multiple of 2048 - 1