<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>VIONBLOG</title>
	<atom:link href="http://www.vionblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.vionblog.com/</link>
	<description>Giving back to the community</description>
	<lastBuildDate>Thu, 17 Dec 2020 16:30:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<atom:link rel='hub' href='https://www.vionblog.com/?pushpress=hub'/>
	<item>
		<title>ESXi Add Static Route using esxcli</title>
		<link>https://www.vionblog.com/esxi-add-static-route-using-esxcli/</link>
					<comments>https://www.vionblog.com/esxi-add-static-route-using-esxcli/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Sat, 07 Mar 2020 18:07:31 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[VMware]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=2088</guid>

					<description><![CDATA[I was doing some workaround with ESXi networks and I had to add static route to my ESXi hosts. And now if I want to Add static Route to ESXi I can browse my own blog instead of searching on the internet. This is done on VMware 6.5, but it should work on 6.7 also. [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>I was doing some workaround with ESXi networks and I had to add static route to my ESXi hosts. And now if I want to Add static Route to ESXi I can browse my own blog instead of searching on the internet.</p>



<p>This is done on VMware 6.5, but it should work on 6.7 also.</p>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">ESXi Add Static Route</h2>



<p>The command to add static route to your ESXi host is like this:</p>



<pre class="wp-block-preformatted">esxcli network ip route ipv4/ipv6 add -n<em> IPv4_network/mask</em> -g <em>IPv4_gateway_ip</em></pre>



<pre class="wp-block-preformatted"> Usage: esxcli network ip route ipv4 add [cmd options]
 Description:
   add                   Add IPv4 route to the VMkernel.
 Cmd options:
   -g|--gateway=    The Ipv4 address of the gateway through which a route to be added. (required)
   -N|--netstack=   The network stack instance; if unspecified, use the default netstack instance
   -n|--network=    The Ipv4 address and prefix length of the network to add the route to. Specify 'default' to indicate the default network. (required)</pre>



<p>Example adding network 10.90.20.0/23 with gateway 10.92.20.5</p>



<pre class="wp-block-preformatted">esxcli network ip route ipv4 add -n 10.90.20.0/23 -g 10.92.20.5</pre>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">ESXi List Routes</h2>



<p>The command to list ESXi host routes is like this:</p>



<pre class="wp-block-preformatted">esxcli network ip route ipv4 list</pre>



<p>You should get output similar to this:</p>



<pre class="wp-block-preformatted">[root@esx05:~] esxcli network ip route ipv4 list
 Network        Netmask          Gateway        Interface  Source
 -------------  ---------------  -------------  ---------  ------
 default        0.0.0.0          xxx.xxx.xxx.1  vmk0       DHCP
 10.90.20.0     255.255.254.0    10.92.20.5     vmk1       MANUAL
 10.92.20.0     255.255.254.0    0.0.0.0        vmk1       MANUAL
 xxx.xxx.xxx.0  255.255.255.192  0.0.0.0        vmk0       MANUAL
 [root@esx05:~]</pre>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">ESXi Remove Static Route</h2>



<p>The command to remove static route to your ESXi host is like this: </p>



<pre class="wp-block-preformatted">esxcli network ip route ipv4 remove -n IPv4_network/mask -g IPv4_gateway_ip</pre>



<pre class="wp-block-preformatted">Usage: esxcli network ip route ipv4 remove [cmd options]
 Description:
   remove                Remove IPv4 route
 Cmd options:
   -g|--gateway=    The Ipv4 address of the gateway through which a route to be removed (required)
   -N|--netstack=   The network stack instance; if unspecified, use the default netstack instance
   -n|--network=    The Ipv4 address and prefix length of the network to remove the route from. Specify 'default' to indicate the default network. (required)</pre>



<p>Example of removing previously added 10.90.20.0/23 with gateway 10.92.20.5</p>



<pre class="wp-block-preformatted">esxcli network ip route ipv4 remove -n 10.90.20.0/23 -g 10.92.20.5</pre>



<hr class="wp-block-separator"/>



<p><strong>VMware KB</strong>:  <a href="https://kb.vmware.com/s/article/2001426">https://kb.vmware.com/s/article/2001426</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/esxi-add-static-route-using-esxcli/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Crontab Job in Linux (Explained)</title>
		<link>https://www.vionblog.com/crontab-job-in-linux/</link>
					<comments>https://www.vionblog.com/crontab-job-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Sat, 25 Jan 2020 20:59:46 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[Linux]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=2043</guid>

					<description><![CDATA[In this tutorial we are going to explain how to setup Crontab Job in Linux, with all of the options and real world examples. The cron software utility is a job scheduler in Unix-like operating systems which is driven by the crontab (cron table) file located in the /etc directory. These periodic jobs are also [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial we are going to explain how to setup Crontab Job in Linux, with all of the options and real world examples.</p>



<p>The cron software utility is a job scheduler in Unix-like operating systems which is driven by the crontab (cron table) file located in the /etc directory. </p>



<p>These periodic jobs are also known as Cron Jobs and are scheduled to run on specific time. We can use Crontab Jobs in Linux for <a href="https://www.vionblog.com/mysql-backup-restore/">MySQL Backups</a>,  system monitoring, <a href="https://www.vionblog.com/linux-delete-files-older-than-x-days/">delete files older then x days</a> and a lot more.</p>



<hr class="wp-block-separator"/>



<p>Each line in the crontab file is a new cron job and uses this <span style="text-decoration: underline;">cron job format</span>:</p>



<pre class="wp-block-preformatted"># ┌───────────── minute (0 - 59) 
# │ ┌───────────── hour (0 - 23) 
# │ │ ┌───────────── day of the month (1 - 31) 
# │ │ │ ┌───────────── month (1 - 12) 
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; 
# │ │ │ │ │                                   7 is also Sunday on some systems) 
# │ │ │ │ │ 
# │ │ │ │ │ 
# * * * * * command to execute </pre>



<p>There are also special characters that you can use:</p>



<ul class="wp-block-list"><li><strong>star</strong> (<strong> * </strong>) &#8211; means every. For example if in minute means every menute</li><li><strong>comma</strong> ( <strong>, </strong>) &#8211;  are used to separate items of a list. For example, using &#8220;MON,WED,FRI&#8221; in the 5th field (day of week) means Mondays, Wednesdays and Fridays. </li><li><strong>Minus sign</strong> ( <strong>&#8211; </strong>) &#8211;  defines ranges. For example, 2000-2010 indicates every year between 2000 and 2010, inclusive.  </li><li><strong>Slash</strong> (<strong> /</strong> ) &#8211;  slashes can be combined with ranges to specify step values.  For example,&nbsp;*/5&nbsp;in the minutes field indicates every 5 minutes </li></ul>



<p>We also have some macros that you can use without remembering the table above:</p>



<figure class="wp-block-table is-style-stripes"><table class=""><thead><tr><th> <strong>Entry</strong>  </th><th> <strong>Description</strong>  </th><th>  <strong>Equivalent to</strong>  </th></tr></thead><tbody><tr><td> @yearly (or @annually)</td><td> Run once a year at midnight of 1 January</td><td>0 0 1 1 *</td></tr><tr><td>@monthly</td><td>Run once a month at midnight of the first day of the month</td><td>0 0 1 * *</td></tr><tr><td>@weekly</td><td>Run once a week at midnight on Sunday morning</td><td>0 0 * * 0</td></tr><tr><td>@daily (or @midnight)</td><td>Run once a day at midnight</td><td>0 0 * * *</td></tr><tr><td>@hourly</td><td>Run once an hour at the beginning of the hour</td><td>0 * * * *</td></tr><tr><td>@reboot</td><td>Run at startup</td><td>N/A</td></tr></tbody></table></figure>



<hr class="wp-block-separator"/>



<p>To list all cron jobs for the user you are logged in you can issue crontab -l command</p>



<pre class="wp-block-preformatted">crontab -l</pre>



<p>To edit a crontab job in linux or add a new one you need to add -e at the end of crontab command</p>



<pre class="wp-block-preformatted">crontab -e</pre>



<p>If this is a first time you will be asked to choose a default editor when editing cron jobs, my choice is vim.nox but you can choose your preferred.</p>



<pre class="wp-block-preformatted">no crontab for vionsoft - using an empty one
 Select an editor.  To change later, run 'select-editor'.
 /bin/ed
 /bin/nano        &lt;---- easiest
 /usr/bin/vim.nox
 /usr/bin/vim.tiny 
 Choose 1-4 [2]: 3</pre>



<p>This is the default crontab file for a user and at the end you need to append your crontab scheduler command</p>



<pre class="wp-block-preformatted"># Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
* * * * * command_to_execute_every_minute</pre>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">Stop crontab from sending emails</h2>



<p>If you don&#8217;t want to receive emails from your crontab jobs you need to append <strong>&gt; /dev/null 2&gt;&amp;1</strong> at the end of each line. If you want to receive only errors append only <strong>&gt; /dev/null</strong></p>



<p><em>Don&#8217;t receive any email</em></p>



<pre class="wp-block-preformatted"># Redirect STDOUT and STDERR to /dev/null
* * * * * command_to_execute_every_minute &gt; /dev/null 2&gt;&amp;1 </pre>



<p><em>Receive only email from STDERR (Errors)</em></p>



<pre class="wp-block-preformatted"> # Redirect only STDOUT to /dev/null
* * * * * command_to_execute_every_minute &gt; /dev/null </pre>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">Crontab Job in Linux examples</h2>



<hr class="wp-block-separator"/>



<h3 class="wp-block-heading">cron job every 5 minutes</h3>



<pre class="wp-block-preformatted"># executed: every 5 minutes, every hour, every day, every month, every year 
*/5 * * * * /home/user/scripts/myscript.sh</pre>



<hr class="wp-block-separator"/>



<h3 class="wp-block-heading">cron job every hour between 10:00 and 14:00</h3>



<pre class="wp-block-preformatted"># executed: 10:15, 11:15, 12:15, 13:15, 14:15, every day, every month, every year
15 10-14 * * * /home/user/scripts/myscript.sh</pre>



<hr class="wp-block-separator"/>



<h3 class="wp-block-heading">cron job every Sunday 5 minutes after midnight</h3>



<pre class="wp-block-preformatted"># executed: every Sunday, 5 minutes after midnight, every month, every year
5 0 * * SUN /home/user/scripts/myscript.sh</pre>



<hr class="wp-block-separator"/>



<h3 class="wp-block-heading">cron job Monday through Friday at 1:00AM</h3>



<pre class="wp-block-preformatted"># executed: Monday 1AM, Tuesday 1AM, Wednesday 1AM, Thursday 1AM, Friday 1AM, every month, every year
0 1 * * 1-5 /home/user/scripts/myscript.sh</pre>



<hr class="wp-block-separator"/>



<p>Finally, if you are lazy to memorize all of this there is a website that will help you create a cron job in linux with the specific parameters you need</p>



<p><strong>Cron Job Examples</strong>:  <a href="https://crontab.guru/examples.html">https://crontab.guru/examples.html</a>  </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/crontab-job-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fix: 413 Request Entity Too Large on Nginx</title>
		<link>https://www.vionblog.com/fix-413-request-entity-too-large-on-nginx/</link>
					<comments>https://www.vionblog.com/fix-413-request-entity-too-large-on-nginx/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Fri, 17 Jan 2020 00:05:22 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nginx]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=2007</guid>

					<description><![CDATA[This is a Fix for 413 Request Entity Too Large on nginx server and an optional PHP configuration on how to Increase Upload File Size Limit. This problem occurs when you have fresh new server installs with nginx and PHP for me with WordPress installs lately, everyone wants their own Cloud VPS, but there is [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This is a Fix for 413 Request Entity Too Large on nginx server and an optional PHP configuration on how to Increase Upload File Size Limit.</p>



<p>This problem occurs when you have fresh new server installs with nginx and PHP for me with WordPress installs lately, everyone wants their own Cloud VPS, but there is no-one to manage it or install it.</p>



<p>The <span style="text-decoration: underline;">413 Request Entity Too Large</span> indicates that your nginx server is not configured to accept file with the size you are trying to upload. The parameter is the nginx <strong>client_max_body_size</strong> which has the default value of 1MB. </p>



<p>Here are the <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size">official nginx docs on  client_max_body_size</a> if you exceed this size you will see this image</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img fetchpriority="high" decoding="async" width="640" height="127" src="https://www.vionblog.com/wp-content/uploads/2020/01/413-Request-Entity-Too-Large-640x127.png" alt="413 Request Entity Too Large" class="wp-image-2011" srcset="https://www.vionblog.com/wp-content/uploads/2020/01/413-Request-Entity-Too-Large-640x127.png 640w, https://www.vionblog.com/wp-content/uploads/2020/01/413-Request-Entity-Too-Large-300x59.png 300w, https://www.vionblog.com/wp-content/uploads/2020/01/413-Request-Entity-Too-Large-768x152.png 768w, https://www.vionblog.com/wp-content/uploads/2020/01/413-Request-Entity-Too-Large.png 950w" sizes="(max-width: 640px) 100vw, 640px" /></figure></div>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">nginx client_max_body_size configuration</h2>



<p>You have 2 options here, you can set it globally or per website. </p>



<p>1. Open /etc/nginx/nginx/conf and under http {} add the following lines</p>



<pre class="wp-block-preformatted">vi /etc/nginx/nginx.conf</pre>



<pre class="wp-block-preformatted">http {
    ......
    #set client body size to 20M
    client_max_body_size 20M;
    .....
}</pre>



<p>2. Open /etc/nginx/sites-available/yourwebsite.conf and under server {} add the following lines</p>



<pre class="wp-block-preformatted">server {
    #set client body size to 20M
    client_max_body_size 20M;
    .....
    listen 80;
    server_name yourwebsite.com;
    .....
}</pre>



<p>Please be aware that browsers cannot correctly display this error. Setting&nbsp;<code><em>size</em></code>&nbsp;to 0 disables checking of client request body size. </p>



<p>Now check nginx configuration and restart the server if everything is OK</p>



<pre class="wp-block-preformatted">nginx -t</pre>



<p>You need to get</p>



<pre class="wp-block-preformatted">nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful</pre>



<p>Now restart nginx server</p>



<pre class="wp-block-preformatted">systemctl reload nginx.service </pre>



<p>You are done with your nginx configuratioon</p>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading">PHP configuration</h2>



<p>Now that you have your nginx server to accept  client request body of 20MB you need to increase some values in your PHP configuration file. Edit your /etc/php/7.0/fpm/php.ini and change the following values:</p>



<pre class="wp-block-preformatted">vi /etc/php/7.0/fpm/php.ini</pre>



<pre class="wp-block-preformatted">; Maximum allowed size for uploaded files.
 ; http://php.net/upload-max-filesize
 upload_max_filesize = 20M

 ; Maximum size of POST data that PHP will accept.
 ; Its value may be 0 to disable the limit. It is ignored if POST data reading
 ; is disabled through enable_post_data_reading.
 ; http://php.net/post-max-size
 post_max_size = 20M</pre>



<p>Now restart your PHP-FPM process and you are done</p>



<pre class="wp-block-preformatted"> systemctl restart php7.0-fpm.service </pre>



<p>After these modifications you should be able to upload files with <strong>MAX size of 20MB</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/fix-413-request-entity-too-large-on-nginx/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Setup MySQL Master-Slave Replication on Ubuntu with Existing Data</title>
		<link>https://www.vionblog.com/setup-mysql-master-slave-replication-ubuntu-existing-data/</link>
					<comments>https://www.vionblog.com/setup-mysql-master-slave-replication-ubuntu-existing-data/#comments</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Sun, 01 Dec 2019 19:52:17 +0000</pubDate>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1749</guid>

					<description><![CDATA[MySQL Master-Slave Replication is a procedure that is replicating or in other words copying the databases from one (Master) server to other (Slave) servers in the network. It can be useful for having multiple read replicas (that I plan to use in the future as my server grows) or have it as a place to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>MySQL Master-Slave Replication is a procedure that is replicating or in other words copying the databases from one (Master) server to other (Slave) servers in the network. It can be useful for having multiple read replicas (that I plan to use in the future as my server grows) or have it as a place to do backups.</p>
<p>As I have my Master server in place, it&#8217;s a production server with data on it, it&#8217;s a Virtual Server running Ubuntu 16.04 LTS and MySQL 5.7 with sufficient RAM memory and vCPU cores running on SSD drives. The server is starting to be used all day long and I can&#8217;t find a suitable time when I can do my backups, so from now on, I can do my backup jobs on my Slave server anytime I want.</p>
<p>In my current setup I have my Master MySQL server <strong>mysql01</strong> and my Slave MySQL server <strong>mysql02 </strong>which is in another datacenter</p>
<pre>mysql01 IP: 10.90.21.16
mysql02 IP: 10.91.21.21</pre>
<hr />
<h2>Master server setup</h2>
<p>You will need to <strong>plan for downtime</strong> because we will need to take a consistent snapshot of the databases for which we will need to put the server into a read-only mode.</p>
<h3>1. Update the configuration file</h3>
<p>Edit: <strong>/etc/mysql/mysql.conf.d/mysqld.cnf </strong>and under <strong>[mysqld] </strong>uncomment or add the following lines</p>
<pre>[mysqld]
bind-address = 10.90.21.16
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log</pre>
<p>This will make the database server listen on private IP, set server-id which should be unique among all Master and Slave nodes and enable binary logging. Some of this you should already have but let&#8217;s check it once again.</p>
<h3>2. Restart for services to be effective</h3>
<pre>systemctl restart mysql</pre>
<h3>3. Create Replication User</h3>
<pre>root@mysql01:~# mysql -u root -p
Enter password: 

mysql&gt; CREATE USER 'repl'@'10.91.21.21' IDENTIFIED BY 'Sl@v3p@$$';
Query OK, 0 rows affected (0.00 sec)

mysql&gt; GRANT REPLICATION SLAVE ON *.* TO 'repl'@'10.91.21.21';
Query OK, 0 rows affected (0.00 sec)</pre>
<p>This will create a dedicated repl user for the Slave server IP address 10.91.21.21 and we will give privileges for REPLICATION SLAVE. Remember to change 10.91.21.21 with your Slave server IP address.</p>
<h3>4. Lock the Master Server Databases</h3>
<pre>mysql&gt; FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.22 sec)</pre>
<p>This will lock ALL tables with READ-ONLY flag and during the lock we need to create a consistent snapshot of the database so we can bootstrap the Slave server later on. Remember this will lock all INSERT and UPDATE queries.</p>
<p>Lock will be released when you exit the MySQL CLI or issue UNLOCK TABLES. Keep the lock until you finish the mysqldump.</p>
<h3>5. Master Replication log position</h3>
<pre>mysql&gt; SHOW MASTER STATUS;
+------------------+-----------+--------------+------------------+-------------------+
| File             | Position  | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+-----------+--------------+------------------+-------------------+
| mysql-bin.003577 | 141378624 |              |                  |                   |
+------------------+-----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)</pre>
<p>Write the <span style="text-decoration: underline;">File</span> and the <span style="text-decoration: underline;">Position</span> values, you will need them later when you initialize the Slave replication.</p>
<h3>6. DUMP the Master server databases</h3>
<pre>mysqldump -uroot -p --all-databases --single-transaction --triggers --routines &gt; dump.sql</pre>
<p>This will dump all the databases into a single dump.sql file. You can check my <a href="https://www.vionblog.com/mysql-backup-restore/">MySQL Backup and Restore</a> post regarding the backup and restore commands.</p>
<h3>7. Unlock the databases on the Master server</h3>
<pre>mysql&gt; UNLOCK TABLES;
Query OK, 0 rows affected (0.00 sec)</pre>
<p><span style="text-decoration: underline;"><strong>WAIT</strong></span> until your backup from step 6 has finished before issuing this command. After this, your Master server will be fully operational.</p>
<h3>8. Transfer the data to the Slave server</h3>
<pre>root@mysql01:~# $ scp dump.sql 10.91.21.21:/tmp</pre>
<p>This will transfer the data from the Master server to the Slave server and we can jump and configure the Slave server.</p>
<p>You can even have a break at this point.</p>
<hr />
<h2>Slave Server Setup</h2>
<p>As with the Master server we need to make few adjustments with the Slave server, restore the databases and start the Replication process.</p>
<h3>1. Update the configuration file</h3>
<p>Edit: <strong>/etc/mysql/mysql.conf.d/mysqld.cnf </strong>and under <strong>[mysqld] </strong>uncomment or add the following lines</p>
<pre>[mysqld]
bind-address = 10.91.21.21
server-id = 2
log_bin = /var/log/mysql/mysql-bin.log</pre>
<p>Like the Master server above we need to make the server listen on it&#8217;s private IP, set server-id to a unique value (in our case 2) and enable binary logging.</p>
<h3>2. Restart for services to be effective</h3>
<pre>systemctl restart mysql</pre>
<h3>3. Import the dump file</h3>
<pre>root@mysql02:~# mysql -u root -p &lt; /tmp/dump.sql</pre>
<h3>4. Setup the slave to communicate with the Master</h3>
<pre>root@mysql02:~# mysql -u root -p

mysql&gt; STOP SLAVE;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql&gt; CHANGE MASTER TO
    -&gt; MASTER_HOST='10.90.21.16',
    -&gt; MASTER_USER='repl',
    -&gt; MASTER_PASSWORD='Sl@v3p@$$',
    -&gt; MASTER_LOG_FILE='mysql-bin.003577',
    -&gt; MASTER_LOG_POS=141378624;
Query OK, 0 rows affected, 2 warnings (0.01 sec)

mysql&gt; START SLAVE;
Query OK, 0 rows affected (0.00 sec)</pre>
<p>Change the Master Host, Password, Log file and Log Position with <strong>YOUR VALUES</strong>.</p>
<hr />
<h2>Check if replication is working</h2>
<p>To see if your configuration is working you need to connect on your Slave server and issue <strong>SHOW SLAVE STATUS\G</strong></p>
<pre>mysql&gt; SHOW SLAVE STATUS\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.90.21.16
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.003577
          Read_Master_Log_Pos: 229958895
               Relay_Log_File: mysql02-relay-bin.000002
                Relay_Log_Pos: 11083560
        Relay_Master_Log_File: mysql-bin.003577
             Slave_IO_Running: Yes &lt;-- Imporant
            Slave_SQL_Running: Yes &lt;-- Imporant
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 152461864
              Relay_Log_Space: 88580800
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 1575 &lt;-- Imporant
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: ee9774f5-8552-11e8-b6cb-00505684dbd9
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: System lock
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
1 row in set (0.00 sec)</pre>
<p>From all this data there are few parameters you need to check, <strong>Slave_IO_Running</strong> and <strong>Slave_SQL_Running</strong> should be <strong>Yes</strong>, and since I had a break before setting up the Slave I have <strong>Seconds_Behind_Master: 1575</strong> Wait for this parameter to be 0 which indicates that the Slave is not behind the Master with the data.</p>
<p><strong>MySQL Replication Chapter:</strong> <a href="https://dev.mysql.com/doc/refman/5.7/en/replication.html">https://dev.mysql.com/doc/refman/5.7/en/replication.html</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/setup-mysql-master-slave-replication-ubuntu-existing-data/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Patch VMware ESXi using esxcli from Online repository</title>
		<link>https://www.vionblog.com/patch-vmware-esxi-using-esxcli-online-repository/</link>
					<comments>https://www.vionblog.com/patch-vmware-esxi-using-esxcli-online-repository/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Thu, 27 Jun 2019 11:46:42 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[VMware]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1727</guid>

					<description><![CDATA[Every time you are asking the manufacturer for support when something is not working as you want, you will be asked if you have updated the software with the latest patches. Because I have just a few hosts I will be using the command line esxcli software profile update If you have more hosts and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Every time you are asking the manufacturer for support when something is not working as you want, you will be asked if you have updated the software with the latest patches. Because I have just a few hosts I will be using the command line <em>esxcli software profile update</em></p>
<p>If you have more hosts and vCener installed you can leverage <strong>VMware Update Manager</strong> (<strong>VUM</strong>) which can orchestrate the patching across your cluster where it goes and puts the host in maintenance mode, evacuates VMs via vMotion automatically each time a host within cluster needs to be patched.</p>
<hr />
<h2>Enable SSH on ESXi</h2>
<p>In vSpere Web Client click on the server you want to enable SSH and go to <strong>Configure -&gt; System -&gt; Security Profile</strong> and click <strong>Edit</strong>. Follow the steps on the picture below.</p>
<p><img decoding="async" class="aligncenter size-large wp-image-1703" src="https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-640x309.png" alt="VMware Enable SSH" width="640" height="309" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-640x309.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-300x145.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-768x371.png 768w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH.png 1290w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<hr />
<h2>Enter maintenance mode</h2>
<p>You should shutdown all Virtual machines on the selected host or migrate them to a different host before you put the selected host for patching into maintenance mode.</p>
<p>SSH into your host and type the following command</p>
<pre>vim-cmd hostsvc/maintenance_mode_enter</pre>
<hr />
<h2>Open firewall ports</h2>
<p>You must enable internet access to HTTPS on your VMware host to be able to search and download the latest patches from VMware vib repository.</p>
<pre>esxcli network firewall ruleset set -e true -r httpClient</pre>
<hr />
<h2>Search the latest VMware ESXi patches</h2>
<p>The main command to list all the patches in the <span style="text-decoration: underline;">VMware vib repository</span> you can use this command:</p>
<pre>esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml</pre>
<p>So to be able to find the patch you need,  you have to use grep and specify the version and the last year: <strong>grep ESXi-version-year</strong></p>
<p>For <strong>ESXi 6.5</strong> in <strong>2019</strong> use the following command</p>
<pre>esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-6.5.0-2019</pre>
<p>For <strong>ESXi 6.7</strong> in <strong>2019</strong> use the following command</p>
<pre>esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-6.7.0-2019</pre>
<hr />
<h2>Patching ESXi</h2>
<p>Now you can install the latest patch in the time I&#8217;m writing this it&#8217;s the patch from May 2019 ESXi-6.5.0-20190504001-standard</p>
<pre>esxcli software profile update -p ESXi-6.5.0-20190504001-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml</pre>
<p>There are two commands <em>profile update</em> and <em>profile install</em>, update keeps custom drivers and install does not. I&#8217;m always using the <strong>profile update</strong> command.</p>
<p>Now I have the update result message that the update was successful and I need to reboot my host:</p>
<pre>Update Result
 Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
 Reboot Required: true</pre>
<hr />
<h2>Cleaning commands</h2>
<p>You will need to <strong>ENABLE SSH</strong> on the host again because it is disabled by default after the reboot, If you forgot how see the image above.</p>
<p>As the message above told us we need to reboot the host in order for the changes to be effective</p>
<pre>reboot</pre>
<p>After the reboot we are going to close HTTPS access for the host machine from the VMware firewall</p>
<pre>esxcli network firewall ruleset set -e false -r httpClient</pre>
<p>And exit maintenance mode</p>
<pre>vim-cmd hostsvc/maintenance_mode_exit</pre>
<hr />
<p>Now start your Virtual Machines and visit this tutorial in a few months when you will need to update your hosts again :)</p>
<p>Also, don’t forget to <strong>DISABLE SSH</strong> on your VMware hosts.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/patch-vmware-esxi-using-esxcli-online-repository/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ESXi 6.5 SNMP Configuration</title>
		<link>https://www.vionblog.com/esxi-6-5-snmp-configuration/</link>
					<comments>https://www.vionblog.com/esxi-6-5-snmp-configuration/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Tue, 21 May 2019 16:49:12 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[VMware]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1719</guid>

					<description><![CDATA[ESXi SNMP configuration is one of those things everyone knows it, doing it once in a while and Google&#8217;s it every time. As our infrastructure grows we need to add a monitoring system to know what is going on on our servers, where is out bottleneck and when it&#8217;s time to add new hardware. There [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>ESXi SNMP configuration is one of those things everyone knows it, doing it once in a while and Google&#8217;s it every time. As our infrastructure grows we need to add a monitoring system to know what is going on on our servers, where is out bottleneck and when it&#8217;s time to add new hardware.</p>
<p>There is a lot of monitoring software out there and most of them are using the old SNMP protocol for the basic monitoring tasks. So, for us to be able to monitor our VMware hosts we need to enable SNMP and allow connection through the&nbsp;ESX firewall.</p>
<p>We are going to use the CLI to enable SNMP in ESXi so we need to Enable SSH, Configure SNMP, Enable SNMP on ESXi firewall</p>
<hr />
<h2>Enable SSH on ESXi</h2>
<p>In vSpere Web Client click on the server you want to enable SSH and go to Configure -&gt; System -&gt; Security Profile and click Edit. Follow the steps on the picture below.</p>
<p><img decoding="async" class="aligncenter size-large wp-image-1703" src="https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-640x309.png" alt="VMware Enable SSH" width="640" height="309" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-640x309.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-300x145.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-768x371.png 768w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH.png 1290w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<hr />
<h2>ESXi SNMP Configuration</h2>
<p>Login into VMware host using SSH and root credentials, then set community string that you are going to use, and enable SNMP service.</p>
<pre>esxcli system snmp set --communities YOUR_COMMUNITY_STRING
esxcli system snmp set --enable true</pre>
<p>Replace&nbsp;<strong>YOUR_COMMUNITY_STRING</strong> with the Community string you are going to use, usually this is Private or Public but&nbsp;I&nbsp;think you need to use some unique string one for security reasons.</p>
<hr />
<h2>Enable SNMP on ESXi firewall</h2>
<p>Now we need to add a firewall rule to allow inbound SNMP&nbsp;traffic to our ESXi host. For this, we have two options:</p>
<ol>
<li>Allow all traffic for SNMP</li>
<li>Allow traffic from specific hosts or subnets</li>
</ol>
<h3>Allow traffic from All hosts</h3>
<pre>esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true</pre>
<h3>Allow traffic from specific hosts or subnets</h3>
<pre>esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 192.168.1.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true</pre>
<hr />
<h2>Restart SNMP Service</h2>
<p>Now that we have done our VMware 6.5 SNMP configuration we need to restart the SNMP service</p>
<pre>/etc/init.d/snmpd restart</pre>
<hr />
<p>Finally&nbsp;here is my CLI command list that you can edit and paste. I&#8217;ve changed the community string and I&#8217;m using my private LAN subnet to allow it on the ESXi firewall.</p>
<pre>esxcli system snmp set --communities vionstring
esxcli system snmp set --enable true
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 10.90.20.0/23
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
/etc/init.d/snmpd restart</pre>
<p>It should look like this:</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1723" src="https://www.vionblog.com/wp-content/uploads/2019/05/VMWareSNMPConfig-640x330.png" alt="VMWare SNMP Configuration" width="640" height="330" srcset="https://www.vionblog.com/wp-content/uploads/2019/05/VMWareSNMPConfig-640x330.png 640w, https://www.vionblog.com/wp-content/uploads/2019/05/VMWareSNMPConfig-300x155.png 300w, https://www.vionblog.com/wp-content/uploads/2019/05/VMWareSNMPConfig-768x396.png 768w, https://www.vionblog.com/wp-content/uploads/2019/05/VMWareSNMPConfig.png 879w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<hr />
<p>I&#8217;m going to use my configuration all the time and stop searching for it. Also, don&#8217;t forget to <strong>DISABLE SSH</strong> on your VMware hosts.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/esxi-6-5-snmp-configuration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Extend LVM Partition (Explained)</title>
		<link>https://www.vionblog.com/extend-lvm-partition/</link>
					<comments>https://www.vionblog.com/extend-lvm-partition/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Mon, 13 May 2019 10:19:48 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[LVM]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1711</guid>

					<description><![CDATA[It is time to take advantage of using LVM volumes when installing Linux servers. I got a Virtual Machine that I&#8217;ve used for a while now and I run out of disk space. So here are my steps on howto extend LVM partition. Add additional Disk Space I&#8217;ve chosen to add an additional virtual disk [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It is time to take advantage of using LVM volumes when installing Linux servers. I got a Virtual Machine that I&#8217;ve used for a while now and I run out of disk space. So here are my steps on howto extend LVM partition.</p>
<h2>Add additional Disk Space</h2>
<p>I&#8217;ve chosen to add an additional virtual disk not to increase the capacity on my current one.  I&#8217;ll be adding an additional 1TB thin-provisioned disk and reboot the system.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1713" src="https://www.vionblog.com/wp-content/uploads/2019/05/vmware-add-hard-disk.png" alt="VMware add Hard Disk" width="575" height="309" srcset="https://www.vionblog.com/wp-content/uploads/2019/05/vmware-add-hard-disk.png 575w, https://www.vionblog.com/wp-content/uploads/2019/05/vmware-add-hard-disk-300x161.png 300w" sizes="auto, (max-width: 575px) 100vw, 575px" /></p>
<p>Now I have 120GB  /dev/sda disk and 1TB /dev/sdb disk that I need to add into my LVM group. To check that I need to type <em>lsblk</em></p>
<pre>root@linux01:~# lsblk
NAME                   MAJ:MIN  RM  SIZE    RO  TYPE MOUNTPOINT
sda                    8:0      0    120G   0   disk
├─sda1                 8:1      0    487M   0   part /boot
├─sda2                 8:2      0    1K     0   part
└─sda5                 8:5      0    119.5G 0   part
 ├─linux01--vg-root    252:0    0    118.5G 0   lvm  /
 └─linux01--vg-swap_1  252:1    0    976M   0   lvm  [SWAP]
sdb                    8:16     0    1T     0   disk
sr0                    11:0     1    62M    0   rom</pre>
<hr />
<h2>Partition the new disk</h2>
<p>Now we need to partition the new disk with Linux LVM file type 8e with fdisk. In  my case, the choices will be: <strong>n</strong>(for new partition), <strong>p</strong>(for primary), <strong>1</strong>(for partition number sdb1), then few hits of <strong>Enter</strong> for the defaults, After that I&#8217;m changing the partition type to 8e so I press <strong>t</strong>(to change partition type) and <strong>8e</strong>(for Linux LVM) and at the end <strong>w</strong> to write the changes</p>
<pre>root@linux01:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xc2ce9a65.

Command (m for help): <strong>n</strong>
Partition type
 p primary (0 primary, 0 extended, 4 free)
 e extended (container for logical partitions)
Select (default p): <strong>p</strong>
Partition number (1-4, default 1): <strong>1</strong>
First sector (2048-2147483647, default 2048): <strong>&lt;enter&gt;</strong>
Last sector, +sectors or +size{K,M,G,T,P} (2048-2147483647, default 2147483647):<strong>&lt;enter&gt;</strong>

Created a new partition 1 of type 'Linux' and of size 1024 GiB.

Command (m for help): <strong>t</strong>
Selected partition 1
Partition type (type L to list all types): <strong>8e</strong>
Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): <strong>w</strong>
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.</pre>
<p>Now to check that everything is OK we&#8217;ll type <em>fdisk /dev/sdb -l </em>and this is what you should see at the end of the output:</p>
<pre>Device     Boot Start         End     Sectors  Size   Id  Type
/dev/sdb1        2048  2147483647  2147481600  1024G  8e  Linux LVM</pre>
<p><span style="text-decoration: underline; color: #ff0000;"><strong>NOTE</strong></span>: You may get an error message at the end of the ountput like the one below:</p>
<pre>The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.</pre>
<p>Just run <strong>partprobe</strong> again:</p>
<pre>root@linux01:~# partprobe
root@linux01:~#</pre>
<hr />
<h2>Extend LVM Partition</h2>
<p>Now we are going to convert the physical volume into a logical volume for use in LVM groups.</p>
<pre>root@linux01:~# pvcreate /dev/sdb1
 Physical volume "/dev/sdb1" successfully created</pre>
<p>Check the Volume Group name and extend it in our case the Volume Group Name is <em>linux01-vg</em> (the name is under the first VG)</p>
<pre>root@linux01:~# vgs
 VG        #PV #LV #SN Attr   VSize    VFree
 linux01-vg 1  2   0   wz--n- 119.52g  36.00m</pre>
<pre>root@linux01:~# vgextend linux01-vg /dev/sdb1
 Volume group "linux01-vg" successfully extended</pre>
<p>Now we are going to add all additional space that we have from the new disk</p>
<pre>root@linux01:~# df -h /
Filesystem                   Size Used Avail Use% Mounted on
/dev/mapper/linux01--vg-root 117G 78G  34G   71%  /</pre>
<pre>root@linux01:~# lvextend /dev/mapper/linux01--vg-root /dev/sdb1
 Size of logical volume linux01-vg/root changed from 118.53 GiB (30344 extents) to 1.12 TiB (292487 extents).
 Logical volume root successfully resized.</pre>
<p>if <strong>Ubuntu</strong> ext4:</p>
<pre>root@linux01:~# resize2fs /dev/mapper/linux01--vg-root
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mapper/linux01--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 8, new_desc_blocks = 72
The filesystem on /dev/mapper/linux01--vg-root is now 299506688 (4k) blocks long.</pre>
<p>if <strong>CentOS</strong> xfs:</p>
<pre>[root@server1 ~]# xfs_growfs /dev/mapper/centos_server1-root
meta-data=/dev/mapper/centos_server1-root isize=512 agcount=6, agsize=3276800 blks
         =                      sectsz=512 attr=2, projid32bit=1
         =                      crc=1 finobt=0 spinodes=0
data     =                      bsize=4096 blocks=17300480, imaxpct=25
         =                      sunit=0 swidth=0 blks
naming   =version 2             bsize=4096 ascii-ci=0 ftype=1
log      =internal              bsize=4096 blocks=6400, version=2
         =                      sectsz=512 sunit=0 blks, lazy-count=1
realtime =none                  extsz=4096 blocks=0, rtextents=0
data blocks changed from 17300480 to 69728256</pre>
<p>And now confirm that we have the space that we allocated</p>
<pre>root@linux01:~# df -h /
Filesystem                   Size  Used  Avail  Use%  Mounted on
/dev/mapper/linux01--vg-root 1.1T   78G  1001G  8%    /</pre>
<p>So, from <strong>120GB</strong> now we have <strong>1.1TB</strong> of space which should be enough for the purpose of this Virtual Machine.</p>
<p><strong>Logical Volume Manager (Linux): </strong><a href="https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)">https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/extend-lvm-partition/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Migrate VirtualBox to VMware ESXi 6.5</title>
		<link>https://www.vionblog.com/migrate-virtualbox-vmware-esxi-6-5/</link>
					<comments>https://www.vionblog.com/migrate-virtualbox-vmware-esxi-6-5/#comments</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Fri, 26 Oct 2018 12:00:40 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[VMware]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1696</guid>

					<description><![CDATA[There are a lot of tutorials out there but this method worked the best for me to migrate Virtual Machines from VirtualBox to VMware ESXi. Create diskless Virtual Machine in VMware Clone the .vdi Hard Drive from VirtualBox in vmdk format Move the new .vmdk image into VMware datastore using scp or wget Convert using [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>There are a lot of tutorials out there but this method worked the best for me to migrate Virtual Machines from VirtualBox to VMware ESXi.</p>
<ul>
<li>Create diskless Virtual Machine in VMware</li>
<li>Clone the .vdi Hard Drive from VirtualBox in vmdk format</li>
<li>Move the new .vmdk image into VMware datastore using scp or wget</li>
<li>Convert using VMware vmkfstools (<em>this option is missing from tutorials!</em>)</li>
<li>Attach the Hard Drive and start your Virtual Machine in VMware</li>
</ul>
<p>I&#8217;ve done this migrating machines from VirtualBox 4.3 to VMware 6.5, it should also work with other VirtualBox or VMware versions.</p>
<hr />
<h3>Create diskless VM in VMware</h3>
<p>Open your VMware and create Virtual Machine with the parameters you want and remove all the Hard Drives. This will create directory in your datastore where we will upload the Hard Drive later on.</p>
<hr />
<h3>Clone the .vdi Hard Drive from VirtualBox in vmdk format</h3>
<p>You need to proper shutdown the Virtual Machine in VirtualBox and use VBoxManage to clone the hard drive in vmdk format. This will create new hard drive on which you can work with and you will have the original one just i case something is not working as you expect.</p>
<pre>cd /path/to/virtual/machine/
VBoxManage clonehd Windows2008.vdi Windows2008-tmp.vmdk --format vmdk</pre>
<p>You will need to have extra space for the cloned images, if you don&#8217;t attach some other USB Hard Drive or NFS storage if working in remote data center.</p>
<p>If using phpVirtualBox open File -&gt; Virtual Media Manager, highlight the Drive you want to clone and click Copy</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1697" src="https://www.vionblog.com/wp-content/uploads/2018/10/VirtualMediaManager-640x394.png" alt="Virtual Media Manager" width="640" height="394" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/VirtualMediaManager-640x394.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/VirtualMediaManager-300x185.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/VirtualMediaManager-768x473.png 768w, https://www.vionblog.com/wp-content/uploads/2018/10/VirtualMediaManager.png 805w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1698" src="https://www.vionblog.com/wp-content/uploads/2018/10/CopyVirtualHardDrive-640x410.png" alt="Copy Virtual Hard Drive" width="640" height="410" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/CopyVirtualHardDrive-640x410.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/CopyVirtualHardDrive-300x192.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/CopyVirtualHardDrive.png 701w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1699" src="https://www.vionblog.com/wp-content/uploads/2018/10/HardDriveFileType-640x410.png" alt="Hard Drive File Type" width="640" height="410" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/HardDriveFileType-640x410.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/HardDriveFileType-300x192.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/HardDriveFileType.png 701w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1700" src="https://www.vionblog.com/wp-content/uploads/2018/10/StorageOnPhisycalHardDrive-640x410.png" alt="Storage On Phisycal Hard Drive" width="640" height="410" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/StorageOnPhisycalHardDrive-640x410.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/StorageOnPhisycalHardDrive-300x192.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/StorageOnPhisycalHardDrive.png 701w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1701" src="https://www.vionblog.com/wp-content/uploads/2018/10/NewHardDriveToCreate-640x410.png" alt="New Hard Drive To Create" width="640" height="410" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/NewHardDriveToCreate-640x410.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/NewHardDriveToCreate-300x192.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/NewHardDriveToCreate.png 701w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p>This will also create a clone of your Hard Drive and you will see the process in the bottom of your phpVirtualBox web interface.</p>
<hr />
<h3>Move the new .vmdk image into VMware datastore using scp</h3>
<p>You will need to enable SSH on your VMware machine to be able to use SCP to transfer the cloned image from VirtualBox machine to VMware machine or wget it from VirtualBox machine. In vSpere Web Client click on the server you want to enable SSH and go to Configure -&gt; System -&gt; Security Profile and click Edit</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1703" src="https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-640x309.png" alt="VMware Enable SSH" width="640" height="309" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-640x309.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-300x145.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH-768x371.png 768w, https://www.vionblog.com/wp-content/uploads/2018/10/VMwareEnableSSH.png 1290w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p>Login into your VirtualBox machine and SCP the file to your VMware machine</p>
<pre>cd /path/to/virtual/machine/
scp Windows2008-tmp.vmdk root@vmware-esxi.yourdomain.com:/vmfs/volumes/volume01/yourmachine</pre>
<p>Or wget the cloned Hard Drive from your VirtualBox machine, you need to have your cloned Hard Drive into your phpVirtualBox directory on your VirtualBox machine</p>
<pre>cd /vmfs/volumes/volume01/yourmachine
wget http://virtualbox-host-or-ip.yourdmain.com/Windows2008-tmp.vmdk</pre>
<hr />
<h3>Convert using VMware vmkfstools</h3>
<p>If you don&#8217;t do this part you will have your Hard Disk as IDE drive and the performance of your machine will be very slow, there is a Official article how to convert IDE to SCSI but it&#8217;s missing the part and if you try to open the .vmdk you will see that you are unable to open very large file (<em>in my case <strong>128GB</strong></em>).</p>
<p>Using vmkfstools to clone the clone you will have 2 files <strong>Windows2008.vmdk</strong> (<em>meta file that you can open and edit</em>) and <strong>Windows2008-flat.vmdk</strong> (<em>the actual data file</em>)</p>
<p>To get the desired files use this commands:</p>
<pre>cd /vmfs/volumes/volume01/yourmachine
vmkfstools -i Windows2008-tmp.vmdk  -d thin Windows2008.vmdk</pre>
<p>Now open the Windows2008.vmdk and change <strong>ddb.adapterType = &#8220;ide&#8221;</strong> to <strong>ddb.adapterType = &#8220;lsilogic&#8221;</strong> as explained in this <a href="https://kb.vmware.com/s/article/1016192?docid=1028042" target="_blank" rel="noopener noreferrer">VMware Knowledge Base</a></p>
<hr />
<h3>Attach the Hard Drive and start your Virtual Machine</h3>
<p>Now you can attach your existing Hard Drive <strong>Windows2008.vmdk</strong> and start your Virtual Machine, if everything is OK you can delete the old <strong>Windows2008-tmp.vmdk</strong> file.</p>
<hr />
<p><strong>VirtualBox</strong>: <a href="https://www.virtualbox.org/">https://www.virtualbox.org/<br />
</a><strong>VMware</strong>: <a href="https://www.vmware.com/">https://www.vmware.com/</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/migrate-virtualbox-vmware-esxi-6-5/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>VMware 6.5 can&#8217;t start VM after a host crash</title>
		<link>https://www.vionblog.com/vmware-6-5-cant-start-vm-host-crash/</link>
					<comments>https://www.vionblog.com/vmware-6-5-cant-start-vm-host-crash/#comments</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Thu, 18 Oct 2018 14:52:02 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[VMware]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1683</guid>

					<description><![CDATA[After a migration of a VM one of my host machines has become very unstable and freezes from time to time. My plan is to address the issue this weekend but every time i reboot the host machine one of the VM&#8217;s is not starting and u have the following errors: File system specific implementation [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>After a migration of a VM one of my host machines has become very unstable and freezes from time to time. My plan is to address the issue this weekend but every time i reboot the host machine one of the VM&#8217;s is not starting and u have the following errors:<img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1689" src="https://www.vionblog.com/wp-content/uploads/2018/10/power-on-vm-failed-640x207.png" alt="power-on-vm-failed" width="640" height="207" srcset="https://www.vionblog.com/wp-content/uploads/2018/10/power-on-vm-failed-640x207.png 640w, https://www.vionblog.com/wp-content/uploads/2018/10/power-on-vm-failed-300x97.png 300w, https://www.vionblog.com/wp-content/uploads/2018/10/power-on-vm-failed-768x249.png 768w, https://www.vionblog.com/wp-content/uploads/2018/10/power-on-vm-failed.png 1059w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<pre>File system specific implementation of LookupAndOpen[file] failed
Object type requires hosted I/O
Cannot open the disk '/vmfs/volumes/..../.....vmdk' or one of the snapshot disks it depends on.
Module 'Disk' power on failed.
Failed to start the virtual machine.</pre>
<p>To solve the issue you need to check the .vmdk file and repair it. If you need to repair it is good to have a backup of the file just in case.</p>
<hr />
<p>1. Enable SSH access to your ESXi host and login</p>
<p>2. Check the main .vmdk file if it corrupted or not</p>
<pre>vmkfstools -x check /path/to/your/machine.vmdk</pre>
<p>3. To repair the file type:</p>
<pre>vmkfstools -x repair /path/to/your/machine.vmdk</pre>
<p>4. Start you VM!</p>
<hr />
<p>In my case:</p>
<pre>[root@esx02:/vmfs/volumes/5b3a61e9-248e71e2-e165-0cc47ae7cfd1/machine] vmkfstools -x check machine.vmdk
Disk needs repair.
[root@esx02:/vmfs/volumes/5b3a61e9-248e71e2-e165-0cc47ae7cfd1/machine] vmkfstools -x repair machine.vmdk
Disk was successfully repaired.</pre>
<p>This help me few times last month so it&#8217;s here.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/vmware-6-5-cant-start-vm-host-crash/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
		<item>
		<title>SSL Labs Test Perfect Score for nginx</title>
		<link>https://www.vionblog.com/ssl-labs-perfect-score-nginx/</link>
					<comments>https://www.vionblog.com/ssl-labs-perfect-score-nginx/#respond</comments>
		
		<dc:creator><![CDATA[Nikola Stojanoski]]></dc:creator>
		<pubDate>Thu, 23 Aug 2018 19:45:03 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SSL]]></category>
		<guid isPermaLink="false">https://www.vionblog.com/?p=1673</guid>

					<description><![CDATA[Setting up TLS certificates on nginx this days is easy, but you should spend few more minutes and configure them properly. If you do it right you should have SSL Labs Test perfect score of A+ I had a customer for whom we ware asked to setup Let&#8217;s Encrypt certificate and do it fast, so [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Setting up TLS certificates on nginx this days is easy, but you should spend few more minutes and configure them properly. If you do it right you should have SSL Labs Test perfect score of A+</p>
<p>I had a customer for whom we ware asked to setup <a href="https://letsencrypt.org/" target="_blank" rel="noopener noreferrer"><strong>Let&#8217;s Encrypt</strong></a> certificate and do it fast, so we generated the certificates and applied the basic configuration. The next day we had another call and we ware told that some mobile customers had some issues opening the website, so we analyzed the website using the <strong>SSL Labs online tool</strong> and got the score of <strong>B</strong>. The plan was FIX the SSL Labs score and the issues will be solved.</p>
<p><img loading="lazy" decoding="async" class="size-large wp-image-1675 aligncenter" src="https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-B-score-640x200.png" alt="ssl-labs-B-score" width="640" height="200" srcset="https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-B-score-640x200.png 640w, https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-B-score-300x94.png 300w, https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-B-score.png 760w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p>We assume that you already have your Certificates and we need to do few more configuration changes.</p>
<hr />
<h3>Enable HTTP2 and TLS</h3>
<p>You need to add <em>ssl</em> and <em>http2</em> in your listen line:</p>
<pre id="941b" class="graf graf--pre graf-after--p"><code class="markup--code markup--pre-code">server {
  listen     *:443 ssl http2;
  ...
}</code></pre>
<hr />
<h3>Disable the old SSL protocol</h3>
<p>SSL is very old protocol and we need to disable it,</p>
<pre id="c3c8" class="graf graf--pre graf-after--p">ssl_protocols TLSv1 TLSv1.1 TLSv1.2;</pre>
<hr />
<h3>Optimize cipher list</h3>
<p>Ciphers can impact both performance and security so we need to have good cipher list. This list will probably change but for the time when I&#8217;m writing this article the list below is a good start.</p>
<p>We will tell nginx that we are going to use preferred cipher list and then list the preferred ciphers</p>
<pre id="f1ef" class="graf graf--pre graf-after--p">ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;</pre>
<hr />
<h3>nginx dhparam parameters</h3>
<p>We should generate our own DH parameters with at least 2048 bits, if you use 4096 bits on your certificate please generate 4096 bits DH parameters.</p>
<pre>mkdir /etc/nginx/certs/
openssl dhparam 2048 -out /etc/nginx/certs/dhparam.pem</pre>
<p>Then add the following line in your nginx config</p>
<pre id="1c26" class="graf graf--pre graf-after--p">ssl_dhparam /etc/nginx/certs/dhparam.pem;</pre>
<hr />
<h3>OCSP stapling</h3>
<p>We can tell our server to get a signed message from the OCSP server and add it to the initial handshake, this way the client will be confidante that the certificate is not revoked and the browser will not need to add additional overhead the the connection.</p>
<p>We will get it directly from Let&#8217;s Encrypt website</p>
<pre>wget -O /etc/nginx/certs/lets-encrypt-x3-cross-signed.pem "https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem"</pre>
<p>And add this lines to our nginx configuration</p>
<pre>ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/certs/lets-encrypt-x3-cross-signed.pem;</pre>
<hr />
<h3>Enable HSTS</h3>
<p>To get the benefits of <em>HTTP2</em> we need to use enable HSTS with allows the server to tell the client to only use HTTPS and the client will not try to communicate with HTTP for the time specified.</p>
<p>Add the following line to enable HSTS</p>
<pre id="dee8" class="graf graf--pre graf-after--p">add_header Strict-Transport-Security "max-age=31536000" always;</pre>
<p>If you want to include all subdomains Add this</p>
<pre>add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;</pre>
<p>NOTE: Don&#8217;t use both.</p>
<hr />
<h3>Optimizing SSL session cache</h3>
<p>Creating a bigger session cache will reduce the number of handshakes and we will have better performance. The default time is 5 minutes and we will increase it to 4 hours.</p>
<p>As a reference 1MB cache will hold around 4000 sessions.</p>
<p>We will add 40MB of shared cache with 4 hours of session timeout.</p>
<pre>ssl_session_cache shared:SSL:40m;
ssl_session_timeout 4h;</pre>
<hr />
<h3>Enable session tickets</h3>
<p>This is alternative to session cache, if a client has a session ticket it can be presented to the server and the re-negotiation is not necessary.</p>
<p>Add the following to the config</p>
<pre>ssl_session_tickets on;</pre>
<hr />
<h3>Finally the whole config file</h3>
<pre>server {
 # Enable HTTP2 and TLS
 listen *:443 ssl http2;

# Tell client which ciphers are available
 ssl_prefer_server_ciphers on;
 ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;

# Use our own DH params
 ssl_dhparam /etc/nginx/certs/dhparam.pem;

# Enable OCSP stapling
 ssl_stapling on;
 ssl_stapling_verify on;
 ssl_trusted_certificate /etc/nginx/certs/lets-encrypt-x3-cross-signed.pem;

# Enable HSTS
 add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

# Optimize session cache
 ssl_session_cache shared:SSL:40m;
 ssl_session_timeout 4h;

# Enable session tickets
 ssl_session_tickets on;
 
 ......
}</pre>
<p><img loading="lazy" decoding="async" class="size-large wp-image-1674 aligncenter" src="https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-A-score-640x200.png" alt="ssl-labs-A+-score" width="640" height="200" srcset="https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-A-score-640x200.png 640w, https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-A-score-300x94.png 300w, https://www.vionblog.com/wp-content/uploads/2018/08/ssl-labs-A-score.png 760w" sizes="auto, (max-width: 640px) 100vw, 640px" /></p>
<p>Now we got A+, the website performance was much better and no more issues opening the website.</p>
<p><a href="http://nginx.org/en/docs/http/ngx_http_ssl_module.html" target="_blank" rel="noopener noreferrer"><strong>Nginx SSL module<br />
</strong></a><a href="https://www.ssllabs.com/ssltest/index.html" target="_blank" rel="noopener noreferrer"><strong>SSL Labs Server Test</strong></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.vionblog.com/ssl-labs-perfect-score-nginx/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
