Category Archives: RedHat

How to mount and unmount encrypted disk using LUKS

  1. get disk ID
    # fdisk -l
    OUTPUT: /dev/sdc
    # blkid – get partition name i.e. /dev/sdc1
  2. Open the volume and map it
    cryptsetup luksOpen /dev/sdc1 cryptData

    1. Mount the volume
      # mount /dev/mapper/cryptData /mnt/encrypted
  3. dsf
Advertisements

How to exclude packages from update Red Hat/Centos

Sometimes you only want to update packages without upgrading kernel, there are two ways of doing this:

1. Temporarily
# yum update –exclude=<package_name>
# yum update –exclude=kernel*

2. To make it more permanent edit /etc/yum.conf file and append “exclude” keyword
[main]
cachedir=/var/cache/yum/$basesearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exclude=kernel* redhat-release*

Expand Logical Volume in Red Hat VMware

After adding a separate disk run to verify if the space was added:

  1. fdisk -l
  2. create a new partition fdisk /dev/sdb
    1. p – to print current partition table
    2. n – to create a new partition
    3. p – for primary
    4. 1 – depending on the output of the partition table output
    5. press return two times to accept the defaults (first and last sector)
    6. t – to change the system’s partition ID
    7. 8e – to change to Linux LVM
    8. w – to write the changes
  3. restart VM
  4. fdisk -l – to verify that partition was successfully created
  5. convert a partition to physical volume
    $ pvcreate /dev/sdb1
    Physical volume “/dev/sdb1” successfully created
  6. Extend current volume group
    vgextend rhel /dev/sdb1
    Volume group “rhel” successfully extended
  7. Run vgdisplay to verify if free space was added
    vgdisplay rhel | grep “Free”
    Free  PE / Size       4095 / 16.00 GiB
  8. extend logical volume with free space
    lvextend -l +100%FREE /dev/rhel/root
    Extending logical volume root to 66.00 GiB
    Logical volume root successfully resized
  9. Expand ext3 file system online inside of Logical Volume
    xfs_growfs /dev/rhel/root – Red Hat 7
    ext2online /dev/rhel/root
    resize2fs /dev/rhel/root

Configure Remote Desktop from command line

  1. To enable remote desktop open a terminal and enter the following:
  2. gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

  3. To disable the following option: “You must confirm each access to this machine” enter as follows:
    gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false

The above is extremely helpful if you come across a bug when clicking on System menu the system hangs. More information can be found here: https://bugzilla.redhat.com/show_bug.cgi?id=730378