#!/bin/bash # echo ${1} ${2} # echo "lvextend -L +${1}G ${2}" # echo "resize_reiserfs -s +${1}G ${2}" if [[ -e /usr/sbin/ext2online ]] then ext2expand="/usr/sbin/ext2online" elif [[ -e /sbin/resize2fs ]] then ext2expand="/sbin/resize2fs" fi if [[ -z $1 || -z $2 ]] then echo "Usage: increasefs.ksh {size in Gigs} {location of lv}" echo "Example: 'increasefs.ksh 20 /dev/mirr01vg/fedoralv' increases the fedoralv by 20G" else if [[ -e $2 ]] then fstype=$(file -sL $2 | awk '{print $2}') # fs=$(ls -l $2 | awk '{ print $11 }') # echo "fs=[${fs}]" # fstype=$( mount | grep $fs | awk '{ print $5 }') # echo "[$fstype]" if [[ $fstype == 'Linux' ]] then fstype=$(file -sL $2 | awk '{print $5}') fi if [[ $fstype == "reiserfs" ]] || [[ $fstype == 'ReiserFS' ]] then echo "lvextend -L +${1}G ${2}" lvextend -L +${1}G ${2} echo "resize_reiserfs -s +${1}G ${2}" resize_reiserfs -s +${1}G ${2} elif [[ $fstype == "ext3" ]] || [[ $fstype == "ext4" ]] then echo "lvextend -L +${1}G ${2}" lvextend -L +${1}G ${2} echo "ext2online ${2}" $ext2expand ${2} tune2fs -r 10000 ${2} else echo "Unknown filesystem type" fi else echo "$2 does not exsist" fi fi