1 (edited by KarlMarxWasRight 2021-02-11 00:03:18)

Topic: [SOLVED] Can not change start of partition

Hi I have a misaligned partition and have been trying to change the start sector with gparted, I have an ecrypted root ext4 partition, the only one on the drive, i shrunk the partition size so there was unallocated space but i could not move the partition at all still, is there something obvious i've missed?


Re: [SOLVED] Can not change start of partition

A couple of pointers:
* LUKS encryption has to be closed to be moved.
* GParted's UI rounds to the nearest 1 MiB so you have to move at least that amount.

For a more detailed answer please provide your disk layout.  Replace sda with the drive name in question.

sudo parted /dev/sda unit s print
sudo fdisk -l /dev/sda
sudo gdisk -l /dev/sda
sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint


Re: [SOLVED] Can not change start of partition

Thank you! The issue with gparted was having encryption open when trying to move, woops lol

So I think my partitions are aligned correctly now, I was doing this hoping it might fix the 'invalid sector size 65535' warning i get on boot, everything works fine but it just bugs me and i wanted to try and fix it, but i still have it, do you have any idea how i could identify the problem behind it?

here's the output of my disk layout just in case that's still handy:

$ sudo parted /dev/sda unit s print
Model: ATA INTEL SSDSC2BF18 (scsi)
Disk /dev/sda: 351651888s
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start  End         Size        File system  Name  Flags
 1      6144s  351651839s  351645696s                     legacy_boot

$ sudo fdisk -l /dev/sda
Disk /dev/sda: 167.68 GiB, 180045766656 bytes, 351651888 sectors
Disk model: INTEL SSDSC2BF18
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: D221E586-EE23-4538-BF0C-D999C64D7D56

Device     Start       End   Sectors   Size Type
/dev/sda1   6144 351651839 351645696 167.7G Linux filesystem

$ sudo gdisk -l /dev/sda
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.
Disk /dev/sda: 351651888 sectors, 167.7 GiB
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): D221E586-EE23-4538-BF0C-D999C64D7D56
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 351651854
Partitions will be aligned on 2048-sector boundaries
Total free space is 6125 sectors (3.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            6144       351651839   167.7 GiB   8300  

$ sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint
NAME                                          MAJ:MIN RM   SIZE RO TYPE  FSTYPE      LABEL    MOUNTPOINT
sda                                             8:0    0 167.7G  0 disk                       
└─sda1                                          8:1    0 167.7G  0 part  crypto_LUKS          
  └─luks-2c9ddb60-9e99-4f14-9710-6b59c607db87 254:0    0 167.7G  0 crypt ext4                 /
sdb                                             8:16   0 931.5G  0 disk                       
├─sdb1                                          8:17   0   450M  0 part  ntfs        Recovery 
├─sdb2                                          8:18   0   100M  0 part  vfat                 /boot/efi
├─sdb3                                          8:19   0    16M  0 part                       
├─sdb4                                          8:20   0 464.7G  0 part  ntfs                 
├─sdb5                                          8:21   0   509M  0 part  ntfs                 
├─sdb6                                          8:22   0  14.9G  0 part  crypto_LUKS          
│ └─luks-eaad7270-3aa8-4600-b054-6eefd1d22a47 254:1    0  14.9G  0 crypt swap                 [SWAP]
└─sdb7                                          8:23   0 450.9G  0 part  crypto_LUKS          
  └─luks-3220f54b-75a3-4582-b41c-c866a55f623f 254:2    0 450.9G  0 crypt ext4                 /home
sdc                                             8:32   0   2.7T  0 disk                       
└─sdc1                                          8:33   0   2.7T  0 part  ntfs                 
sdd                                             8:48   0   3.6T  0 disk                       
└─sdd2                                          8:50   0   3.6T  0 part  ntfs        01 (4TB) 
sde                                             8:64   0   2.7T  0 disk                       
└─sde2                                          8:66   0   2.7T  0 part  ntfs        02 (3TB) 
sdg                                             8:96   1   1.9G  0 disk                       
└─sdg1                                          8:97   1   922M  0 part  vfat                 

$ sudo blkid 
/dev/sda1: UUID="2c9ddb60-9e99-4f14-9710-6b59c607db87" TYPE="crypto_LUKS" PARTUUID="5edeeb5a-0642-6d44-b5ab-e327e097cc9e"
/dev/sdb1: LABEL="Recovery" BLOCK_SIZE="512" UUID="540884030883E1FA" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="4d4f84ae-8c94-4a19-9221-c7c8d6edf1dc"
/dev/sdb2: UUID="1C86-7482" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="bbb43246-48dc-4be1-ae10-d9759a6c5fca"
/dev/sdb3: PARTLABEL="Microsoft reserved partition" PARTUUID="9f608901-b941-4204-90ed-9a058ac74b3f"
/dev/sdb4: BLOCK_SIZE="512" UUID="220A99710A9942A9" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="5a174dff-a12e-4048-ae16-018129993a92"
/dev/sdb5: BLOCK_SIZE="512" UUID="74BC3770BC372C4C" TYPE="ntfs" PARTUUID="955831b6-24ae-4049-baf0-1fb11138098d"
/dev/sdb6: UUID="eaad7270-3aa8-4600-b054-6eefd1d22a47" TYPE="crypto_LUKS" PARTUUID="5df666a6-bd32-c649-a83f-2fc6db8be1fb"
/dev/sdb7: UUID="3220f54b-75a3-4582-b41c-c866a55f623f" TYPE="crypto_LUKS" PARTUUID="81fa0495-fef2-3746-810d-148ed3789288"
/dev/sdc1: BLOCK_SIZE="512" UUID="614EEF90290B038E" TYPE="ntfs" PARTUUID="d71de216-708d-b745-8f6a-4ab63e4354a1"
/dev/sdd2: LABEL="01 (4TB)" BLOCK_SIZE="512" UUID="FEEE3636EE35E793" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="4e255f75-4ed7-406b-80e0-946bc37d87a2"
/dev/sde2: LABEL="02 (3TB)" BLOCK_SIZE="512" UUID="A484916A84913FAA" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="d6c18d67-a497-4fa0-b038-d81be9c314aa"
/dev/sdg1: UUID="931D-809E" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="primary" PARTUUID="72b2a28e-ba5f-4835-add0-88bf07a6c174"
/dev/mapper/luks-2c9ddb60-9e99-4f14-9710-6b59c607db87: UUID="31bb74ff-d45b-41e8-9dff-e1cf49898484" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/luks-eaad7270-3aa8-4600-b054-6eefd1d22a47: UUID="3d771dc8-612e-41dc-ae4b-d05bf4bff3c7" TYPE="swap"
/dev/mapper/luks-3220f54b-75a3-4582-b41c-c866a55f623f: UUID="138441bc-b7ff-480e-af40-337ac6a07632" BLOCK_SIZE="4096" TYPE="ext4"


Re: [SOLVED] Can not change start of partition

Yes, partition sda1 is aligned.
* Start: 6144 (512 byte sectors) = 3.000 MiB
* End: 351651839+1 = 171705.000 MiB

All I can say about that message is that after googling, there was a bug in GRUB (#35382: grub-install-generated EFI boot image cannot find prefix: "invalid sector size 65535") from 2012 which prevented EFI machines booting which reported that message.  I assume it's been fixed a long time ago.


Re: [SOLVED] Can not change start of partition

Ah thank you, it turns out it was a card reader/USB hub that seems to cause the warning, strange lol