Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How to make Linux partition and configure the network on Redhat Linux7.3 ?

Server Information :
    master                 :192.168.2.2
    slave_1                :192.168.2.3
    slave_2                :192.168.2.4
    default gateway   :192.168.2.1
    OS                        :Red Hat Enterprise Linux Server release 7.3 Beta (Maipo)
    Adding extra slave:192.168.2.5 (without down time)

MASTER PARTITION:
  • /mnt/DATA
  • /mnt/archive
  • /mnt/backup
Slave_1 and slave_2 PARTITION:
  • /DATA
  • /ARCHIVE
  • /BACKUP
1.Configure the network on  Master,Slave_1,Slave_2 server:

On Master:
[postgres@master ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.3 Beta (Maipo)
--Netcard Entry
cd /etc/sysconfig/network-scripts/
vi ifcfg-ens33

BOOTPROTO=static
IPADDR=192.168.2.2
NETMASK=255.255.255.0
DEVICE="ens33"
ONBOOT=yes

vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=master
GATEWAY=192.168.2.1

## Configure DNS Server
# vi /etc/resolv.conf

nameserver 8.8.8.8     # Replace with your nameserver ip
nameserver 192.168.2.1  # Replace with your nameserver ip

--Host Entry
vi /etc/hosts
192.168.2.2 master 

--Restart the network services
#systemctl restart network
        (OR)
#service network restart
FOR SLAVE_1 SERVER:
--Netcard Entry
cd /etc/sysconfig/network-scripts/
vi ifcfg-ens33

BOOTPROTO=static
IPADDR=192.168.2.3
NETMASK=255.255.255.0
DEVICE="ens33"
ONBOOT=yes

vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=slave1
GATEWAY=192.168.2.1

## Configure DNS Server
# vi /etc/resolv.conf

nameserver 8.8.8.8     # Replace with your nameserver ip
nameserver 192.168.2.1  # Replace with your nameserver ip

--Host Entry
vi /etc/hosts
192.168.2.3 slave1 

--Restart the network services
#systemctl restart network
        (Or)
#service network restart
FOR SLAVE_2 SERVER:
--Netcard Entry
cd /etc/sysconfig/network-scripts/
vi ifcfg-ens33

BOOTPROTO=static
IPADDR=192.168.2.4
NETMASK=255.255.255.0
DEVICE="ens33"
ONBOOT=yes

vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=slave2
GATEWAY=192.168.2.1

## Configure DNS Server
# vi /etc/resolv.conf

nameserver 8.8.8.8     # Replace with your nameserver ip
nameserver 192.168.2.1  # Replace with your nameserver ip

--Host Entry
vi /etc/hosts
192.168.2.4 slave2

--Restart the network services
#systemctl restart network
        (Or)
#service network restart
Now ping the server slave_1 from master and slave_1 to slave_2 if all successfull then we can go make partition ,if not successfully reaching the other server we can check it the fairwall status and stop it all server

For Example:
From master:
ping 192.168.2.3
From slave_1:
ping 192.168.2.4

2.Disk Parition for data/archive/backup:
a)100GB data,50GB archive,40GB backup
For out of range error use "extended" option
[root@localhost ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00022715

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200   83  Linux
/dev/sda2          616448     4812799     2098176   82  Linux swap / Solaris
/dev/sda3         4812800   419430399   207308800   83  Linux

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@localhost ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

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
Building a new DOS disklabel with disk identifier 0x4f696ae8.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): 
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00022715

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      616447      307200   83  Linux
/dev/sda2          616448     4812799     2098176   82  Linux swap / Solaris
/dev/sda3         4812800   419430399   207308800   83  Linux

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x4f696ae8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   209715199   104856576   83  Linux

Disk /dev/sdc: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@localhost ~]# fdisk -l /dev/sdb1

Disk /dev/sdb1: 107.4 GB, 107373133824 bytes, 209713152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@localhost ~]# fdisk  /dev/sdbc
fdisk: cannot open /dev/sdbc: No such file or directory
[root@localhost ~]# fdisk  /dev/sdc
Welcome to fdisk (util-linux 2.23.2).

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
Building a new DOS disklabel with disk identifier 0x4efbaaa0.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-104857599, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): 
Using default value 104857599
Partition 1 of type Linux and of size 50 GiB is set

Command (m for help): w       
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk  /dev/sdd
Welcome to fdisk (util-linux 2.23.2).

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
Building a new DOS disklabel with disk identifier 0xaf00340d.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-83886079, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-83886079, default 83886079): 
Using default value 83886079
Partition 1 of type Linux and of size 40 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
.:. restart the server using init 6,init 0 for shutdown

B)add the mount point:
As root user:
        1. create a mount point for the data partition:
               sudo mkdir /DATA

        2.This command will format the partition with ext4 FS
               mkfs.ext4 /dev/sdc1

        3.Mount the partition:
               sudo mount /dev/sdb1 /DATA
               sudo mount /dev/sdc1 /ARCHIVE
               sudo mount /dev/sdd1 /BACKUP
                           (OR)
               mount -t auto /dev/sdc1 /DATA

         4.Take ownership of the mount point:
               sudo chown -R postgres: /DATA
               sudo chown -R postgres: /ARCHIVE
       sudo chown -R postgres: /BACKUP

         5.Find out the UUID# for your data partition:
[root@localhost ~]# sudo blkid
/dev/sda1: UUID="15fe408e-72ef-47fe-b3f0-e33f032c1d9f" TYPE="xfs" 
/dev/sda2: UUID="03a8e0e8-ae89-4a1f-bafc-c03826de7ea5" TYPE="swap" 
/dev/sda3: UUID="f45ae60c-162f-4da2-aa33-f76723e0c5fe" TYPE="xfs" 
/dev/sdb1: UUID="46c3be28-2646-495e-9d1b-5f9be9d1e154" TYPE="ext4" 
/dev/sdc1: UUID="c5abf63e-a9ad-410c-a685-4407d9a12b93" TYPE="ext4" 
/dev/sdd1: UUID="961e84b2-dbe2-4f2c-ade7-72c2b2b5289d" TYPE="ext4" 
/dev/sr0: UUID="2016-08-17-06-07-50-00" LABEL="RHEL-7.3 Server.x86_64" TYPE="iso9660" PTTYPE="dos"
 6.Open your fstab file and make an entry to auto-mount the data partition on boot:
                gksu gedit /etc/fstab (OR) vi /etc/fstab
           (Note: you may need to substitute a different text editor if gedit not installed to your version of Mint.)

           In gedit, add either of the two examples below (substitute your UUID# for the ones listed here):
                 A.For an Ext4 formatted partition, add these two lines to end of fstab file:
# Mount DATA partition under /DATA
UUID=46c3be28-2646-495e-9d1b-5f9be9d1e154 /DATA                   ext4    defaults        0 2
UUID=c5abf63e-a9ad-410c-a685-4407d9a12b93 /ARCHIVE                ext4    defaults        0 2
UUID=961e84b2-dbe2-4f2c-ade7-72c2b2b5289d /BACKUP                 ext4    defaults        0 2
B.For an NTFS formatted partition, add these two lines to end of fstab file:
# Mount DATA partition under /DATA
UUID=747D4C9C1EFAD1F2     /DATA     ntfs-3g     defaults,windows_names,locale=en_US.utf8     0     0
                      Save the changes to fstab and close the text editor or vim editor





Comments

Popular posts from this blog

PostgreSQL pgBadger

PostgreSQL Pgbadger Installation On Linux

How to configure Replication Manager (repmgr) ?

What's is the difference between streaming replication Vs hot standby vs warm standby ?

Script to kill ALL IDLE Connection In postgreSQL