Browse Source

Initial Commit

main
Victor Roest 1 year ago
commit
257078f995
Signed by: 0x76 GPG Key ID: A3923C699D1A3BDA
  1. 15
      .drone.yml
  2. 35
      .gitignore
  3. 3
      .gitmodules
  4. 12
      Dockerfile
  5. 11
      README.md
  6. 6
      archetypes/default.md
  7. 24
      config.yml
  8. 117
      content/posts/expand-disk.md
  9. 1
      themes/PaperMod

15
.drone.yml

@ -0,0 +1,15 @@
---
kind: pipeline
type: kubernetes
name: default
steps:
- name: kaniko
image: harbor.xirion.net/hub/banzaicloud/drone-kaniko
settings:
username:
from_secret: REGISTRY_USER
password:
from_secret: REGISTRY_PASSWORD
registry: harbor.xirion.net
repo: library/blog.xirion.net
tags: latest

35
.gitignore

@ -0,0 +1,35 @@
### Hugo ###
# Generated files by hugo
/public/
/resources/_gen/
hugo_stats.json
### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
### vscode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

3
.gitmodules

@ -0,0 +1,3 @@
[submodule "themes/PaperMod"]
path = themes/PaperMod
url = https://github.com/adityatelange/hugo-PaperMod.git

12
Dockerfile

@ -0,0 +1,12 @@
FROM alpine
ENV HUGO_VERSION 0.81.0
WORKDIR /bin
RUN curl -L https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_linux-64bit.tar.gz | tar -xz
WORKDIR /build
COPY . .
RUN /bin/hugo -D
FROM nginxinc/nginx-unprivileged:mainline-alpine
COPY --from=builder /build/public /usr/share/nginx/html

11
README.md

@ -0,0 +1,11 @@
# blog.xirion.net
## Hugo Paper Theme
I use the [PaperMod](https://github.com/adityatelange/hugo-PaperMod/) theme for hugo.
### Pulling the submodule
Either clone the repo with `--recursive` or run `git submodule update --init --recursive` after cloning
### Updating the theme
To update the submodule containing the theme run `git submodule update --remote --merge'

6
archetypes/default.md

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

24
config.yml

@ -0,0 +1,24 @@
baseURL: https://blog.xirion.net/
languageCode: en-gb
title: Xirion.net Blog
theme: PaperMod
enableRobotsTXT: true
params:
env: production
description: "A blog about things"
ShowReadingTime: true
ShowToc: true
ShowBreadCrumbs: true
homeInfoParams:
Title: "Xirion.net Blog"
content: >
Welcome to my blog! This is where you can find posts about various tech related things.
It will probably mostly consist of anything from my internal docs I though was worth making public.
You can expect anything related to my homelab, be it hypervisors, kubernetes or networking.
taxonomies:
category: categories
tag: tags
series: series

117
content/posts/expand-disk.md

@ -0,0 +1,117 @@
---
title: "How to expand VM Disks"
description: "How to expand the virtual disks for CentOS and Debian VMs"
date: 2021-02-20T17:15:17+01:00
draft: false
TocOpen: true
tags:
categories:
- how-to
- VM
- Proxmox
---
This post will set out to explain how you can increase the disk size of a virtual disk inside a VM after increasing its size in your hypervisor.
It does assume some familiarity with Linux and partitioning.
Its is mainly aimed at [CentOS](#centos) and [Debian](#debian). Though this should also be relevant if you are using the same disk technologies.
Those being LVM+XFS for the CentOS and plain ext4 for Debian.
# CentOS
This assumes a fairly standard CentOS install that uses LVM and XFS.
## TL;DR
```shell
sudo cfdisk
sudo pvresize /dev/sda3
sudo lvextend -l 100%FREE /dev/mapper/cl-root
sudo xfs_growfs /
```
## Step 0: Hypervisor
Before doing this make sure you have expanded the disk to the desired size in your hypervisor of choice (eg. within proxmox).
## Step 1: Increase partition
Now increase the size of the root partition using something like `fdisk` or `cfdisk`. If your root partition is not the last partition this would also entail removing and re-creating your swap partition, for information on how to do that I'll refer to the [arch wiki][swap].
## Step 2: Resize Physical Volume
Now that the partition is expanded you should expand the accompanying LVM Physical Volume as follows:
```shell
pvresize /dev/sda3
```
Where `/dev/sda3` is the partition you expanded in [step 1](#step-1).
For more information on `pvresize` see its [man page][pvresize]
## Step 3: Extend Logical Volume
Now that the PV has been resized you can resize the LVM Logical Volume with `lvextend` like so:
```shell
lvextend -l 100%FREE /dev/mapper/cl-root
```
In this command the `100%FREE` refers to all remaing space of the PV and the `/dev/mapper/cl-root` should be the location of your root volume; which you can check with `lsblk` if uncertain.
Again you can check its [man page][lvextend] for any more information.
## Step 4: Grow XFS
Finally we need to expand the actual XFS filesystem, this is fairly easy luckily:
```shell
xfs_growfs /
```
`xfs_growfs` takes the mountpoint of the filesystem as its argument, which is `/` in this case.
# Debian
This assumes a fairly standard Debian install that uses ext4.
## TL;DR
```shell
sudo cfdisk
sudo pvresize /dev/sda3
sudo lvextend -l 100%FREE /dev/mapper/cl-root
sudo xfs_growfs /
```
## Step 0: Hypervisor
Before doing this make sure you have expanded the disk to the desired size in your hypervisor of choice (eg. within proxmox).
## Step 1: Recreate Partitions
Now increase the size of the root partition using something like `fdisk` or `cfdisk`.
Debian uses something called "Extended Partitions" by default which makes this a bit more difficult. Instead of simply resizing the partition you need to:
1. Note down the starting sector of the extended partition
2. Remove the extended partion
3. Recreate the extended partition now using full available size
4. Recreate the root partition
If you have any swap in the extended partition or after it you would need to recreate this as well. Some information with regards to swap can be found on the [arch wiki][swap].
## Step 2: Partprobe
Now we need to use `partprobe` the disk to make debian aware of the size change.
This is simply just doing:
```shell
sudo partprobe /dev/sda
```
where `/dev/sda` is your expanded partion.
## Step 3: Resize filesystem
Finally you can resize the actual filesystem with `resize2fs` like so:
```shell
sudo resize2fs /dev/sda5
```
where `/dev/sda5` is the partition mounted as root.
# Appendix
Some useful notes that aren't necessarily part of the rest of this how-to.
## LVM Debugging
If LVM for some reason does not like to behave these commands may come in useful:
**Listing all Logical Volumes**\
[`lvs`]
**Getting information about a specific Physical Volume**\
[`pvdisplay /dev/sda2 -m`][`pvdisplay`]
<!-- References -->
[swap]: https://wiki.archlinux.org/index.php/swap#Swap_partition
[pvresize]: https://man.archlinux.org/man/pvresize.8
[lvextend]: https://man.archlinux.org/man/lvextend.8
[`lvs`]: https://man.archlinux.org/man/lvs.8
[`pvdisplay`]: https://man.archlinux.org/man/lvdisplay.8

1
themes/PaperMod

@ -0,0 +1 @@
Subproject commit 45c4b48e53ab8b9054b6ed6da2c72b17ef4de690
Loading…
Cancel
Save