Skip to content

Instantly share code, notes, and snippets.

View BlacksilverConsulting's full-sized avatar

BlacksilverConsulting

View GitHub Profile
@BlacksilverConsulting
BlacksilverConsulting / pg14-systemd-PGDATA-fix.md
Created April 5, 2023 20:27
Configure PostgreSQL 14 to use an alternate PGDATA under systemd

This assumes the Ansible playbook pg14.yaml has already be run successfully. This means:

  • The PostgreSQL 14 Client and Server are already installed from the official PostgreSQL repos
  • The PostgreSQL 14 service in systemd is enabled
  • The PostgreSQL 14 service in systemd is configured to only start after autofs has started
  • A PostgreSQL 14 database cluster has been created at /var/lib/pgsql/14
  • The PostgreSQL 14 service in systemd is running

Configuring PostgreSQL 14 to use a different path for the database cluster will require undoing some of these things.

@BlacksilverConsulting
BlacksilverConsulting / raw2vhdx.md
Created March 25, 2023 03:00
Recovery Instructions for compressed raw partitions

Note: These instructions are for a specific use case and may not apply to your situation. If they help you, great! If not, support is available for $200/hr, minimum 5 hours.

  1. Decompress the .gz file with 7-Zip or similar. The result will be a single file, with no extension. (This is a raw partition image) Convert the raw partition image to the appropriate format for your hypervisor. In Windows Powershell, you can convert to Hyper-V with a command like this: & 'C:\Program Files\qemu\qemu-img.exe' convert .\lv_root-Mon -p -O vhdx lv_root-Mon.vhdx
  2. Important note: if you are doing this on an NTFS5 volume, qemu-img will automatically set the sparsefile attribute on the file. Hyper-V will not work with sparse or compressed virtual disk files. Use this PowerShell command to see if a file has the sparsefile attribute: (Get-ItemProperty -Path .\lv_root-Mon.vhdx).attributes
  3. Once the file no longer has the sparsefile attribute, you can attach it to a VM like any other .vhdx file. The process for