How to create Raid1 mirroring with 3rd & 4th Drives in OVH servers

OVH panel offers easy Raid configuration for the partitions in up to 2 drives. Recently I was working on a server that has 2 SSDs and 2 HDDs. The server is intended to serve as a Shared Hosting server. My idea was to install the OS on the SSDs and use the HDDs for hosting website data. It was not much of a hassle to install the OS on SSds on Raid1. I can easily add the two HDDs as additional drives and mount them both to be used for storage. But there’s a drawback in such configuration. There will be no redundancy for the storage drives. If any of those HDDs crash – I will lose all data on it. So, my idea is to create another Raid1 with the two HDDs. Unfortunately, it is not possible from the OVH panel and OVH denied any support on this issue. Therefore I had to do it myself.

Since many of the server providers are offering servers with 4 drives – I believe some of you might find this useful. The idea is to create two Raid arrays of 4 drives. In this case – the two SSDs were already in Raid 1 – configured by the OVH panel. So what I needed to do is to create another Raid 1 with the other two HDDs.

Here is how the initial configuration looked like:

#lsblk

ovh default settings with 4 drives

There already is a Raid1 between the second partitions of the two SSDs (nvme0n1p2 & nvme1n1p2). The two HDDs are “sda” & “sdb” which are unformatted and no partitions are created.

The basic steps are as follows:

  1. Create a partition in sda with full volume
  2. Create a partition in sdb with full volume
  3. Create a Raid1 with the two partitions from sda & sdb
  4.  Set the file system (ext4) for the newly created Raid1
  5. Mount the newly created Raid1 to be used as the new volume in the server.

IMPORTANT NOTES:

To check the current Raid configuration:
#cat /proc/mdstat

To create a new partition in a drive:
# fdisk /dev/sd[x]

fdisk can create partitions with max 2TB. Here in my case the two HDDs were of 4TB each. Therefore I had to use GPT parted to create the partition. If you want to learn more about GPT click here.

1. Create a partition in sda with full volume:

# parted /dev/sda

Output:

GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)
Creates a new GPT disklabel i.e. partition table:
#(parted) mklabel gpt
Sample outputs:
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)

Next, set the default unit to TB, enter:
#(parted) unit TB

To create a 3.7TB partition size, enter:
#(parted) mkpart primary 0 0
OR
#(parted) mkpart primary 0.00TB 3.70TB

To print the current partitions, enter:
#(parted) print

Sample outputs:
Model: ATA ST33000651AS (scsi)
Disk /dev/sda: 3.70TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 0.00TB 4.00TB 4.00TB ext4 primary

Quit and save the changes, enter:
#(parted) quit
Sample outputs:
Information: You may need to update /etc/fstab. (Since we will be creating Raid with this partition – not need to add this in /etc/fstab in this case)

Use the mkfs.ext3 or mkfs.ext4 (ext4 preferred) command to format the file system, enter:
# mkfs.ext3 /dev/sda1

OR
# mkfs.ext4 /dev/sda1

2. Create a partition in sdb with full volume

# parted /dev/sdb

#(parted) mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)

Next, set the default unit to TB, enter:
#(parted) unit TB

To create a 3.7TB partition size, enter:
#(parted) mkpart primary 0 0
OR
#(parted) mkpart primary 0.00TB 3.70TB

To print the current partitions, enter:
#(parted) print
Sample outputs:

Model: SATA ST33000651AS (scsi)
Disk /dev/sdb: 3.70TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 0.00TB 4.00TB 4.00TB ext4 primary

Quit and save the changes, enter:

#(parted) quit

Sample outputs:
Information: You may need to update /etc/fstab.

Use the mkfs.ext3 or mkfs.ext4 (ext4 preferred) command to format the file system, enter:
# mkfs.ext3 /dev/sdb1
OR
# mkfs.ext4 /dev/sdb1

IMPORTANT NOTE:
BEFORE PROCEEDING TO NEXT STEP CHECK THE FILE SYSTEMS OF THE NEWLY CREATED PARTITIONS OF THE TWO DRIVES:

#fdisk -l

If you see something like the following:
partition file type microsoft basic

You need to do some extra steps to convert these partitions to ext4. Please check the (#13 reply) THIS LINK for details.
=============================================================
Solution: Install gdisk (yum install gdisk) (Check: https://bbs.archlinux.org/viewtopic.php?id=191163 (check #13 reply))
NEED TO CHANGE THE FILE SYSTEMS (reported by fdisk -l) from Microsoft Basic to “Linux File System” with the above-mentioned solution)

# yum install gdisk
# gdisk /dev/sda 🙁
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

#Command (? for help): t
#Partition number (1-1): 1
Current type is ‘Microsoft basic data’
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to ‘Linux filesystem’

#Command (? for help): p
#Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.

DO THE SAME FOR SDB
=============================================================

3. Create a Raid1 with the two partitions from sda & sdb

We already had a Raid1 of the two partitions from SSD named “md2”. We can find it:

# cat /proc/mdstat

In steps 1 & 2 – we created two new partitions in “sda” & “sdb” named “sda1” & “sdb1” respectively.
partitions 3rd 4th drive no raid yet

Check the Raid status of sda1 & sdb1:
# mdadm –examine /dev/sd[a-b]1
– it will show no raid

NOW run the following to create the Raid1 between sda1 and sdb1:
# mdadm –create /dev/md3 –level=mirror –raid-devices=2 /dev/sd[a-b]1

The name of the new Raid1 array is “md3”.

Now check the “lsblk” again and it will show “md3” 3.7TB
md3 raid sda1 sdb1

Now if you check Raid status ( # cat /proc/mdstat ) you’ll see the Raid partitions sda1 & sdb1 are syncing.
md3 sda1 sdb1 sync

The 4TB disks took almost 5 hours to complete the syncing.

4. Set the file system (ext4) for the newly created Raid1

Execute the following command to set the file system (ext4) of the newly created md3 Raid drive:

# mkfs.ext4 /dev/md3

5. Mount the newly created Raid1

We want to mount the newly created Raid1 (md3) to the directory “/home2”. We need to do the following:

# mkdir /home2
# mount /dev/md3 /home2

md3 mounted home2

Now we need to edit /etc/fstab and add the new Raid volume – so that the storage volume is not lost after the server reboots.
edit etc fstab to save the storage volume home2

# nano /etc/fstab

add the following line: /dev/md3 /home2 ext4 defaults 0 0

and save the file. That’s it. The new storage volume will remain after server reboot and we can use this to store our data. If we now check the storage details – we will see the following:

final storage details after adding second raid1 storage

The process will be the same for servers from any provider and not only OVH. Feel free to add your suggestion if you think anything can be improved here or if you encounter any problems by following this article. Thank you.

How to clean /tmp directory automatically in Linux/cPanel using tmpwatch

The “tmpwatch ” command in linux is to removes files which haven’t been accessed for a period of time. The tmpwatch recursively removes files which haven’t been accessed for a given time. Normally, it’s used to clean up directories which are used for temporary holding space such as /tmp.

If you are noticing “/tmp” getting overloaded with files and not sure which files/folders to delete – you better use “tmpwatch” to cleanup or delete files/folders from the “/tmp” directory.

You’ll need SSH root access to install tmpwatch and add it in the cron. If your server is inaccessible due to “/tmp” getting full – you may restart the server and that should free up some space after reboot.

  1. Login to the server as root using SSH
  2. Run the following command:

    #yum install tmpwatch -y

  3. To delete temporary files (for example after every 12 hours) run the following command:

    #/usr/sbin/tmpwatch -am 12 /tmp

  4. The next step is to configure tmpwatch to run automatically through a cron. To do that type the following command:

    #crontab -e

  5. The above command will open the cron job list for the user root. Now go to the bottom and add the following line and save the file:

    0 4 * * * /usr/sbin/tmpwatch -am 12 /tmp

    If you are unable to add the above line, you may navigate to “/var/spool/cron” and open the cron file “root” with a text editor (such as, vi, nano). Add the line at the bottom and save the file:

    0 4 * * * /usr/sbin/tmpwatch -am 12 /tmp

Check the usage of “/tmp” and it should be clean by now.

Thank you.

How to force redirect http to https using .htaccess

how to force http to https redirection htaccess

If you have an SSL certificate installed and would like to force your website to load with https URL – you may add the following code in the .htaccess file (Linux based hosting):

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

You need to place the .htaccess file in the home directory of your website.

 

USSD codes of GrameenPhone, Robi, Banglalink, Airtel, Teletalk

GrameenPhone
Prepaid Balance Check : *566#
Show SIM Number : *2# or *111*8*2#
Package Check : *111*7*2#
Minute Balance Check : *566*24#,*566*20#, *566*22#
SMS Check : *566*2#, *566*18#
MMS Check : *566*14#
Data (MB) Check : *566*10#, *567#
Call Me Back : *123*Number#
Net Setting Request : *111*6*2#
Miss Call Alert (On) : type START MCA & Send to 6222
Miss Call Alert (Off) : Type STOP MCA & Send to 6222
.
Banglalink
Prepaid Balance Check : *124#
Show SIM Number : *511#
Package Check : *125#
Minute Balance Check : *124*2#
SMS Check : *124*3#
MMS Check : *124*2#
Data (MB) Check : *124*5#, *222*3#
Call Me Back : *126*Number#
Net Setting Request : Type ALL & Send to 3343
Miss Call Alert (On) : Type START & Send to 622
Miss Call Alert (Off) : Type STOP & Send to 622 .
.
Robi
Prepaid Balance Check : *222#
Show SIM Number : *140*2*4#
Package Check : *140*14#
Minute Check : *222*3#
SMS Check : *222*11#
MMS Check : *222*13#
Data (MB) Check : *222*81#, 8444*88#
Net Setting Request : *140*7#
Miss Call Alert (On) : Type ON & Send to 8272 Miss Call Alert (Off) : Type OFF & Send to 8272 .
.
Airtel
Prepaid Balance Check : *778#
Show SIM Number : *121*6*3#
Package Check : *121*8#
Minute Balance Check : *778*5# or *778*8#
SMS Check : *778*2#
MMS Check : *222*13#
Data (MB) Check : *778*39# or *778*4#
Call Me Back : *121*5#
Net Setting Request : *140*7#
Miss Call Alert (On) : *121*3*4#
.
Teletalk
Prepaid Balance Check : *152#
Show SIM Number : Type “Tar” & send to 222
Package Check :
Minute balance Check : *152#
SMS Check : *152#
MMS Check : *152#
Data (MB) Check : *152#
Net Setting Request : Type SET & Send to 738
Miss Call Alert (On) : Type REG & Send to 2455
Miss Call Alert (Off) : Type CAN & Send to 2455

Robi Internet Packages, price, validity & Activation Codes

Robi Internet Packages, Validity, Price, Activation code:


Updated: 24th March 2019

VolumePriceValidityActivation Code
250MB4630*123*110#
750MB @ 31tk7414*123*0074#
1GB11930*123*0119#
1.5GB1017*123*101#
2GB413*123*041#
2GB20930*123*209#
3GB (2GB + 1GB 4G)483*123*48#
4GB(3GB Regular + 1GB 4G)1087*123*0108#
4GB31630*123*316#
6GB (3GB+3GB 4G)1297*123*0129#
7GB (5GB+2GB 4G)39930*123*399#
10 GB (7GB Regular + 3GB 4G)1997*123*0199#
10 GB (7GB Regular + 3GB 4G)50130*123*501#
15 GB64930*123*649#
1 GB, 50 Mins, 100 SMS987*123*098#
1 GB, 75 Mins, 30 SMS14930*123*149#
2 GB, 150 Mins, 150 SMS (Prepaid)25130*123*251#
2 GB, 150 Mins, 150 SMS (Postpaid)25130*123*251#
200 MB, 20 Mins297Scratch Card
600 MB, 30 Mins, 30 SMS (Prepaid)587*123*058#
600 MB, 30 Mins, 30 SMS (Prepaid)587*123*058#
60 MB (any use) +40MB Bonus for FB, IMO103*123*0010#
100 MB + 100MB FB IMO BONUS193*123*019#
350 MB IMO1828*123*56#
350 MB Facebook & Whatsapp1828*123*0250#
400 MB + 400 MB FB IMO Bonus5930Scratch Card
600 MB + 200 MB FB IMO Bonus497Scratch Card
600 MB any use + 200MB FB & IMO Bonus497*123*049#

 

Source:  Robi Axiata Website.

GrameenPhone Internet Packages, Validity, Price, Activation Code

GrameenPhone Internet Packages, Validity, Price, Activation code:

Updated: 24th March 2019

VolumePriceValidityActivation Code
5MB2.53*121*3002#
250MB @ 31tk313*121*3083#
2GB443 (72hours)*121*3242#
1GB Weekly867*121*3056#
1.5GB1047*121*3344#
2GB Weekly1297*121*3058#
4GB Weekly1797*121*3084#
6GB(3GB Regular + 3GB 4G)1487*121*3262#
10GB (5GB Regular + 5GB 4G)1987*121*3133#
1GB18930*121*3390#
1538MB22930*121*3027#
3.5GB (2.5GB Regular + 1GB 4G)33728*121*3009#
3GB27930*121*3391#
5.5GB (3.5GB Regular + 2GB 4G)42728*121*3010#
5GB39930*121*3392#
6GB60928*121*3012#
10GB64930*121*3393#
20GB99830*121*3394#
115MB5630*121*3005#
85MB377*121*3004#
555MB14928*121*3007#
Whatsapp pack 26MB2.53*121*3063#
Viber pack 26MB2.53*121*3070#
Heavy Video pack63*121*3020#
Facebook 3 Days1.53*121*3022#
Emergency data loan (12MB)53*121*3021#
Facebook 28 Days1828*121*3024#
Facebook 7 Days67*121*3023#

 

Source:  GrameenPhone Website.

How to delete Windows.old folder after Windows 10 update

I always keep adequate space in the system Partition (most of the times “C” drive). Because, the empty space is required to store various system files or Temporary Application files. Not enough space on this partition can often slow down the computer. I had 50+ GB free space in this 100 GB partition and only till a couple of days back – when I discovered my C drive is running out of space.

I was a bit confused on what could take so much space all of a sudden. I checked the drive and found a folder named “Windows.old” occupying  around 30 GB space. I know Windows.old folders are created when we re-install the Windows and don’t delete the old Windows files. But, in my case – this shouldn’t happen. Because, I haven’t re-installed Windows and this OS (Windows 10) is the one I have been using since I purchased my Laptop.

Finally, I discovered the folder Windows.old  has been created by the Windows 10 itself after a recent update. It backed up the old version in windows.old folder. It is a safety mechanism implemented so that the system can roll back incase the update fails. The Folder is then retained so that we can roll back to previous version incase we face issue even after successful update.

Since my Windows 10 is running fine after the update – I don’t need that Windows.old folder anymore. Deleting it will give me 30 GB free space. I could have delete the folder right away. But, I thought I should first check what should be the proper way to delete this folder.

After spending some time researching I found I can delete this Windows.old folder in three ways.

1. How to Properly delete Windows.old folder from the Disk Cleanup option:

  • Right click on the System Drive (C drive in most of the cases) and click “Properties”.
  • Now Click on “Disk Cleanup”

windows 10 disc cleanup utility

  • Now click on “Cleanup System Files”

windows 10 cleanup system files

  • Now Select the option “Previous Windows installation(s) and finally press “OK”.

disk cleanup delete system files old windows

 

2. How to Properly delete Windows.old folder from Windows Storage Settings:

    • Go to Windows 10 settings by Clicking on Windows Start  and the Setting icon.

Windows 10 settings

  • Now Type in “Storage” and the option “Storage Settings” will appear. Click on “Storage Settings”.

windows 10 settings page

NOW FOLLOW EITHER 2A OR 2B TO DELETE THE WINDOWS.OLD FOLDER.

2 A. Delete Windows.old folder using Storage Sense:

  • Click on “Change how we free up space automatically”.

windows 10 storage sense delete windows.old folder

  • Select the option “Delete previous versions of Windows” and finally click on “Clean Now”.

windows 10 storage sense delete windows.old folder

2 B. Delete Windows.old folder using Temporary Files Settings:

  • Go to the “Storage Settings” page. Click on “Free up space now”.

Windows 10 delete windows.old folder using temporary files settings

  • Select the option “Previous Windows Installation(s)” and finally click on “Remove Files”.

Windows 10 delete windows.old folder using temporary files settings

=============================================================

You can delete the Windows.old folder by any of the above three methods. But please be sure that – you no longer need it, your Windows 10 is functioning properly, You don’t need to roll back as all your applications are working fine and finally, you really need to free up space. Windows creates this Windows.old folder for some reasons and I have described that at the very beginning of the article. Feel free to share your views or suggestion (if any) through commenting.

10 best Web Hosting companies – Plans & Pricing 2019

# 1


hostgator logo

HostGator is the largest shared hosting service provider in the whole world. There are good reasons for which millions of clients host there websites with HostGator. There service quality and support is superb and that is what set's them apart from others. Following are their Shared hosting packages:

shared hosting packages of hostgator

Besides Shared hosting - HostGator offers: Cloud Hosting, WordPress Hosting, VPS & Dedicated Servers.

# 2


siteground logo

SiteGround is popular hosting service provider which is known for its rock solid services and unbeatable support. Their shared hosting packages are as follows:

shared hosting packages of siteground

 

Besides Shared hosting - SiteGround offers: Cloud Hosting, WordPress Hosting and WooCommerce Hosting.

# 3


siteground logo

Eleven2 is a US-based web hosting service with a global presence. It was founded in 2003 and its office address is in Los Angeles. Eleven2 offers two types of shared hosting - Shared hosting with Standard storage and Shared hosting with SSD. Eleven2's shared hosting packages are as follows:

shared hosting packages of eleven2
SSD shared hosting packages of eleven2
Eleven2 Offers other services like: Reseller Hosting, SSD Reseller Hosting, Virtual Private Servers and Cloud Hosting.

# 4


bluehost logo

Bluehost is a web hosting company owned by Endurance International Group. It is one of the 20 largest web hosts, collectively hosting well over 2 million. If you are looking for a good web hosting company, you have probably heard of Bluehost. They are a popular and quickly growing web hosting company. BlueHost's shared hosting packages are as follows:

shared hosting packages of bluehost

Bluehost Offers other services like: Cloud Hosting, WordPress Hosting, Virtual Private Servers.

# 5


ipage logo

iPage is a popular web hosting platform for a very big number of websites. It is one of those inexpensive hosting providers who provides quality hosting services with great support. iPage shared hosting packages are as follows:

shared hosting packages of ipage

iPage Offers other services like: Dedicated Hosting & VPS Hosting.

# 6


justhot logo

JustHost is a simplified hosting provider which provides hosting packed with a lot of features - backed by their extremely good support. JustHost shared hosting packages are as follows:

shared hosting packages of justhost

JustHost doesn't offer any other services - but they do offer useful marketing tools (Google Ads credit) to get started well.

# 7


7uphost logo

7upHost is global web hosting service provider operating from Bangladesh. Established in 2008 it has been serving clients from all over the world. They offer rock solid hosting with a friendly support. 7upHost shared hosting packages are as follows:

shared hosting packages of 7uphost

7upHost offers all kinds of web hosting besides shared hosting: SSD Hosting, Reseller Hosting, Virtual Private Server, Dedicated Server, Managed AWS Hosting, Google Cloud, GSuite and Professional Email Hosting services.

# 8


A2 Hosting logo

A2 Hosting is much talked web hosting service provider now a days for their diversified hosting services. Their shared hosting packages are as follows:

shared hosting packages of A2 Hosting

A2 Hosting offers a variety of services like: WordPress Hosting, Reseller Hosting, Virtual Private Server, Dedicated Server.

# 9


DreamHost logo

DreamHost is one of those veteran web hosting providers still popular across the globe. Their shared hosting packages are as follows:

shared hosting packages of dreamhost

Other Services by DreamHost: Cloud Hosting, Virtual Private Server, Dedicated Hosting.

# 10


GreenGeeks logo

GreenGeeks is wellknown as an environment freidnly hosting service Provider. Their datacenters are powered by renewal energy sources. They are also reputed for their incredible hosting services and support. Their shared hosting packages are as follows:

shared hosting packages of greengeeks

GreenGeeks offers a variety of web hosting solutions, including shared hosting, reseller hosting, virtual private server hosting and dedicated Hosting.

Whitelist IP or IP range in/out using iptables

#Flush existing rules
iptables -F

# Set up default DROP rule for eth0 (Assuming eth0 is the Ethernet Port)
iptables -P INPUT DROP

# Allow existing connections to continue
iptables -A INPUT -i eth0 -m state –state ESTABLISHED,RELATED -j ACCEPT

# Accept everything from the 192.168.0.x network
iptables -A INPUT -i eth0 -s 192.168.0.0/24 -j ACCEPT

# Allow connections from this host to 192.168.1.10
iptables -A OUTPUT -o eth0 -d 192.168.1.10 -j ACCEPT