Re-scan hard drives after a resize without rebooting

We can rescan hard drives after resize a virtual disk for a virtual machine without having to reboot the virtual machine. To do that; trigger a re-sync of the kernel for all the SCSI devices unless you know exactly which one it is connected to;

ls /sys/class/scsi_device/
echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan
echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
echo 1 > /sys/class/scsi_device/2\:0\:1\:0/device/rescan


Setting up VPN Gateway with Raspberry PI (VPN Router)

RaspberryPI VPN Gateway

The increasing availability of High-grade and  budget friendly VPS (virtual private server) services accelerated personal projects. Raspberry PI and DigitalOcean VPS helped me alot while getting my VPN Gateway (VPN Router) project done. It works in site-to-site VPN model and we are going to be able to tunnel all our LAN traffic pass trough our VPS. In this model, we are going to be able to use remote VPS‘s Internet connection.

Paid/Free VPN service providers provide very slow Internet connection in practice without any reason. By using this project, I have pushed my daily Internet traffic trough Europe based VPS servers to Turkey without feeling any slowness, for many years. According to my personal experience, below 100ms packet latency doesn’t noticeably effect web surfing experience. (more…)


Cannot connect to RDP over SSH to multiple hosts

I have several RDP over SSH connections defined in Remmina. When I connect to one, the fingerprint is stored in .freerdp/known_hosts – but for the “host” 127.0.0.1, due to the SSH tunnel.

When I try to connect to the next RDP over SSH connection, this fails with “Unable to connect to RDP server 127.0.0.1”, due to the record in known_hosts.

Unable to connect to TDP server 127.0.0.1

Seems like Remmina should allow several RDP to localhost to avoid this.

Workaround: Remove ~/.freerdp/known_hosts between each connection.

Permanent workardound:

rm .freerdp/known_hosts && ln -s /dev/null .freerdp/known_hosts

https://github.com/FreeRDP/Remmina/issues/223


Noise Problem, connecting a PC to a Hi-Fi sound system

kevlar_speakerRecently I bought a pair of Yamaha HS80M monitors for using with my desktop pc. They make sound great but when I volume up there was a very high level of deep noise. After having a short talking with my electronic engineer friend, I got the idea why the system gets noise from my pc. He told me that I should cut the ground loop in order the stop the noise.

I switched monitors plug system with non-grounded multi plug. I cut the noise circle and now there is no noise at all. In my case the ground is weak, my pc makes to much noise and I use copper sound cable.

Another noise resource can be your cable. I use BELKIN, it helps to stop environmental noise, it isolates noise with 100%-coverage aluminum/Mylar foil shield.

If you need more detailed explanation, leave a comment.


Change RedHat RHEL / Centos hostname

To change Centos or RHEL hostname, follow 3 steps below;

– edit /etc/hosts file;

127.0.0.1 subdomain.ozcan.com localhost.localdomain localhost

– edit /etc/sysconfig/network file;

HOSTNAME=subdomain.ozcan.com

– post new hostname to the kernel or restart network service;

sysctl kernel.hostname=subdomain.ozcan.com
or
echo "subdomain.ozcan.com" > /proc/sys/kernel/hostname
/etc/init.d/network restart


Ubuntu, empty trash from CLI?

To empty our trash from terminal on Ubuntu;

sudo rm -rf ~/.local/share/Trash/

for boot partititon;

sudo rm -rf /boot/.Trash-0/

Be careful while using ‘rm -rf’ as it deletes the files and directories permanently.


RHEL Disk I/O Performance Tunning

If you struggled to cope with disk I/O on virtual host machines which runs on Centos or RHEL, there is a great system performance tuning tool named TUNED, comes with different profiles.

For installing tuned;

yum install tuned -y

starting the service permanently;

service tuned start
chkconfig tuned on

service ktune start
chkconfig ktune on

status of running profile;

tuned-adm active

(more…)


Handling Leap Year Problem

I built a time counter which counts time from a specific date. But on 2012, I recognized that something goes wrong. It showed our anniversary one day earlier. After googling it, I read leap years have one additional day and, I had to change place all my code with the code supports leap years. The main coding idea for handling this problem is something like this;

var currYear = this.today.getFullYear();

if ( (currYear % 4 == 0 && currYear % 100 != 0 ) || currYear % 400 == 0 ) {
this.numOfDays = 366;
}