Posts

Showing posts with the label disks

LUKS Encryption and Unattended boot on Headless Servers

The anaconda installer on Redhat-based Linux distributions provides the user with an option to encrypt the /home partition by selecting a simple check-box. This adds an obviously valuable security/privacy feature to the system if it's selected. Consequently, this prompts the user for a password during the boot process, which then decrypts the partition and mounts it in the designated location on the filesystem. The default behaviour is not very well suited for unattended reboots or on headless servers. The crypttab(5) manual page provides great information on how to facilitate the process for unattended boots: DESCRIPTION
The /etc/crypttab file describes encrypted block devices that are set up during system boot.

Empty lines and lines starting with the "#" character are ignored. Each of the remaining lines describes one encrypted block device, fields on the line are delimited by white space. The first two fields are mandatory, the remaining two …

Specify I/O Scheduler with udev rules

Since the advent of systemd the use of /etc/rc* startup-scripts has been discouraged and phased out. However, systemd still supports the use of certain local startup scripts for compatibility purposes. Nevertheless, to ensure full current- and future compatibility with systemd, administrators are encouraged to create own systemd service files or udev rules to run scripts during boot.  This post will briefly outline the use of a udev rule to assign a specific I/O scheduler to a specific HDD.

NOTE To see an example using the phased-out rc-startup scripts, take a look at my previous post.
Create a custom rules-file, e.g. 99-custom.rules, in the /etc/udev/rules.d/ directory with your editor of choice.  The following example will instruct udev to assign the deadline I/O scheduler to the /dev/sdb device:

# vim /etc/udev/rules.d/99-custom.rules ACTION=="add|change", SUBSYSTEM=="block" , KERNEL=="sdb*", RUN+="/bin/sh -c 'echo deadline > /sys/bloc…

Specify I/O Scheduler per Device

Since the advent of systemd the use of /etc/rc* startup-scripts has been discouraged and phased out. However, systemd still supports the use of certain local startup scripts for compatibility purposes. This post will briefly outline the use of the /etc/rc.local file to assign a specific I/O scheduler to a specific HDD.

At the moment, I have an SSD drive (primary /dev/sda) and an "old-fashioned" HDD (/dev/sdb) in use on my RHEL7 system.  I'd like to be able to use the deadline I/O scheduler as the default and assign the cfq scheduler to the HDD device.  In RHEL7 the default I/O scheduler can change based on the selected tuned profile, which adds an additional layer of uncertainty if you're unaware of "tuned".  The default tuned profile is throughput-performance, which enables the deadline scheduler by default among other performance-related system settings.  However, if the default profile is changed to , e.g. virtual-host, the scheduler of choice becomes

SystemD and FIFO Sockets in RHEL7

There's a bug with a relevant discussion on systemd's approach to FIFO socket deletion. As of systemd-214 the issue with "stale" sockets was resolved by supplying the `RemoveOnStop` option to its corresponding `.service`. However, at the moment RHEL7 has systemd-208 as the default version; and I am seeing the following errors in `dmesg` output: systemd[1]: systemd 208 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ) systemd[1]: /usr/lib/systemd/system-generators/anaconda-generator exited with exit status 1. [ +0.056775] systemd[1]: [/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue 'RemoveOnStop' in section 'Socket' [ +0.000675] systemd[1]: [/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue 'RemoveOnStop' in section 'Socket' I'm not sure if LVM2 is referencing a feature that's not available in the default systemd version; AFAIK, my configurati…

Expanding LVM Partition in RHEL7

Scenario:  I've created a VM with a RHEL7 guest.  The partition layout is a standard, primary partition for /boot and LVM for the rest--namely, /usr, /var, /home, swap and / (rootfs).  After installing updates and some other packages, the /usr directory began to fill up.

In order to mitigate the situation, I created an additional primary partition with an XFS filesystem, as that is the preferred/default FS in RHEL7.

    # parted /dev/vda mkpart P3 xfs 14G 16G

The above command instructs "parted" to operate on the /dev/vda disk and create primary partition 3 with XFS filesystem starting at 14G and ending at 16G.  
Next, I added the physical partition to LVM with the following command: 

# pvcreate /dev/vda

Then, extend the volume group with the physical partition with: 

    # vgextend rhel /dev/vda3

and 

    # lvextend -L+2G /dev/rhel/usr

Finally, to grow the filesystem I executed 

    # xfs_growfs /dev/rhel/usr