Setting up LVM on GPT-labeled disks: Difference between revisions
(installing alpine on LVM+GPT) |
(→Partitioning: Added note about `mdev -s`) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 18: | Line 18: | ||
set 2 lvm on | set 2 lvm on | ||
Now, exit `parted` and reboot to force a reread of the partition table (for some reason `partprobe` doesn't work here). | Now, exit `parted` and reboot to force a reread of the partition table (for some reason, `partprobe` doesn't work here). (Or, instead of rebooting, maybe try running `mdev -s`.) | ||
=== LVM Creation === | === LVM Creation === | ||
Once you've rebooted, run through `setup-alpine` again. | Once you've rebooted, run through `setup-alpine` again. | ||
Install some more necessary | Install some more necessary tools: | ||
{{Cmd|apk add lvm2 e2fsprogs syslinux}} | {{Cmd|apk add lvm2 e2fsprogs syslinux}} | ||
Line 29: | Line 29: | ||
{{Cmd|pvcreate /dev/sda2}} | {{Cmd|pvcreate /dev/sda2}} | ||
{{Cmd|vgcreate vg0 /dev/sda2}} | {{Cmd|vgcreate vg0 /dev/sda2}} | ||
{{Cmd| | {{Cmd|lvcreate -n myhost.root -L 8G vg0}} | ||
{{Cmd|rc-update add lvm}} | {{Cmd|rc-update add lvm}} | ||
{{Cmd|vgchange -ay}} | {{Cmd|vgchange -ay}} | ||
Line 37: | Line 37: | ||
{{Cmd|mkfs.ext4 /dev/vg0/myhost.root}} | {{Cmd|mkfs.ext4 /dev/vg0/myhost.root}} | ||
Mount the file systems | Mount the file systems: | ||
{{Cmd|mount -t ext4 /dev/vg0/myhost.root /target}} | {{Cmd|mount -t ext4 /dev/vg0/myhost.root /target}} | ||
{{Cmd|mkdir /target/boot}} | {{Cmd|mkdir /target/boot}} | ||
Line 46: | Line 46: | ||
Finally, install `syslinux` (note that we are installing to `/dev/sda`, *not* `/dev/sda1`): | Finally, install `syslinux` (note that we are installing to `/dev/sda`, *not* `/dev/sda1`): | ||
{{Cmd|dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda}} | {{Cmd|1=dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda}} | ||
Reboot and enjoy your new Alpine installation! | Reboot and enjoy your new Alpine installation! |
Latest revision as of 22:26, 26 March 2022
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.
Partitioning
We need to install some tools:
apk add parted lvm2
Now we can create the partition table:
parted -a optimal /dev/sda
unit MiB mkpart 1 1 256 name 1 boot set 1 legacy_boot on mkpart 2 256 100% set 2 lvm on
Now, exit `parted` and reboot to force a reread of the partition table (for some reason, `partprobe` doesn't work here). (Or, instead of rebooting, maybe try running `mdev -s`.)
LVM Creation
Once you've rebooted, run through `setup-alpine` again.
Install some more necessary tools:
apk add lvm2 e2fsprogs syslinux
Create a PV, VG, and a LV for the root partition:
pvcreate /dev/sda2
vgcreate vg0 /dev/sda2
lvcreate -n myhost.root -L 8G vg0
rc-update add lvm
vgchange -ay
Create file systems:
mkfs.ext3 /dev/sda1
mkfs.ext4 /dev/vg0/myhost.root
Mount the file systems:
mount -t ext4 /dev/vg0/myhost.root /target
mkdir /target/boot
mount -t ext3 /dev/sda1 /target/boot
Now you can run `setup-disk` to install Alpine:
setup-disk -m sys /target
Finally, install `syslinux` (note that we are installing to `/dev/sda`, *not* `/dev/sda1`):
dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda
Reboot and enjoy your new Alpine installation!