<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Homelab_Cheatsheet</id>
	<title>Homelab Cheatsheet - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=Homelab_Cheatsheet"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;action=history"/>
	<updated>2026-05-25T16:49:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;diff=2313&amp;oldid=prev</id>
		<title>Administrator at 10:33, 18 February 2026</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;diff=2313&amp;oldid=prev"/>
		<updated>2026-02-18T10:33:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;amp;diff=2313&amp;amp;oldid=1113&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Administrator</name></author>
	</entry>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;diff=1108&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 09:56, 2 March 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;diff=1108&amp;oldid=prev"/>
		<updated>2022-03-02T09:56:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== ZFS ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running a S.M.A.R.T test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Running a long test&lt;br /&gt;
smartctl -t long /dev/disk_name&lt;br /&gt;
&lt;br /&gt;
# Running a short test&lt;br /&gt;
smartctl -t short /dev/disk_name&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Checking progress of S.M.A.R.T test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
smartctl -a /dev/disk_name | grep &amp;quot;progress&amp;quot; -i -A 1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Test procedure - How long is a test going to take&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
smartctl -c /dev/disk_name&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List S.M.A.R.T result&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
smartctl -a /dev/disk_name&lt;br /&gt;
&lt;br /&gt;
# Only list SMART attributes&lt;br /&gt;
smartctl -A /dev/disk_name&lt;br /&gt;
&lt;br /&gt;
# For only viewing test result&lt;br /&gt;
smartctl -l selftest /dev/disk_name&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List all pools&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Display all information for all pools&lt;br /&gt;
zpool list&lt;br /&gt;
&lt;br /&gt;
# Display statistics for a specifik pool&lt;br /&gt;
zpool list pool_name&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Check pool status&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Check status on all pools&lt;br /&gt;
zpool status [pool_name] [-v] [-x]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clear device error&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
zpool clear pool_name device_id&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Script to find GPTID of disk in FreeNas&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
echo&lt;br /&gt;
echo $(basename $0) - Mounted Drives on $(hostname)&lt;br /&gt;
cat /etc/version&lt;br /&gt;
date&lt;br /&gt;
echo&lt;br /&gt;
diskinfo=&amp;quot;$(glabel status | tail -n +2 | awk &amp;#039;{split($3,a,&amp;quot;p&amp;quot;); print a[1],$1}&amp;#039;)&amp;quot;&lt;br /&gt;
echo    &amp;quot;+========+==========================+==================+============================================+&amp;quot;&lt;br /&gt;
echo &amp;quot;| Device |     DISK DESCRIPTION     |  SERIAL  NUMBER  |                   GPTID                    |&amp;quot;&lt;br /&gt;
echo &amp;quot;+========+==========================+==================+============================================+&amp;quot;&lt;br /&gt;
&lt;br /&gt;
for d in $(echo &amp;quot;$diskinfo&amp;quot; | cut -d&amp;quot; &amp;quot; -f 1)&lt;br /&gt;
do&lt;br /&gt;
   diskinf=$(diskinfo -v $d | grep &amp;#039;# Disk &amp;#039;)&lt;br /&gt;
   diskdescription=$(echo &amp;quot;$diskinf&amp;quot; | grep &amp;#039;# Disk desc&amp;#039; | cut -d# -f 1 | xargs)&lt;br /&gt;
   diskserialno=$(echo &amp;quot;$diskinf&amp;quot; | grep &amp;#039;# Disk ident&amp;#039; | cut -d# -f 1 | xargs)&lt;br /&gt;
   diskgptid=$(echo &amp;quot;$diskinfo&amp;quot; | grep &amp;quot;^$d&amp;quot; | cut -d&amp;quot; &amp;quot; -f 2)&lt;br /&gt;
   printf &amp;quot;| %-6s | %-24s | %-16s | %-42s |\n&amp;quot; &amp;quot;$d&amp;quot; &amp;quot;$diskdescription&amp;quot;     &amp;quot;$diskserialno&amp;quot; &amp;quot;$diskgptid&amp;quot;&lt;br /&gt;
   echo &amp;quot;+--------+--------------------------+------------------+--------------------------------------------+&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
How to test hdd before using them in prod. The &amp;#039;standard&amp;#039; test routine is SMART tests, badblocks, then another SMART. Let each one finish before starting the next.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Time to finish 2-3 minutes on a 10TB disk&lt;br /&gt;
smartctl -t short /dev/adaX&lt;br /&gt;
&lt;br /&gt;
# 16-17 hours on a 10TB disk&lt;br /&gt;
smartctl -t long /dev/adaX&lt;br /&gt;
&lt;br /&gt;
# 5 days on a 10TB disk&lt;br /&gt;
badblocks -ws -b 4096 /dev/adaX&lt;br /&gt;
&lt;br /&gt;
smartctl -t long /dev/adaX&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Rclone ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy file from source to dest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rclone copy source:path dest:destpath&lt;br /&gt;
&lt;br /&gt;
# Example - This will copy all the contet from D: drive to secret_folder&lt;br /&gt;
rclone copy D: secret:secret_folder&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Batch script for copying files from source to dest when config have password set. Windows and powershell. [https://forum.rclone.org/t/how-to-use-rclone-password-command-with-windows-powershell-for-config-password/15950 Courtesy of pg1.]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Generate your secure password to a disk file (for the purprose of this example, U:\rcpw.txt):&lt;br /&gt;
&lt;br /&gt;
Read-Host -Prompt &amp;#039;Enter rclone configuration password&amp;#039; -AsSecureString | ConvertFrom-SecureString | Out-File -FilePath U:\rcpw.txt&lt;br /&gt;
&lt;br /&gt;
# Create a Powershell script (for the purpose of this example, C:\xx\rcpw.ps1) to return the decrypted password from the file you created in the previous step (notice how this file is referenced in the -Path parameter). Contents of C:\xx\rcpw.ps1:&lt;br /&gt;
&lt;br /&gt;
(New-Object -TypeName PSCredential -ArgumentList @( &amp;#039;user&amp;#039;, ((Get-Content -Path U:\rcpw.txt) | ConvertTo-SecureString))).GetNetworkCredential().Password&lt;br /&gt;
&lt;br /&gt;
# Test it:&lt;br /&gt;
&lt;br /&gt;
rclone -vv --password-command &amp;quot;powershell C:\xx\rcpw.ps1&amp;quot; about Secretplex:&lt;br /&gt;
&lt;br /&gt;
# Once this works, you can default the password-command parameter via setting the environment variable RCLONE_PASSWORD_COMMAND to:&lt;br /&gt;
&lt;br /&gt;
powershell C:\xx\rcpw.ps1&lt;br /&gt;
&lt;br /&gt;
# Use --password-command in your batch file&lt;br /&gt;
&lt;br /&gt;
C:\rclone-v1.53.2\rclone.exe -v --password-command &amp;quot;powershell C:\rclone-v1.53.2\rcpw.ps1&amp;quot; copy A: Secretplex:A --log-file C:\rclone-v1.53.2\RcloneLogFile\RcloneA.txt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Elastic Stack ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Test filebeat can connect to the output by using the current settings&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
filebeat test output&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Test filebeat configuration settings&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
filebeat test config&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify logstash config&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo -u logstash /usr/share/logstash/bin/logstash --path.settings /etc/logstash -t&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List elasticsearch indexes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# List indexes&lt;br /&gt;
curl localhost:9200/_cat/indices?v&lt;br /&gt;
&lt;br /&gt;
# List indexes with username and pass&lt;br /&gt;
curl -u username:passord localhost:9200/_cat/indices?v&lt;br /&gt;
&lt;br /&gt;
# Delete index&lt;br /&gt;
curl -XDELETE localhost:9200/shop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Netplan ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set static IP for host - example&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# This file describes the network interfaces available on your system&lt;br /&gt;
# For more information, see netplan(5).&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    enp0s3:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses: [192.168.1.222/24]&lt;br /&gt;
     gateway4: 192.168.1.1&lt;br /&gt;
     nameservers:&lt;br /&gt;
       addresses: [8.8.8.8,8.8.4.4]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Snort ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Test Snort config&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
snort -c /usr/local/etc/snort/snort.lua&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Storage analyzer on linux ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find what&amp;#039;s using storage on a Linux system, you can use various commands to analyze disk usage. Here are some commonly used commands:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; command: The &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; (disk free) command shows the disk space usage of file systems. It displays information about mounted filesystems, their sizes, used space, available space, and mount points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
df -h&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-h&amp;lt;/code&amp;gt; option makes the output human-readable with sizes in &amp;quot;KB,&amp;quot; &amp;quot;MB,&amp;quot; &amp;quot;GB,&amp;quot; etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;du&amp;lt;/code&amp;gt; command: The &amp;lt;code&amp;gt;du&amp;lt;/code&amp;gt; (disk usage) command is used to estimate file and directory space usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the disk usage of the current directory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
du -h&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the disk usage of a specific directory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
du -h /path/to/directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;ncdu&amp;lt;/code&amp;gt; command (NCurses Disk Usage): &amp;lt;code&amp;gt;ncdu&amp;lt;/code&amp;gt; is a more advanced disk usage analyzer with a text-based user interface. It provides a more detailed and interactive view of disk usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To install ncdu on Ubuntu/Debian:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt update&lt;br /&gt;
sudo apt install ncdu&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use ncdu:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ncdu /path/to/directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;lsof&amp;lt;/code&amp;gt; command (List Open Files): The &amp;lt;code&amp;gt;lsof&amp;lt;/code&amp;gt; command can be used to list all open files and the processes that are using them. This can be useful to identify processes that might be holding onto large log files or other data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo lsof | grep deleted&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This command will list files marked as &amp;quot;(deleted)&amp;quot; that are still held open by processes. These files may not be visible in the file system but are still using disk space until the processes release them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; command: The &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; command can be used to search for files based on various criteria, including size.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To find large files in a directory:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
find /path/to/directory -type f -size +1G&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will list all files larger than 1GB in the specified directory.&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;br /&gt;
[[Category:HomeLab]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
	<entry>
		<id>https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;diff=1113&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 09:56, 2 March 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=Homelab_Cheatsheet&amp;diff=1113&amp;oldid=prev"/>
		<updated>2022-03-02T09:56:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:56, 2 March 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-1108:rev-1113 --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>