You are not logged in.

#1 2020-05-28 15:23:19

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

[SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

Hello,

I want to do my first Arch installation on real hardware. It is a ThinkPad so I want it to be encrypted.

I've read some tutorials and also watched some videos about it.

Some people use the `--dataalignment 1m` argument with the pvcreate command.
I searched for this parameter but most articles I found were 6-8 years old.

As far as I know this is useful for SSDs... I install on SSD.

How is it today?
Is it neccessary to add this parameter, or not?

Last edited by SpeedCola (2020-05-29 17:29:24)

Offline

#2 2020-05-28 16:07:10

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

What installation guide are you following?  Have you read through the default /etc/lvm/lvm.conf?

Offline

#3 2020-05-28 16:08:46

frostschutz
Member
Registered: 2013-11-15
Posts: 1,653

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

MiB alignment should be the default but it doesn't hurt to double check. ( pvs -o +pe_start )

Offline

#4 2020-05-28 16:15:59

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

loqs wrote:

What installation guide are you following?  Have you read through the default /etc/lvm/lvm.conf?

I'm not strictly following a guide since each guide does something different.
I read some guides and made my own one from that.

Thanks for the hint.
In the default conf I find the following options:

# default_data_alignment = 1
(Is commented out)

data_alignment = 0
(Set to 0 to use the default alignment or the page size, if larger)

But that is not very useful information to me.

frostschutz wrote:

MiB alignment should be the default but it doesn't hurt to double check. ( pvs -o +pe_start )

And 1m is still the preferred value for modern SSDs like Crucial MX500?

`pvs -o +pe_start` shows 1m but I installed it with this option in the vm.

Last edited by SpeedCola (2020-05-28 16:17:49)

Offline

#5 2020-05-28 16:42:56

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

	# Configuration option devices/data_alignment_detection.
	# Detect PV data alignment based on sysfs device information.
	# The start of a PV data area will be a multiple of minimum_io_size or
	# optimal_io_size exposed in sysfs. minimum_io_size is the smallest
	# request the device can perform without incurring a read-modify-write
	# penalty, e.g. MD chunk size. optimal_io_size is the device's
	# preferred unit of receiving I/O, e.g. MD stripe width.
	# minimum_io_size is used if optimal_io_size is undefined (0).
	# If md_chunk_alignment is enabled, that detects the optimal_io_size.
	# This setting takes precedence over md_chunk_alignment.

The last line was replaced with the following in v2_03_03 with the following update,  I have not checked if there was a matching code change.

	# default_data_alignment and md_chunk_alignment will be overriden
	# if they are not aligned with the value detected for this setting.
	# This setting is overriden by data_alignment and the --dataalignment
	# option.

You could recreate the pv without specifying --dataalignment 1m.  Also what are the optimal_io_size and minimum_io_size?  (Values can be found under /sys/block/$devid/queue/)
Please note the only supported installation guide is https://wiki.archlinux.org/index.php/Installation_guide
Edit:
Assuming the note on alignment overriding applies to 2.02.187 then provided the default_data_alignment of 1 MiB is divisible by optimal_io_size if none zero and 1 MiB is divisible by minimum_io_size if optimal_io_size is 0 then
1 MiB will be used,  otherwise optimal_io_size will be used if none zero and minimum_io_size if optimal_io_size is 0.

Last edited by loqs (2020-05-28 17:12:52)

Offline

#6 2020-05-28 16:59:04

frostschutz
Member
Registered: 2013-11-15
Posts: 1,653

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

SpeedCola wrote:

And 1m is still the preferred value for modern SSDs like Crucial MX500?

MiB alignment works fine for SSDs, yes

you can't get everyone to agree to even larger alignments anyway

mdadm raid does 512K chunks, filesystems might go down to 4K

so technically even 1 MiB alignment is pointless (too large) most of the time... the main point of it is to avoid off-by-ones for devices using 4K/8K/16K ... sectors/pages. 1MiB aligns to all of these and its convenient to follow and implement.

Offline

#7 2020-05-28 17:19:16

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

minimum_io_size 512
optimal_io_size 0

First I followed the 'official' installation guide but regarding encryption that redirects me to like 5 different wiki pages where I was really confused.
On any of these pages it is not clear if I use UEFI, do I still have to create a /boot partition or just /efi?
And also where exactly to mount these was not clearly visible in the guides. /efi? /boot/efi? whatever.
So I searched for other guides and then it worked. But that's a bit off-topic.

So I guess I don't have to specify the parameter explicitly and it'll stick to 1M.

Thanks smile

Offline

#8 2020-05-28 18:17:32

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

One issue per topic is preferred.

If the system is using UEFI it needs an ESP which can be mounted to any location of your choice.  Depending on the boot loader used,  mounting the ESP to /boot so the kernel and initrd are placed on the ESP may make things easier.

Offline

#9 2020-05-28 18:30:12

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

loqs wrote:

One issue per topic is preferred.

Yes I know. Wasn't intended to start another question.
Just wanted to explain why I followed different guides than the official in the Wiki.

But since you already answered I edited the thread title accordingly and ask another question regarding that.
Hope that's okay in this case.

loqs wrote:

If the system is using UEFI it needs an ESP which can be mounted to any location of your choice.  Depending on the boot loader used,  mounting the ESP to /boot so the kernel and initrd are placed on the ESP may make things easier.

So you say I don't need an EFI + BOOT partition but only one of them?
To be honest I don't understand that properly and in the wiki I couldn't find a clear explanation either.

I followed mostly this guide: https://www.youtube.com/watch?v=Lq4cbp5AOZM

And he is creating both EFI and BOOT partitions and a third one for the LUKS/LVM.

edit:

Here https://wiki.archlinux.org/index.php/Pa … ple_layout
it says 'boot or efi' but in the exactly same article some lines above: https://wiki.archlinux.org/index.php/Partitioning#/boot
it says: A separate /boot partition is only required if your boot loader is not capable of accessing the /boot directory that resides in /. For example, if the boot loader does not support that file system or if your / is on a stacked block device (e.g. software RAID, a encrypted volume or a LVM volume)

... more confusion wherever I look.

Last edited by SpeedCola (2020-05-28 18:50:43)

Offline

#10 2020-05-28 19:02:13

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

The limitations imposed by your choice of boot loader dictate what /boot can be.  Combine those limitations with the ESP must be on a physical device formatted FAT32 with no encryption.
That combination gives the set of options you have for where to mount the ESP.  For example,  if you are using https://wiki.archlinux.org/index.php/Dm … ion_(GRUB) then as /boot is encrypted you would mount the esp somewhere else.

Offline

#11 2020-05-28 19:04:14

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

I use GRUB and I don't want encrypted /boot.

Offline

#12 2020-05-28 19:16:37

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

The bootloader must be able to access the kernel and initrd placed on /boot.  If /boot is the ESP that means grub must be able to read VFAT.
See the grub entry in the feature table comparison from the bootloader link in post #10.

Offline

#13 2020-05-28 19:19:30

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

Yes GRUB can read VFAT and the efi partition should be FAT32.
I already know that.

But still that doesn't answer my question.
Or I'm too stupid to get it. Sorry.

Does that mean I only need to create one partition with type 'EFI System' and mount that one while the installation to /mnt/boot?
After installation that one is unencrypted.

Offline

#14 2020-05-28 19:24:35

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

Moving to Newbie Corner.

Offline

#15 2020-05-28 19:25:08

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

That would work.  Or you could mount the ESP to /efi or /boot/efi grub supports both those options where /boot would be on the encrypted LVM volume,  provided the encryption is not luks2 format.
Arch does not prescribe a default layout so that means you have more choices.

Offline

#16 2020-05-28 19:34:51

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

Okay, now just for clarification:

I created two partitions:
- /dev/sda1 500M Type 'EFI System'
- /dev/sda2 100%FREE Type 'Linux LVM'
...
then the LUKS/LVM stuff
...
mount /dev/VG/lv_root /mnt
mount /dev/sda1 /mnt/boot

...

When I try to install GRUB with the following command:
grub-install --target=x86_64-efi --bootloader-id=GRUB_UEFI --recheck

it says: Couldn't find EFI directory

Then I tried `mkdir /boot/efi` and run the above command again... same error.


Yes the encryption is LUKS2 format.
I know GRUB can do encrypted /boot only with Luks1 format but I don't want an encrypted /boot.

Offline

#17 2020-05-28 20:09:43

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

You are missing one of the options to grub-install from GRUB#Installation_2

Offline

#18 2020-05-28 20:23:23

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

You are right. Messed so much around with everything that I somehow deleted that from my notes.

Okay it works like this.
Thanks.

Still I think the installation guide in the Wiki is not very clear especially for newcomers since not the whole installation process is described in one page but it links to like 20 different pages for partitioning, efi-parition, grub, encryption, ...

However, I'm glad it finally worked and I finally know that I only need one unencrypted efi partition. smile

From now on the further process is easy for me.
Thanks a lot.

Offline

#19 2020-05-29 12:02:55

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

Okay that worked pretty nice in a VM but today I tried it on real hardware (ThinkPad) and did exactly the same thing.

But after an reboot GRUB doesn't show up.

The SSD is my first boot priority but it can't detect that I can boot from this device.
It always throws me to the boot-device-menu

Proably this is because I did the following:
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot --recheck

And as far as I can remember some motherboard manufacturers expect the efi-directory on a very specific loaction.
Probably /boot is not a good choice in this case.

Now I rebooted into the Arch installation media and encrypted + remounted everything.
Not sure though how I should continue?

Can I just run the above command with a different efi-directory location do I have to do some clean up first?

Offline

#20 2020-05-29 12:15:40

loqs
Member
Registered: 2014-03-06
Posts: 19,062

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

The firmware has no knowledge of where the ESP is mounted.  What is the output of

efibootmgr -v

Offline

#21 2020-05-29 12:19:12

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

[root@archiso /]# efibootmgr -v
BootCurrent: 001B
Timeout: 0 seconds
BootOrder: 0010,0011,0012,0013,0017,0018,0019,001C,001A,001B
Boot0000* manjaro       HD(1,GPT,95aed79e-3e32-4115-a257-aa7f15a9a87d,0x800,0x100000)/File(\EFI\manjaro\grubx64.efi)
Boot0001* debian        HD(1,GPT,6407fcdf-b3ef-4ba7-9575-3c0b9d36ea6a,0x800,0x100000)/File(\EFI\debian\shimx64.efi)
Boot0002* gentoo        HD(1,GPT,7c84cb7c-cd11-4480-883f-391abc88d1f5,0x800,0x3f800)/File(\EFI\gentoo\grubx64.efi)
Boot0003* GRUB  HD(1,GPT,06ff90a9-daa5-f243-8984-97c3ef0ce1ef,0x800,0xfa000)/File(\EFI\GRUB\grubx64.efi)
Boot0010  Setup FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0011  Boot Menu     FvFile(126a762d-5758-4fca-8531-201a7f57f850)
Boot0012  Diagnostic Splash Screen      FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot0013  Lenovo Diagnostics    FvFile(3f7e615b-0d45-4f80-88dc-26b234958560)
Boot0014  Startup Interrupt Menu        FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot0015  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0016  MEBx Hot Key  FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
Boot0017  USB CD        VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
Boot0018  USB FDD       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot0019  NVMe0 VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,001c199932d94c4eae9aa0b6e98eb8a400)
Boot001A* ATA HDD0      VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f600)
Boot001B* USB HDD       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot001C  PCI LAN       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot001D* IDER BOOT CDROM       PciRoot(0x0)/Pci(0x14,0x0)/USB(11,1)
Boot001E* IDER BOOT Floppy      PciRoot(0x0)/Pci(0x14,0x0)/USB(11,0)
Boot001F* ATA HDD       VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
Boot0020* ATAPI CD      VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)

This Manjaro Gentoo Debian stuff is old. I inserted a new empty SSD and installed only Arch on it.

Offline

#22 2020-05-29 12:25:41

SpeedCola
Member
Registered: 2020-05-02
Posts: 25

Re: [SOLVED] pvcreate --dataalignment 1m | /boot /efi partitions?

I can remember when I installed Gentoo some time ago, there was a notice about this in their wiki:

https://wiki.gentoo.org/wiki/Handbook:A … er#Install

Some motherboard manufacturers seem to only support the /efi/boot/ directory location for the .EFI file in the EFI System Partition (ESP). The GRUB installer can perform this operation automatically with the --removable option. Verify the ESP is mounted before running the following commands. Presuming the ESP is mounted at /boot (as suggested earlier), execute:

grub-install --target=x86_64-efi --efi-directory=/boot --removable

This creates the default directory defined by the UEFI specification, and then copies the grubx64.efi file to the 'default' EFI file location defined by the same specification.

Could this be the right solution for my problem here too? (Not sure if this is related but I guess so)

EDIT:

Yes it works with the --removable flag.

Now it detects GRUB and I can boot. However for the encryption password I have to enter it in QWERTY laybout but normally I use QWERTZ.
But that's another topic. I won't start a third question right here. wink

Thanks to everyone who helped me.

Last edited by SpeedCola (2020-05-29 12:46:46)

Offline

Board footer

Powered by FluxBB