I am trying to move/remap the [/usr] directory to another disk as the following:
From: [/dev/sda1/root [/]] to: [dev/sdb1/usr [/dev/mapper/redhat-usr]
So, I have tried the following steps:
Calculated the current [/usr] directory disk space usage:
du -sh /usr
Checked for available space:
vgdisplay
fdisk -l
Added a new disk or partition to the system, then initialise for use by LVM:
pvcreate /dev/sdb1
Created a volume group "redhat":
vgcreate redhat /dev/sdb1
Created a logical volume in vg "redhat":
lvcreate -L 8G --name usr redhat
Created a new filesystem for LV usr:
mkfs.xfs /dev/mapper/redhat-usr
Mounted new LV [usr] to a temporary directory and copy contents of [/usr] into it:
mkdir /tmp/usr
mount /dev/mapper/redhat-usr /tmp/usr
rsync -avz /usr/ /tmp/usr/
Verified the contents of LV [usr] matches that of the [/usr] directory:
diff /usr/ /tmp/usr/
Configuried the system to permanently mount LV [usr]:
blkid
vi /etc/fstab
UUID=[uuid of [usr]] /usr xfs defaults 0 0
Restored SELinux Context:
restorecon -vvFR /usr
Added the new VG/LV names to /etc/default/grub:
vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rd.lvm.lv=redhat/usr rhgb quiet"
Regenerated the GRUB2 configuration (Legacy based machine):
grub2-mkconfig -o /boot/grub2/grub.cfg
Rebuilt the initial RAM disk image file:
cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak
dracut -v -f /boot/initramfs-$(uname -r).img $(uname -r)
Finally, after rebooting the node. It came up but, when I try to login via Xterm the following message appears:
/bin/bash: Permission denied
Thanks in advance