Thursday, November 20, 2014

How To Create A LUKS Device In Linux?



LUKS (Linux Unified  Key Setup) is a standard for hard disk encryption. This is the native Linux (Red Hat variants) utility to perform hard drive encryption to protect data. To get this done, install the required package if not installed. The package needed is "cryptsetup-luks". Once this is done, the "cryptsetup" command would be available to use.

Friday, October 3, 2014

How To Downgrade A Package In Red Hat Linux?


--------------------------------------------------------------------------------------------------------
Downgrade A Package: Different Ways In Red Hat Enterprise Linux
--------------------------------------------------------------------------------------------------------

Method 1: Using "rpm -Uvh --oldpackage <CompletePackageName.rpm>" Command

Method 2: Using "yum downgrade <PackageName>" Command.

Method 3: Using "yum history undo/rollback" in RHEL 6 & later.

Method 4: Manually un-install and install the required package (not a preferred way).


Sunday, August 17, 2014

Linux Commands For A Beginner [Updated]

These are the most commonly used Linux commands for a beginner or a newbie. This may help out someone who is trying to quickly learn some basic commands in Linux world. All the best!


Tuesday, August 12, 2014

Step By Step Linux Boot Process [Updated]



In  systemd based systems (RHEL7/8, SLES15 etc..)
Power On BIOS/UEFI MBR/GPT GRUB2 (Stage 1 Boot Loader  Stage 2 Boot Loader) Kernel systemd Login


→  Power On

The system/server hardware or firmware either UEFI (Unified Extensible Firmware Interface)  Or BIOS (Basic Input Output System) runs Power On Self Test (POST) when system gets powered-on.

Wednesday, August 6, 2014

Restore A Missing Physical Volume


Let's find out the step-by-step involved to recover a failed physical volume in Linux.

The setup has got the"testvg" which got "testlv" and corresponding Physical Volume (PV) is on '/dev/sdb' block device as shown below:

[root@RHEL4 archive]# vgs
  VG     #PV #LV #SN Attr   VSize VFree
  VolGroup00   1 2 0 wz--n-  19.88G 32.00M
  testvg   1   1 0 wz--n- 200.00M 0              ← targeted VG

[root@RHEL4 archive]# pvs
  PV     VG     Fmt  Attr PSize   PFree
  /dev/sda2  VolGroup00 lvm2 a- 19.88G 32.00M
  /dev/sdb   testvg lvm2 a-   200.00M 0    ← targeted PV

[root@RHEL4 archive]# lvs
  LV   VG     Attr   LSize Origin Snap%  Move Log Copy%
  LogVol00 VolGroup00 -wi-ao  18.88G
  LogVol01 VolGroup00 -wi-ao 992.00M
  testlv   testvg -wi-a- 200.00M                           ← targeted LV


Backup And Restore A Hard Drive/Disk Partition Table

This is a small demonstration on how to backup and restore partition table data in a Linux system. For this demo, I've taken '/dev/sde'  hard drive as an example. So, in the first part, I'd backup the drive partition table and later part we'd destroy the data, hence, we'd restore it finally using the backup copy.

1) The device '/dev/sde' which got one partition '/dev/sde1' with a label '/label_test' mounted on '/test2' as seen below:

{Checking the partition details of the device}

[root@RHEL4 ~]# fdisk -l /dev/sde

Disk /dev/sde: 213 MB, 213909504 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1         204      208880   83  Linux

Allow Regular User To Run Administrative Commands

- To achieve this, one would need to add the users and respective commands to '/etc/sudoers' file.

- Run the command : visudo

- This command would open up '/etc/sudoers' file in edit mode and doesn't allow another user to open the file and edit in any other terminal.

- Say for example, we'd need to allow user 'bkp' to run the 'mke2fs' command then we could add the below line in '/etc/sudoers' to accomplish this task:

bkp    ALL=/sbin/mke2fs

- After this change, the user 'bkp' would need to run the command with 'sudo' as given below:

 $ sudo /sbin/mke2fs -n /dev/sdb1

   << this would prompt for password, so after successful authentication, it would run the   administrative command by the user bkp >>

- Other users except 'root' cannot execute commands under /sbin