50 lines
1.3 KiB
Markdown
50 lines
1.3 KiB
Markdown
|
---
|
||
|
gitea: none
|
||
|
include_toc: false
|
||
|
---
|
||
|
|
||
|
## Provisioning with LVM
|
||
|
|
||
|
First off the drive should be partitioned, possibly with fdisk. It should have atleast two partitions with one `EFI System` Partition and one `Linux filesystem` partition.
|
||
|
|
||
|
It should look something like this:
|
||
|
|
||
|
| Number of partition | Size | Type |
|
||
|
|:-----:|:-----:|:-----:|
|
||
|
| 1 | 1 to 2 GB or more | EFI System |
|
||
|
| 2 | Rest of the drive | Linux filesystem |
|
||
|
|
||
|
Then to create the filesystem of the efi partition.
|
||
|
|
||
|
```
|
||
|
# mkfs.fat -F 32 -n efi /dev/<disk1>
|
||
|
```
|
||
|
|
||
|
And the encrypted filesystem of the root partition.
|
||
|
|
||
|
```
|
||
|
# cryptsetup luksFormat /dev/<disk2> --type luks2 --label luks
|
||
|
# cryptsetup open --type luks /dev/<disk2> lv0
|
||
|
```
|
||
|
|
||
|
Now to create a new LVM volume group:
|
||
|
|
||
|
```
|
||
|
# vgcreate lv0 /dev/mapper/lv0
|
||
|
```
|
||
|
|
||
|
To create partitions inside the volume group:
|
||
|
|
||
|
```
|
||
|
# lvcreate --name root -L 64G lv0
|
||
|
# lvcreate --name home -l 100%FREE lv0
|
||
|
```
|
||
|
|
||
|
To create the filesystems on the logical partitions:
|
||
|
|
||
|
```
|
||
|
# mkfs.ext4 -L root /dev/mapper/lv0-root
|
||
|
# mkfs.ext4 -L home /dev/mapper/lv0-home
|
||
|
```
|
||
|
|
||
|
Other filesystems can also be used but `ext4` is the standard for most linux distrobutions. Other sizes for the partitions can also be used depending on the needs of the user.
|