Posts

Space reclamation / UNMAP on RHEL or CentOS 7

What is Space Reclamation? This feature supports Thin Provisioned environment, and it is the process of freeing space from the storage system that has already been freed from the host file system. A host file system contains metadata to keep track to know which blocks are available to store new data and which blocks contain actual data and must not be overwritten. This metadata is stored within the LUN. When a file is deleted in the host file system, the file system metadata is updated to mark that file's blocks as free space. Total file system free space is then recalculated to include the newly-freed blocks. To the storage system, these metadata updates appear no different than any other writes being performed by the host. Therefore, the storage system is unaware that any deletions have occurred. What is Unmapping? Unmapping is a process which de-allocates relationship between LBA and a physical block in a logical unit. Reclamation within RHEL and CentOS: RHEL / Ce...

What are /dev/random and /dev/urandom files?

/dev/random will block after the entropy pool is exhausted. It will remain blocked until additional data has been collected from the sources of entropy that are available. This can slow down random data generation. Randomness is critical to the security of cryptography in your application – one-time pads, key generation. [root@localhost ~]# dd if=/dev/random of=random.txt bs=2048 count=2048 dd: warning: partial read (82 bytes); suggest iflag=fullblock 0+2048 records in 0+2048 records out 150665 bytes (151 kB) copied, 21.6704 s, 7.0 kB/s /dev/urandom will not block. Instead it will reuse the internal pool to produce more pseudo-random bits. It's best when we have to a large file with random data. Also if you are using "dd" command to wipe data of a disk by replacing it with random data. [root@localhost ~]# dd if=/dev/urandom of=urandom.txt bs=2048 count=2048 2048+0 records in 2048+0 records out 4194304 bytes (4.2 MB) copied, 0.0361976 s, 116 MB/s

Difference between /var/log/messages and /var/log/dmesg log files

/var/log/messages – This file contains global system messages, including the messages that are logged during system startup. There are several things that are logged in /var/log/messages including mail, cron, daemon, kern, auth, etc. [root@localhost ~]# cat /var/log/messages Apr 17 20:30:03 localhost rsyslogd: [origin software="rsyslogd" swVersion="8.24.0-34.el7" x-pid="9423" x-info="http://www.rsyslog.com"] rsyslogd was HUPed Apr 17 20:40:02 localhost systemd: Started Session 9 of user root. Apr 17 20:40:32 localhost dhclient[9217]: DHCPREQUEST on ens33 to 192.168.189.254 port 67 (xid=0xde4e9a7) Apr 17 20:40:32 localhost dhclient[9217]: DHCPACK from 192.168.189.254 (xid=0xde4e9a7) Apr 17 20:40:32 localhost NetworkManager[8908]: <info>  [1555513832.8097] dhcp4 (ens33):   address 192.168.189.128 Apr 17 20:40:32 localhost NetworkManager[8908]: <info>  [1555513832.8107] dhcp4 (ens33):   plen 24 (255.255.255.0) Apr 17 20:40:32 ...

What are /dev/zero and /dev/null files ?

"/dev/zero" and "/dev/null" are two dummy devices files which are useful for creating empty files. "/dev/zero":   It is used to create a file with no data but with required size(A file with all zero’s written on it). Let's create file with /dev/zero [root@localhost ~]# dd if=/dev/zero of=/opt/zero.txt bs=2048 count=2048 2048+0 records in 2048+0 records out 4194304 bytes (4.2 MB) copied, 0.150465 s, 27.9 MB/s it creates a file that has continuous zeros in it. So we can say that /dev/zero is a file which is used to create a new file with some required size without any meaning to the data. "/dev/null": This file is useful in cases like redirecting unwanted output/error etc to this file. Actually it acts as a black hole which absorbs this unwanted input. So whenever you feed some data to this file, you can not retrieve the data which is fed to it. This file even useful for creating files with zero size. e.g. If you see i h...

How to install and configure Docker on RHEL or CentOS 7 ?

How to install and configure Docker on RHEL or CentOS 7 ? Step 1. Install the required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the device-mapper storage driver. Verify if centos "extras" repository is enabled in "/etc/yum.repos.d/CentOS-Base.repo", bydefault it would be enabled: [ extras ] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 NOTE:  If installing on RHEL 7.5 or ater version, please mount RHEL 7.6  or later ISO to /mnt and add local repository for yum, note that RHEL 7.6 iso is needed to update few of the packages and dependencies as 7.5 ISO has old version of packages which are not compatible to the latest docker release...

How to change default run-level in RHEL or CentOS 7

How to change default run-level in RHEL or CentOS 7 There is change in process to setup default run-levels from init 3 (multi-user) to init 5 (Graphical) and vice versa. If we see "/etc/inittab" file it's been changed from RHEL/CentOS 6.x to 7.x. [root@localhost ~]# cat /etc/inittab # inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target # To check what is the default run-level configured currently : [root@localhost ~]# ls -l /lib/systemd/system/default.target l...

Blacklisting modules in RHEL or CentOS 7

Blacklisting modules in RHEL or CentOS 7 You may come to a requirement where you want to "blacklist" a module. Why would you need this feature? Because sometimes a module may cause conflict with another modules, or is superseded by another module, or is otherwise undesirable. To blacklist a module, the easiest way is to add an module entry to /etc/modprobe.d/blacklist.conf Let's see how it can be done ! We can take "vfat" module for example, check if it is loaded: [root@localhost ~]# lsmod | grep -i vfat [root@localhost ~]# If you see in below command it's allowed to load, not blacklisted: [root@localhost ~]# modprobe --showconfig | grep vfat alias fs_vfat vfat [root@localhost ~]# Now we will try to load it: [root@localhost ~]# modprobe vfat [root@localhost ~]# lsmod | grep -i vfat vfat                   17461  0 fat                  ...