Tag Archives: exported

Creating gfs cluster


title: “Creating gfs cluster”
date: 2016-01-28T13:37:46
slug: creating-gfs-cluster


On each node:

yum -y install lvm2-cluster pacemaker pcs gfs2-utils

Start and enable the daemon by issuing the following commands on each node.

systemctl start pcsd.service
systemctl enable pcsd.service

As Root set a password for hacluster:

passwd hacluster
password:

Auf dem primary node:

pcs cluster auth RHEL centos
Username: hacluster
Password:
RHEL: Authorized
centos: Authorized

 pcs cluster setup --name mycluster RHEL centos
Shutting down pacemaker/corosync services...
Redirecting to /bin/systemctl stop pacemaker.service
Redirecting to /bin/systemctl stop corosync.service
Killing any remaining services...
Removing all cluster configuration files...
RHEL: Succeeded
centos: Succeeded
Synchronizing pcsd certificates on nodes RHEL, centos...
RHEL: Success
centos: Success

Restaring pcsd on the nodes in order to reload the certificates...
RHEL: Success
centos: Success

That’s it. Corosync is configured across the cluster.

Start the cluster

pcs cluster start

Start Cluster on all nodes

pcs cluster start --all

Check Status

pcs cluster status

Verify Corosync Installation

corosync-cfgtool -s
mkfs -t gfs2 -p lock\_dlm -j 2 -t one:test /dev/<drbd-resource>
lvmconf --enable-cluster
systemctl reboot

Bootsector


title: “Bootsector”
date: 2016-01-18T14:32:29
slug: bootsector


Understanding MBR size

The mbr size is as follows in bytes:

Where,446 + 64 + 2 = 512

446 bytes - Bootstrap.
64 bytes - Partition table.
2 bytes - Signature.
MBR anzeigen

Hier als Beispiel /dev/sda

hexdump -s0 -n512 -C /dev/sda
Partitions-Bootsektor anzeigen
hexdump -s0 -n512 -C /dev/sda1
Command to delete mbr including all partitions
dd if=/dev/zero of=/dev/sda bs=512 count=1
Command to delete mbr only
dd if=/dev/zero of=/dev/sda bs=446 count=1

Backup MBR with dd command

dd the old good command which now backup partition tables even writes CDs ;). Backing up partition is nothing but actually backing up MBR (master boot record). The command is as follows for backing up MBR stored on

dd if=/dev/sda of=/tmp/sda-mbr.bin bs=512 count=1

Replace X with actual device name such as /dev/sda.

Now to restore partition table to disk, all you need to do is use dd command:

# dd if= sda-mbr.bin of=/dev/sda bs=1 count=64 skip=446 seek=446

How to mount LVM partitions from rescue mode RHEL


title: “How to mount LVM partitions from rescue mode RHEL”
date: 2016-01-18T13:44:42
slug: how-to-mount-lvm-partitions-from-rescue-mode-rhel


Scan for volume groups:

lvm vgscan -v

Activate all volume groups:

lvm vgchange -a y

List logical volumes:

lvm lvs –all

With this information, and the volumes activated, you should be able to mount the volumes:

mount /dev/volumegroup/logicalvolume /mountpoint

Resetting the Root Password


title: “Resetting the Root Password”
date: 2016-01-18T12:42:55
slug: resetting-the-root-password


1.

Boot your system and wait until the GRUB2 menu appears.

2.

In the boot loader menu, highlight any entry and press e to edit it.

3.

Find the line beginning with linux. At the end of this line, append the following:

init=/bin/sh

IMPORTANT

Some systems (notably virtual machines) may have problems displaying correct output when you boot using this procedure. Some characters or even entire lines may be hidden, making the shell difficult to use. To solve this problem, delete the rhgb command from the linux line.

4.

Press F10 or Ctrl+X to boot the system using the options you just edited.

Once the system boots, you will be presented with a shell prompt without having to enter any user name or password:

sh-4.2#

5.

Load the installed SELinux policy (-i inital policy load. Only use this if this is the first time policy is being loaded since boot (usually called from initramfs).):

sh-4.2#

6.

Execute the following command to remount your root partition:

sh4.2#

7.

Reset the root password:

sh4.2#

When prompted to, enter your new root password and confirm by pressing the Enterkey. Enter the password for the second time to make sure you typed it correctly and confirm with Enter again. If both passwords match, a message informing you of a successful root password change will appear.

8.

Remount the root partition again, this time as read-only:

sh4.2#

9.

Reboot the system. From now on, you will be able to log in as the root user using the new password set up during this procedure.

Another Way:

Add the following parameter to kernel boot line in Grub:

rd.break enforcing=0
mount -o remount,rw /sysroot
chroot /sysroot
/usr/bin/password
touch /.autorelabel
mount -o remount,ro /

Boot RHEL in Emergency Mode


title: “Boot RHEL in Emergency Mode”
date: 2016-01-18T12:15:32
slug: boot-rhel-in-emergency-mode


In emergency mode, you are booted into the most minimal environment possible. The root file system is mounted read-only and almost nothing is set up. The main advantage of emergency mode over single-user mode is that the init files are not loaded. If init is corrupted or not working, you can still mount file systems to recover data that could be lost during a re-installation.

To change kernel parameters only during a single boot process, proceed as follows:

1.

Start the system and, on the GRUB 2 boot screen, move the cursor to the menu entry you want to edit, and press the e key for edit.

2.

Move the cursor down to find the kernel command line. The kernel command line starts with linux on 64-Bit IBM Power Series, linux16 on x86-64 BIOS-based systems, or linuxefi on UEFI systems.

3.

Move the cursor to the end of the line.

Press Ctrl+a and Ctrl+e to jump to the start and end of the line, respectively. On some systems, Home and End might also work.

4.

Edit the kernel parameters as required. For example, to run the system in emergency mode, add the emergency parameter at the end of the linux16 line:

linux16 /vmlinuz-3.10.0-0.rc4.59.el7.x86\_64 root=/dev/mapper/rhel-root ro rd.md=0 rd.dm=0 rd.lvm.lv=rhel/swap crashkernel=auto rd.luks=0 vconsole.keymap=us rd.lvm.lv=rhel/root rhgb quiet emergency

The rhgb and quiet parameters can be removed in order to enable system messages.

rhgb = redhat graphical boot – This is a GUI mode booting screen with most of the information hidden while the user sees a rotating activity icon spining and brief information as to what the computer is doing.

quiet = hides the majority of boot messages before rhgb starts. These are supposed to make the common user more comfortable. They get alarmed about seeing the kernel and initializing messages, so they hide them for their comfort.

Remount the root Filesystem RW:

mount -o remount,rw /

Create RPM from tar (extract only)


title: “Create RPM from tar (extract only)”
date: 2016-01-14T10:16:13
slug: create-rpm-from-tar-extract-only


Install fpm

gem install fpm
fpm -s tar -t rpm --name tomcat7 --version 7.0.67 apache-tomcat-7.0.67.tar.gz

Mit

--prefix <path>

kann der Target Pfad mit angegeben werden.

Static DNS with DHCP (Ubuntu & Centos)


title: “Static DNS with DHCP (Ubuntu & Centos)”
date: 2016-01-14T09:18:40
slug: static-dns-with-dhcp-ubuntu-centos


Ubuntu:

vi /etc/dhcp/dhclient.conf

Remove the DNS and Serarch opteion (if needed)

request subnet-mask, broadcast-address, time-offset, routers,
 domain-name, host-name,
 dhcp6.name-servers, dhcp6.domain-search,
 netbios-name-servers, netbios-scope, interface-mtu,
 rfc3442-classless-static-routes, ntp-servers,
 dhcp6.fqdn, dhcp6.sntp-servers;

Add the Static DNS and Search Values:

vi /etc/network/interfaces.d/eth0.cfg
# The primary network interface
auto eth0
iface eth0 inet dhcp
dns-nameservers 172.31.8.224
dns-search nyc2.example.com

Centos

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Change PEERDNS=”yes” to PEERDNS=”no”

DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL="yes"
PEERDNS="no"
IPV6INIT="no"
PERSISTENT\_DHCLIENT="1"

Set the required Values in /etc/resolv.conf

vi /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
nameserver 172.31.8.224
search nyc2.example.com