Installing on GPT LVM
This is updated version of this Howto Setting up LVM on GPT-labeled disks.
This document describes how to set up a system booting from a logical volume in Alpine using lvm2 and GPT-labeled disks.
Begin by booting from Alpine installation media in the usual way. Log in as `root`, run `setup-alpine`, and answer `none` when asked to choose a disk.
Alpinelinux ISO used in this installation: alpine-vanilla-3.1.3-x86_64.iso
This PC have BIOS and not UEFI (UEFIinstallation may differ)
Tested on APU4C with KIngston mSata SSD from 30GB (SMS200S3/30G).
We need to install some tools, as 'gptfdisk' is now part of main we do not need to add @edge/testing repository.
Install the gptfdisk
Create some partition. In my case the SSD disk is found as sda, so I will use the 'sda' in whole process.
# create a new empty GUID partition table (GPT) with 'o' o # then 'y' to confirm # create some partition: BIOS (needed only for GRUB2), Boot (needed by SYSLINUX), and rest LVM n 1 <enter> +2M ef02 n 2 <enter> +100M 8300 n 3 <enter> <enter> 8e00 # print the partition table with 'p'
You should get something like this:
Number Start (sector) End (sector) Size Code Name 1 2048 6143 2.0 MiB EF02 BIOS boot partition 2 6144 210943 100.0 MiB 8300 Linux filesystem 3 210944 15662270 7.4 GiB 8E00 Linux LVM
We need to set the 'legacy BIOS bootable' flag on our boot partition, which can be done in gdisk by first entering expert mode with 'x' and then edit attributes with 'a'. It's used by SYSLINUX's GPT support to identify a partition that holds second-stage boot code.
x a 2 2
It looks like this:
Command (? for help): x
Expert command (? for help): a Partition number (1-3): 2 Known attributes are: 0: system partition 1: hide from EFI 2: legacy BIOS bootable 60: read-only 62: hidden 63: do not automount
Attribute value is 0000000000000000. Set fields are: No fields set
Toggle which attribute field (0-63, 64 or <Enter> to exit): 2 Have enabled the 'legacy BIOS bootable' attribute. Attribute value is 0000000000000004. Set fields are: 2 (legacy BIOS bootable)
Write 'Enter' to exit the expert mode and then write table to disk and exit gdisk with the 'w'.
You can verify the legacy_boot flag with sgdisk (also part of the gptfdisk)
2:2:1 (legacy BIOS bootable)
Remove gptfdisk (if not needed anymore)
Now we can setup LVM on the third partition created in above process.
Physical volume "/dev/sda3" successfully created
Volume group "vg0" successfully created
Logical volume "alpine.rootfs" created
Logical volume "swap" created
* service lvm added to runlevel default
2 logical volume(s) in volume group "vg0" now active
Format new logical volume and activate swap
Mount for finishing alpinelinux installation.
Run this command to finish installing alpinelinux to our newly mounted partition on /mnt
Output of setup-disk should be like this
Installing system on /dev/vg0/alpine.rootfs: /mnt/boot is device /dev/sda2 /boot is device /dev/sda2 You might need fix the MBR to be able to boot
Install the MBR:
Reboot and enjoy your new Alpine installation!