SysAdmin

Simple script to scan LUNs, create pv, vg, lv, mounting it and creating new entries in fstab in RHEL. (Note:- Probably need slight modification as pe

JJ
Jobin Joseph · Founder and CEO
·Published 16 October 2013·1 min read

#!/bin/bash MPATH=0 for i in `ls /sys/class/scsi_host/host*/scan`; do echo “- – -” > $i; done sleep 5 multipath -ll echo -n “enter mpath:” read MPATH pvcreate /dev/mapper/${MPATH} vgcreate -s 32 $VG /dev/mapper/${MPATH} lvcreate -l 100%VG -n $LV $VG mkfs.ext4 /dev/mapper/${VG}-${LV} echo -n “Enter mount point directory full path:” read MOUNTPOINT if [ ! -d $MOUNTPOINT ]; then mkdir $MOUNTPOINT; fi mount /dev/mapper/${VG}-${LV} $MOUNTPOINT echo -e “/dev/mapper/${VG}-${LV}” “t” “${MOUNTPOINT}” “t” “ext4” “t” “defaults” “t” “1 2” >> /etc/fstab

Jobin Joseph
Jobin Joseph, Founder and CEO
5x AWS Certified, ISO 27001:2022 Lead Implementer, 17+ years building cloud infrastructure for regulated industries.
About Jobin →

Reading this because your AWS bill or uptime is a problem?

30 minutes, direct with the founder, no sales pitch: one specific recommendation for your AWS workload.

Book a free 30-minute review
30 min Free Consultation →