Sunday, March 29, 2015

LVM_FS_Creation


[root@puppet tmp]# more my_LVM
# VG     FS      Size MPoint
 test_vg FS_WWW  500 /www
 test_vg FS_WWW2 500 /www2
 test_vg FS_WWW3 500 /www3
 test_vg FS_WWW4 500 /www4
[root@puppet tmp]# cat my_LVM.sh
#!/bin/sh
#
PATH=$PATH:/bin:/usr/bin; export PATH
echo "Please wait, filesystem creation task on progress ..."
sleep 5
cat my_LVM | grep -v "^#" | while read myvg myfs mysize mymnt
do
 lvremove /dev/${myvg}/${myfs}
 lvcreate -L ${mysize}M -n ${myfs} ${myvg} 2>/dev/null
 mkfs.ext4 /dev/${myvg}/${myfs} 2>/dev/null
 mkdir -p ${mymnt}
 echo "/dev/${myvg}/${myfs} ${mymnt} ext4 defaults 1 2" >>/etc/fstab
done
mount -a; df -h
echo "Task completed. Please verify"

No comments:

Post a Comment