About Me

My photo
Kalyan Kumar Pasupuleti B-Tech(Information Technology). • AWS Certified Solutions Architect - Associate • RedHat Certified Engineer(RHCE) • Directory Services and Authentication Certificate of Expertise(LDAP) • Red Hat SELinux Policy Administration Certificate of Expertise(SELinux) • Network Services Security Certificate of Expertise (Network Services) • RedHat Certified Virtualization Administrator(RHCVA) • Red Hat Certified Security Specialist (RHCSS) Working as Cloud DevOps engineer

Wednesday, June 19, 2019

RHEL6 Vs RHEL7


Release Name
RHEL 6 – Santiago
RHEL 7 – Maipo
Gnome Version
RHEL 6 – GNOME 2
RHEL 7 – GNOME 3.8
KDE Version
RHEL 6 – KDE 4.1
RHEL 7 – KDE 4.6
NFS Version
RHEL 6 – NFS 4
RHEL 7 – NFS 4.1. NFS V2 is deprecated in RHEL 7
Samba Version
RHEL 6 – SMB 3.6
RHEL 7 – SMB 4.4
OS BOOT TIME
RHEL6: 40 sec
RHEL7: 20 sec
MAXIMUM SIZE OF SINGLE PARTITION
RHEL6: 50TB(EXT4)
RHEL7: 500TB(XFS)
BOOT LOADER
RHEL6:  /boot/grub/grub.conf
RHEL7: /boot/grupb2/grub.cfg
PROCESSOR ARCHITECTURE
RHEL6: It support 32bit & 64bit both
RHEL7: It only support 64bit
HOW TO FORMAT OR ASSIGN A FILE SYSTEM IN
RHEL6:      #mkfs.ext4   /dev/hda4
RHEL7:       #mkfs.xfs   /dev/hda3
HOW TO REPAIR A FILE SYSTEM IN
RHEL6:  #fsck -y /dev/hda3
RHEL7:  #xfs_repair /dev/hda3
COMMAND TO MANAGE NETWORK IN RHEL6 AND RHEL7
RHEL6:  #setup
RHEL7:  #nmtui
HOSTNAME CONFIGURATION FILE
RHEL6:    /etc/sysconfig/network
RHEL7:    /etc/hostname
DEFAULT ISO IMAGE MOUNT PATH
RHEL6: /media
RHEL7: /run/media/root
FILE SYSTEM CHECK
RHEL6:   e2fsck
RHEL7:   xfs_repair
RESIZE A FILE SYSTEM
RHEL6:   #resize2fs -p /dev/vg00/lv1
RHEL7:    #xfs_growfs  /dev/vg00/lv1
Run Levels
RHEL 6 – runlevel 0 – Power Off
runlevel 1 – Single User Mode
runlevel 2 – Multi User without Networking
runlevel 3 – Multi User CLI
runlevel 4 – Not USed
runlevel 5 – GUI Mode
runlevel 6 – Restart
RHEL 7 – There is no run levels in RHEL 7. Run levels are called as targets
Poweroff.target
rescue.target
multi-user.target
graphical.target
reboot.target
UID Information
RHEL 6 – Normal User UID will start from 500 to 65534
System Users UID will start from 1 to 499
RHEL 7 – Normal User UID start from 1000 – 65534
System Users UID will start from 1 to 999Because Services are increased compare to RHEL 6
By Pass Root Password Prompt
RHEL 6 – append 1 or s or init=/bin/bash to Kernel command line
RHEL 7 – Append rd.break or init=/bin/bash to kernel command line
Rebooting and Poweroff
RHEL 6 – poweroff – init 0
reboot – init 6
RHEL 7 – systemctl poweroff
systemctl reboot
YUM Commands
RHEL 6 -yum groupinstall
yum groupinfo
RHEL 7 – yum group install
yum group info
Default Inode Size
RHEL 6 – 256 bytes
[root@local ~]# tune2fs -l /dev/sda1|grep -i ‘inode size’
Inode size: 128
RHEL 7 – 512 bytes
[root@managed1 ]# xfs_info /dev/sda1|grep isize
meta-data=/dev/sda1 isize=512 agcount=4, agsize=65536 blks
Resizing an Lvm
RHEL 6 – EXT family of file systems could be resized if built on a logical volume as a block device.
RHEL 7 – As with XFS file system, resize is not possible.

TUNE A FILE SYSTEM
RHEL6: tune2fs
RHEL7: xfs_admin
IPTABLES AND FIREWALL
RHEL6: iptables
RHEL7: firewalld
IPtables
To see firewall status in RHEL7
#firewall-cmd   –state
To see Firewall status in RHEL6
#service iptables status
To stop firewall in RHEL7
#systemctl stop firewalld.service
To stop firewall in RHEL6
#service iptables stop
COMMUNICATION BETWEEN TCP AND UDP IN BACK END
RHEL6: netcat
RHEL7: ncat
INTERFACE NAME
RHEL6: eth0
RHEL7: ens198(N)
COMBINING NIC
RHEL6: Network Bonding
RHEL7: Team Driver
NSF Server Version
RHEL6:  NFSv2
RHEL7:  NFSV4
DATABASE USED
RHEL6: Mysql
RHEL7: mariaDB
RHEL7 also support Mysql
MANAGING SERVICES
RHEL6:
#service sshd restart
#chkconfig sshd on
RHEL7:
#systemctl restart sshd
#systemctl enable shhd
File System.
RHEL6 default file system is ext4
xfs is RHEL7 default file system.
Kernel Version
RHEL6 default kernel version is 2.6 while RHEL7 is 3.10
UID Allocation
In RHEL6 default UID assigned to users would start from 500 while in RHEL7 it’s starting from 1000.
But this can be changed if required by editing /etc/login.defs file.
Maximum supported File Size.
In RHEL6 maximum file size of an individual file can be up to 16TB while in RHEL7 it can be up to 500TB which is very large in comparison to RHEL6.
Maximum Supported File System Size.
In RHEL6 maximum file system size=16TB (for 64bit Machine) and 8TB (for 32 bit machine). While in RHEL7 maximum file system size is 500TB.
Also keep in mind that RHEL does not support XFS on 32-bit machines.
Change in file system structure.
In rhel6 /bin,/sbin,/lib and /lib64 are usually under /
In rhel7, now /bin,/sbin,/lib and /lib64 are nested under /usr.
The /tmp directory can now be used as a temporary file storage system (tmpfs)
Space Required to Installing RHEL7?

Now if you want to install RHEL7 in your machine, RedHat recommends minimum 5 GB of disk space to install this release of RHEL series for all supported architectures.
.Hostname lookup and setup 
In rhel5 and rhel6 versions, we can edit file /etc/sysconfig/network to set hostname but in rhel7 we can directly change the hostname using below commands.
hostnamectl
nmtui
nmcli
Example:
in RHEL6              #hostname
in RHEL7              #hostnamectl  status   and #hostname
Few More notable changes in RHEL 7.
Netstat and ifconfig commands also disappeared from RHEL7 but it can be used by installing net-tools.
The move from sysvinit to systemd is one of most important change that has been made and which is a matter of concerned.
Command tail -n is replaced by journalctl -n
Command tail -f is replaced by journalctl -f
For displaying kernel messages instead of dmesg now in RHEL7 we use journalctl –k



Tuesday, June 11, 2019

ext2 vs ext3 vs ext4 vs xfs file system differences


Ext2

             Ext2 stands for second extended file system.
             It was introduced in 1993. Developed by Rémy Card.
             This was developed to overcome the limitation of the original ext file system.
             Ext2 does not have journaling feature.
             On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of 
               journaling.
             Maximum individual file size can be from 16 GB to 2 TB
             Overall ext2 file system size can be from 2 TB to 32 TB

How to create an ext2 filesystem
# mke2fs /dev/sda1


Ext3

             Ext3 stands for third extended file system.
             It was introduced in 2001. Developed by Stephen Tweedie.
             Starting from Linux Kernel 2.4.15 ext3 was available.
             The main benefit of ext3 is that it allows journaling.
             Journaling has a dedicated area in the file system, where all the changes are tracked. When
               the system crashes, the possibility of file system corruption is less because of journaling.
             Maximum individual file size can be from 16 GB to 2 TB
             Overall ext3 file system size can be from 2 TB to 32 TB
             There are three types of journaling available in ext3 file system.
o             Journal – Metadata and content are saved in the journal.
o             Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing
               the content to disk. This is the default.
o             Writeback – Only metadata is saved in the journal. Metadata might be journaled either
                before or after the content is written to the disk.
             You can convert a ext2 file system to ext3 file system directly (without backup/restore).


How to create ext3 file system :-
# mkfs.ext3 /dev/sda1
(or)
# mke2fs –j /dev/sda1
( -j for adding journaling capability )
How to  convert  ext2 to ext3 :-
# umount /dev/sda2
# tune2fs -j /dev/sda2
# mount /dev/sda2  /var


 Ext4     

             Ext4 stands for fourth extended file system.
             It was introduced in 2008.
             Starting from Linux Kernel 2.6.19 ext4 was available.
             Supports huge individual file size and overall file system size.
             Maximum individual file size can be from 16 GB to 16 TB
             Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 
              1 PB = 1024 TB (terabyte).
             Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
             You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
             Several other new features are introduced in ext4: multiblock allocation, delayed allocation,
               journal checksum. fast fsck, etc. All you need to know is that these new features have
               improved the performance and reliability of the filesystem when compared to ext3.
             In ext4, you also have the option of turning the journaling feature “off”.

Creating ext4 file system :-
# mkfs.ext4 /dev/sda1
(or)
# mke2fs -t ext4 /dev/sda1

Converting ext3 to ext4
( Warning :- Never try this live or production servers )
# umount /dev/sda2
# tune2fs -O extents,uninit_bg,dir_index  /dev/sda2
# e2fsck -pf /dev/sda2
# mount /dev/sda2 /var

Find your servers filesystem type
We can find the filesystem type used in our servers using any one of the following commands

# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
# file -sL /dev/sda1
/dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery)
# df -T | awk ‘{print $1,$2,$7}’ | grep “^/dev”
/dev/sda3 ext3 /
/dev/sda1 ext3 /boot




XFS

XFS is a high-performance file system which was designed by SGI for their IRIX platform. 
Since XFS was ported to the Linux kernel in 2001, XFS has remained a preferred choice for many enterprise systems especially with massive amount of data.
XFS is  a high performance filesystem,due to its high performance, architectural scalability and robustness. For example, RHEL/CentOS 7 and Oracle Linux have adopted XFS as their default file system, and SUSE/openSUSE have long been an avid supporter of XFS.
XFS has a number of unique features that make it stand out among the file system crowd, such as scalable/parallel I/O, journaling for metadata operations, online de-fragmentation, suspend/resume I/O, delayed allocation for performance, etc.
If you want to create and mount an XFS file system on your Linux platform, here is how to do it.
XFS is packed full of cool features like 
  1. guaranteed rate I/O 
  2. online resizing
  3. built-in quota enforcement
  4. it can theoretically support filesystems up to 8 exabytes in size. 


It’s been used on Linux since about 2001, and is available as an install option on many popular Linux distributions. With variable block sizes, you can tune your system like a sliding scale to tweak for space efficiency or read performance. Best for extremely large file systems, large files, and lots of files Journaled (an asymmetric parallel cluster file system version is also available) POSIX extended access controls The XFS file system is Open Source and included in major Linux distributions. It originated from SGI (Irix) and was designed specifically for large files and large volume scalability. Video and multi-media files are best handled by this file system. Scaling to petabyte volumes, it also handles great deals of data. It is one of the few filesystems on Linux which supports Data Migration (SGI contributed the Hierarchical Storage Management interfaces into the Linux Kernel a number of years ago). SGI also offers a closed source cluster parallel version of XFS called cXFS which like cVxFS is an asymmetrical model. It has the unique feature, however, that it’s slave nodes can run on Unix, Linux and Windows, making it a cross platform file system. Its master node must run on SGI hardware. Recommended Use: If you really like to tweak your system to meet your needs, XFS is a great way to go.

The XFS file system is an extension of the extent file system .XFS is a high performance 64 bit journaling file system .Support of XFS was merged into the linux kernel in around 2002 and In 2009 Red Hat Enterprise Linux version 5.4 usage of XFS file system .
Default file system in RHEL7 is XFS
XFS supports maximum file system size of 8 exbibytes for 64 bit file system .Some comparison of XFS file system is XFS file system cannot be shrunk and poor performance with deletions of large numbers of files.
32-bit system 64-bit system
File size: 16 Terabytes 16 Exabytes
File system: 16 Terabytes 18 Exabytes


How to change the default run level in RHEL7?


In earlier version of RHEL, we used to change the runlevels in /etc/inittab file.
But inittab is no longer used when using systemd. systemd uses ‘targets’ instead of runlevels.
By default there are 2 main targets
graphical.target à Runlevel 5 having GUI
 multi-user.targetàRunlevel 3 text based

To view current default runlevel/target
# systemctl get-default

To set a different target
#systemctl set-default TARGET.target
Ex: systemctl set-default graphical.target

Verification:
# systemctl get-default
graphical.target

Now reboot the machine to check whether the machine is booting up into graphical mode.

Alternate method to change the runlevel

You may be noticed the similar output when the systemctl set-default multi-user.target command is issued. What the command done is nothing but making a symbolic link of runlevel targets to the default target file.

rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'

Check the current level.
# systemctl get-default
multi-user.target

Before making the symbolic link, let’s list out the files in the systemd directory.

# ls /lib/systemd/system/runlevel*target -l
lrwxrwxrwx. 1 root root 15 Aug  3 13:44 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Aug  3 13:44 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Aug  3 13:44 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Aug  3 13:44 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Aug  3 13:44 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Aug  3 13:44 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Aug  3 13:44 /lib/systemd/system/runlevel6.target -> reboot.target

As per the previous step, current default run level 3. 
Issue the following command to make a symbolic link of runlevel5.target to default.target file.

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
or

# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

Again check the current level.

# systemctl get-default
runlevel5.target

Now the default runlevel is 5 (graphical mode), reboot the server and check it out.

# reboot