December 16, 2024Adding a New Drive
#
In this guide, we’ll add a new disk, and format it for use. This guide makes assumptions about drive lettering and paths, ensure you’re running things where you want to.
- Determine drive name and logical size.
- Partition drive using fdisk
fdisk /dev/sdc
# Common commands
n – Create partition
p – print partition table
d – delete a partition
q – exit without saving the changes
w – write the changes and exit.
- Create Partition using whole Block Device, defaults are fine

...
December 16, 2024Create Swap
#
In this guide, we’ll create a swap file on CentOS.
This guide will provide steps on the quickest way to create a swap file on CentOS, should work on both CentOS 7, 8 and Stream. Before proceeding with this tutorial, check if your CentOS installation already has swap enabled by typing:
- Create file
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
- Lock to root perms
- Make Swap and enable it
sudo mkswap /swapfile
sudo swapon /swapfile
- Persist on boot
sudo vi /etc/fstab
/swapfile swap swap defaults 0 0
- Change swappiness
vi /etc/sysctl.conf
vm.swappiness=10
December 16, 2024Extend a Disk
#
In this guide, we’ll expand existing disks, using GParted, as well as fdisk, including partition expansions.
Extending an LVM partition with GParted
#
Follow guide at own risk, resizing disks comes with risk, make sure you have backups. This guide assumes paths, make sure you’re running commands agains the correct drives/paths.
- Grow disk in Hypervisor
- Use Gparted to increase logical volume size
- Run
vgdisplay
- find the “VG Name”, in my sitation it’s d0 - Extend the LVM volume
lvextend -l +100%FREE /dev/d0/root
- expand the file system, either using resize2fs or xfx_growfs if using centOS and XFS
This
Or this depending on FS type
...
December 16, 2024Htaccess
#
I’ve collected some useful and some not so useful modifers that go in a htaccess file. These were made specifically for LiteSpeed webserver, which shares a lot of the same code so it should be mostly compatbile.
Force HTTPS
#
A generic rewrite to alwasy redirect a http request to https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Htaccess Redirect from old domain to new domain
#
A standard 301 reidrect, basepath /
to a new domain
...