VMware Cloud Community
Sean_Cottrell
Contributor
Contributor

ESX 4 Mounting USB drive (mount /mnt/flash)

Hello,

On my ESX 3.5 Hosts, I wrote a script that automatically mount an USB Flash Drive, then copy some VMs from my SAN onto the USB Flash Drive.

However, now that we are useing ESX 4u1, the mount /mnt/flash command no longer works.

I was wondering if anyone could give me any assistance with this?

Here is my script: (We have two USB Flash Drives, one that 32GB and the other that is 64GB)

#!/bin/sh

echo "Un-Mounting /mnt/flash..."

umount -l -f /mnt/flash

echo "Un-mounting /mnt/flash1..."

umount -l -f /mnt/flash1

echo "Mounting /mnt/flash..."

mount /mnt/flash

echo "Mounting /mnt/flash1..."

mount /mnt/flash1

echo "Checking USB32 on FLASH"

+if +

then

+ echo " USB32 not found."+

+ +

else

+ echo " USB32 found. Copying..."+

+ +

+ time cp -r -u -v /vmfs/volumes/2-210-212/usbvault/* /mnt/flash+

+ +

fi

echo "Checking USB64 on FLASH"

+if +

+ then+

+ echo " USB64 not found. EXIT"+

+ +

+ else+

+ echo " USB64 found. Copying..."+

+ +

+ time cp -r -u -v /vmfs/volumes/2-210-212/usbvault2/* /mnt/flash+

+ fi+

echo "Checking USB32 on FLASH1"

+if +

then

+ echo " USB32 not found."+

else

+ echo " USB32 found. Copying..."+

+ +

+ time cp -r -u -v /vmfs/volumes/2-210-212/usbvault/* /mnt/flash1+

fi

echo "Checking USB64 on FLASH1"

+ if +

+ then+

+ echo " USB64 not found. EXIT"+

+ +

+ else+

+ echo " USB64 found. Copying..."+

+ +

+ time cp -r -u -v /vmfs/volumes/2-210-212/usbvault2/* /mnt/flash1+

+ fi+

echo "Un-mouting /mnt/flash..."

umount /mnt/flash

echo "Un-mounting /mnt/flash1..."

umount /mnt/flash1

echo "Displaying df output..."

df

Reply
0 Kudos
1 Reply
Sean_Cottrell
Contributor
Contributor

In my first post, some of the script code was stripped off when I submitted the post. Hopefully this one works. Smiley Happy

NOTE: in the IF lines, please substitue A with a left bracket and B for a right bracket. These sections of the code are the part that are getting stripped when I submit the post.

#!/bin/sh

echo "Un-Mounting /mnt/flash..."

umount -l -f /mnt/flash

echo "Un-mounting /mnt/flash1..."

umount -l -f /mnt/flash1

echo "Mounting /mnt/flash..."

mount /mnt/flash

echo "Mounting /mnt/flash1..."

mount /mnt/flash1

echo "Checking USB32 on FLASH"

if A ! -e "/mnt/flash/USB32.TXT" B

then

echo " USB32 not found."

else

echo " USB32 found. Copying..."

time cp -r -u -v /vmfs/volumes/2-210-212/usbvault/* /mnt/flash

fi

echo "Checking USB64 on FLASH"

if A ! -e "/mnt/flash/USB64.TXT" B

then

echo " USB64 not found. EXIT"

else

echo " USB64 found. Copying..."

time cp -r -u -v /vmfs/volumes/2-210-212/usbvault2/* /mnt/flash

fi

echo "Checking USB32 on FLASH1"

if A ! -e "/mnt/flash1/USB32.TXT" B

then

echo " USB32 not found."

else

echo " USB32 found. Copying..."

time cp -r -u -v /vmfs/volumes/2-210-212/usbvault/* /mnt/flash1

fi

echo "Checking USB64 on FLASH1"

if A ! -e "/mnt/flash1/USB64.TXT" B

then

echo " USB64 not found. EXIT"

else

echo " USB64 found. Copying..."

time cp -r -u -v /vmfs/volumes/2-210-212/usbvault2/* /mnt/flash1

fi

echo "Un-mouting /mnt/flash..."

umount /mnt/flash

echo "Un-mounting /mnt/flash1..."

umount /mnt/flash1

echo "Displaying df output..."

df

Reply
0 Kudos