VMware Cloud Community
spham68
Contributor
Contributor

Unable to run bash script on ESXi 5.1 to reclaim storage

Hi,

Had anyone able to successful run bash script to reclaim storage from SAN on ESXi 5.1?

Here is script I got from this web https://kallesplayground.wordpress.com/2014/04/03/storage-reclamation-part1/

Getting this error message ./reclaim_storage.sh: cd: line 11: can't cd to /vmfs/volumes/mb-view-xtio-00:"

It was not able to cd in directory through the for loop

Any advice? Thank you.  Steve

Reply
0 Kudos
2 Replies
homerzzz
Hot Shot
Hot Shot

The "ls" adds a ":" to the end of your path. That is why the "cd" fails

Reply
0 Kudos
spham68
Contributor
Contributor

That is from the echo line. If I do this then it should not give me echo line with :

#!/bin/sh

for datastore in `ls /vmfs/volumes/view-xtio*`

do

for i in 10 20 30 40 50 60 70 80 90 95

do

cd $datastore; vmkfstools -y $i >> /vmfs/volumes/vmax/scripts/logs/reclaim_storage.log

sleep 300

done

done

Reply
0 Kudos