midka

Admin – Programmer – Student – Finnish – me@midka.dev

I just bought a new VPS with 2 terabytes of storage for only backup purposes. I decided to format the storage using LVM. Feel free to checkout my guide for Getting started with LVM.

Prerequisites

  • A server with debian 12
  • Storage configured at some mountpoint. I use /pbs-data.
  • root access

Add the repository GPG keys

Don't worry about the enterprise url. It's still free to use without a license. Keep in mind that you won't receive any official support.

sudo wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

Make sure that the sha512 matches. At the time of writing (05-02-2024) it is that one. Latest ones can be viewed in the documentation

sha512sum /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
7da6fe34168adc6e479327ba517796d4702fa2f8b4f0a9833f5ea6e6b48f6507a6da403a274fe201595edc86a84463d50383d07f64bdde2e3658108db7d6dc87  /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
md5sum /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
41558dc019ef90bd0f6067644a51cf5b /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

Add repositories

Add the following to /etc/apt/sources.list

deb http://download.proxmox.com/debian/pbs bookworm pbs-no-subscription

Update repositories

sudo apt update

Install proxmox-backup-server package

This will download the latest release and start the configuration process. It may ask for you to configure postfix (for sending emails) but that will be skipped in this guide. To disable postfix for now, you can select the “Local Only” option.

sudo apt install proxmox-backup-server

Conclusion

The Web UI should be accessible at https://<your server ip>:8007. Please note the https protocol and you may need to open your firewall for that port.

Next Up

I definitely recommend configuring SSL with Let's Encrypt in the Web UI. You will need to create new “datastore” which uses your mountpoint on disk for the actual backup storage. Also create new accounts and restrict their permissions to a specific datastore for every proxmox host you're going to add.

I recently had to extend a normal disk partition. It wasn't fun. That's why I recommend using LVM, it's a lot easier to manage, extend, shrink and remove partitions on a single or multiple disks.

Common Terms

Physical Volumes (PVs) are your physical disks attached to a server. These can be different sizes. That's why LVM is so flexible.

Volume Groups (VGs) are groups of PVs. For example you could have vg00 which includes PVs a, b and c.

Logical Volumes (LVs) are smaller “partitions” of VGs. You can mount these at different mount points and are easily manageable.

Example

Your server configuration:

  • Disk /dev/sda, 200GB
    • other partitions like boot
    • /dev/sda2, 199GB, PV
  • Disk /dev/sdb, 4TB
    • /dev/sdb1, 4TB, PV
  • Disk /dev/sdc, 150G
    • /dev/sdc1, 150G, PV

You can either split those into multiple VGs or combine them into one. I recommend combining them, because you can only assign a PV to single VG.

Currently your total allocatable storage for vg00 would be 4445GB. Now you can split that into one or more LVs and mount them to your system. I usually have different /, /var, /home and swap partitions.

Requirements

  • A server
  • An unused disk partition on the server
  • LVM2 installed apt install lvm2 (on debian)

Creating a PV

sudo pvcreate <disk>

Example <disk> values:

  • /dev/sdb
  • /dev/sdb1

List PVs

sudo pvs

Creating a VG

sudo vgcreate <VG name> <PVs>

Example:

  • sudo vgcreate vg00 /dev/sdb
  • sudo vgcreate vg00 /dev/sda /dev/sdb /dev/sdc1

List VGs

sudo vgs

Creating a LV

sudo lvcreate -n <name> -L <size> <VG name>

Example:

  • sudo lvcreate -n root -L 30G vg00
  • sudo lvcreate -n home -L 50G vg00
  • sudo lvcreate -n var -L 20G vg00

Formatting

You can choose any filesystem you want. I usually select ext4.

sudo mkfs.ext4 /dev/<VG name>/<LV name>

Example:

  • sudo mkfs.ext4 /dev/vg00/root

Final Steps

Now you can mount them and store files. Remember to add them to /etc/fstab in order to automatically have them mounted.

sudo mount /dev/<VG name>/<LV name> /mnt

List LVs

sudo lvs

Extend a LV

sudo lvextend -L +2G /dev/<VG name>/<LV name> -r

The -r flag automatically resizes the filesystem. If it's not provided, you need to manually run the resize2fs <volume> command.

Example:

  • sudo lvextend -L +2G /dev/vg00/root -r

Verify Changes

You can run df -h and it should show the new amount. If it still shows the old one, you can try running resize2fs /dev/<VG name>/<LV name> command.

Hi! I wanted to add comments to my writefreely blog and it was quite easy. Here are the steps for it.

  1. Create a new public github repository with discussions enabled
  2. Install the giscus github application and grant access to that repository
  3. Open giscus.app
  4. Change the settings like you want them to be! I recommend using the light theme, unless you have custom CSS in your blog.
  5. You might experience problems when trying to copy-paste the script to writefreely blog customization. For security writefreely sanitizes any <script> tags. However we can use a workaround:

    Place the following code to the custom CSS section

    </style>
    
    script here
    
    <style type="text/css">
    

    It will throw syntax errors in the editor, but you can ignore those. It will still work :)

  6. And now the script should load. To get the comment section placed correctly you will need to include at the end of a blog post.

    <div class="giscus" ></div>
    

    Without this giscus will create the comment section in the <head> tags which can be useful if you want to hide it for specific posts.