documentation/docs/alpine-desktop-setup/provisioning.md

65 lines
1.9 KiB
Markdown
Raw Normal View History

# Provisioning
2023-12-27 13:52:44 +01:00
After flasing the Alpine Linux extended ISO, partition a disk. For this action internet is required since `gptfdisk` is not included on the extended ISO, therefore it needs to be obtained from the repository.
To set it up `setup-interfaces` and `setup-apkrepos` will be used.
```
# setup-interfaces -ar
# setup-apkrepos -c1
```
Because the Alpine Linux ISO is pretty minimal a few packages will have to be installed first:
```
# apk add cryptsetup lvm2 lsblk e2fsprogs gptfdisk dosfstools
```
The drive should be partitioned using `gdisk` (or `cfdisk`). It should have atleast two partitions with one `EFI System` partition and one `Linux filesystem` partition and look something like this:
| Number of partition | Size | Type |
|:-----:|:-----:|:-----:|
| 1 | 512 MB or more | EFI System |
| 2 | Rest of the drive | Linux filesystem |
Then to create the filesystem on the efi partition.
```
# mkfs.fat -F 32 -n efi /dev/<disk1>
```
And the encrypted filesystem on the root partition.
```
2023-12-27 12:17:46 +01:00
# cryptsetup luksFormat /dev/<disk2> --type luks2
# cryptsetup open --type luks /dev/<disk2> luks
```
2024-01-01 20:47:20 +01:00
Now to create a new LVM volume group (choose $n \in \mathbb{N}$ accordingly):
```
2024-01-01 20:47:20 +01:00
# vgcreate vg<n> /dev/mapper/luks
```
To create partitions inside the volume group:
```
2024-01-01 20:47:20 +01:00
# lvcreate --name alp_root -L 16G vg<n>
# lvcreate --name alp_var -L 8G vg<n>
# lvcreate --name alp_tmp -L 16G vg<n>
# lvcreate --name alp_nix -L 32G vg<n>
2024-01-01 21:10:41 +01:00
# lvcreate --name alp_home -l 100%FREE vg<n>
```
2023-12-27 14:01:33 +01:00
Now the home partition fills the entirety of the volume group. These sizes should be changed depending on the needs of the user.
To create the filesystems on the logical partitions:
```
2024-01-01 20:47:20 +01:00
for i in root var tmp nix home; do
> mkfs.ext4 /dev/vg<n>/alp_$i
> done
```
2023-12-27 12:17:46 +01:00
Other filesystems can also be used but `ext4` is the standard for most Linux distrobutions.