Category Archives: Unix

The nightmare of folder and sizes in Unix systems

Finally found a nice tool to work with folder and sizes on unix systems, it’s called ncdu:

apt list --installed | grep ncdu
ncdu/bionic,now 1.12-1 amd64 [installed]

To list folder sizes just use

ncdu /example_folder/example_folder

You can exclude folders with the follwoing comand:

ncdu /example --exlude /example --exclude /example 

The output looks very nice and easy to understand:

ncdu 1.12 ~ Use the arrow keys to navigate, press ? for help 
--- /example -------------------------------------------------------------------------------------------------------------------------------------------------
449.5 GiB [##########] /example
276.3 GiB [###### ] /example
241.9 GiB [##### ] /example
100.0 KiB [ ] /.Trash-96407336
4.0 KiB [ ] README

Its possible to navigate with the arrow keys to subfolder and etc.

Nutanix CE Edition installation issues on old DELL Servers

Writing down some issues I found during the  installation of the Nutanix Community Edition on old Dell 715 and 630 Servers.

Since the controllers of this Servers does not support IT mode or Pass through I had to configure them all as RAID 0.

After that it is necessary to cancel the installation Window because the Disks are only recognized as HDDs.

r/homelab - Nutanix CE - A installation guide / startup

To cancel the install window press Shift + R and the screen session is terminated.

After that execute the following commands in order to define the SSD disks:

killall screen
#choose the drive letters which are the SSDs on your system and execute the following command for each drive.
echo 0 > /sys/block/sd?/queue/rotational

Restart the installation with the following command:

./ce_installer && screen -r

Microstack on Ubuntu 20.04

#Install Microstack
sudo snap install microstack --beta --devmode

#Microstack
#Start with Access to LVM for attached volumes
sudo microstack init --auto --control --setup-loop-based-cinder-lvm-backend --loop-device-file-size 100
# Disable
sudo snap disable microstack
# Enable
sudo snap enable microstack

#launch new Vm instance using CentOS image and VM size 2
microstack.launch --flavor 2 CentOS --name Check_MK_TEST

#Configure this on the Host so the VMs have access to the internet
sudo iptables -t nat -A POSTROUTING -s 10.20.20.1/24 ! -d 10.20.20.1/24 -j MASQUERADE
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -I FORWARD -s 10.20.20.1/24 -j ACCEPT
sudo iptables -I FORWARD -d 10.20.20.1/24 -j ACCEPT
sudo iptables -L -v -n --line-numbers
sudo iptables -L -v -n -t nat --line-numbers

#Get Admin password
sudo snap get microstack config.credentials.keystone-password

Sending an email using Curl

Here is an example of how to send an email using curl on a Unix shell:

echo "To: <email@example.com>;<email@example.com>;<email@example.com>;<email@example.com>;
Subject: Sending an Email with Curl!

Just wanted to check you were able to receive this email, sent over the curl command.
Has it gone into spam?.

Thanks.
" | curl -s --ssl-reqd smtp://example.com --mail-from 'example@example.com' --mail-rcpt 'example@example.com' --upload-file /dev/stdin

And here from a bash script:

echo -e "To: email@example.com\nSubject: Service is being restarted\n\nMaximum Service Check Attempts are reached!!!\nService is currently being restarted, this can take some time, wait until the next notification, before any action!" | /usr/bin/curl -s --ssl-reqd smtp://smtp.example.com --mail-from 'example@example.com' --mail-rcpt 'email@example.com' -n -T -