Setting up LVM on GPT-labeled disks: Difference between revisions

From Alpine Linux
(installing alpine on LVM+GPT)
 
m (fix markup in final {{Cmd|...}})
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!

Revision as of 14:57, 3 October 2012

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).

LVM Creation

Once you've rebooted, run through `setup-alpine` again.

Install some more necessary bits:

apk add lvm2 e2fsprogs syslinux

Create a PV, VG, and a LV for the root partition:

pvcreate /dev/sda2

vgcreate vg0 /dev/sda2

lvgcreate -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 in position:

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!