VMware Cloud Community
Vampire
Contributor
Contributor
Jump to solution

How to rename a datastore via command during automatic installation

Hi, during automatic installation of my esx servers and post exec skript I wan't to rename the local datastore of esx 3.5. I tried to find a solution here in the communities and also tried the following commands

  • vimsh -n -e "/hostsvc/datastore/rename oldname newname"

  • vmware-vim-cmd hostsvc/datastore/rename oldname newname"

but nothing happens when I use these commands and I get no error message.

Does anyone know what I'm doing wrong and how I can rename local datastores via command line?

Thankx

Frank

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

We have a set of post-scripts that are executed upon the first reboot after the build, by default the local datastore should be named storage1

You can do the following:

ln -sf $(readlink -f /vmfs/volumes/storage1)  /vmfs/volumes/$(hostname -s)-local-storage

or to whatever naming convention you would like

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

View solution in original post

0 Kudos
3 Replies
espi3030
Expert
Expert
Jump to solution

It's been a while since I've done this, you could try:

ln -sf `readlink -f /vmfs/volumes/<storagename>` /vmfs/volumes/$HOSTNAME-Local

I believe this will only work on a host that has not yet been to vCenter.

Hope this helps!

Message was edited by: espi3030

0 Kudos
atbnet
Expert
Expert
Jump to solution

I dont know if this can be dont during the install process. You would need to now the name to start with but at that point it wont be generated. I you look when it first boots I think thats when the VMFS is created in a run_once script. Maybe you coudl find that and edit it?

It can be done in the service console as so...

ls -laF /vmfs/volumes/



Note down the id of the volume linked to the datastore you want to rename (e.g. /vmfs/volumes/477c7-634968-3c1a-001...).




rm -rf /vmfs/volumes/oldname


ln -s /vmfs/volumes/477c7-634968-3c1a-001... /vmfs/volumes/newname

</div>

More info if needed... http://www.vmadmin.co.uk/resources/35-esxserver/52-vmfsdatastore

Andy, VMware Certified Professional / VMware vExpert Award 2009

Help, Guides and How Tos

If you found this information useful please award points using the buttons at the top of the page accordingly.

Andy Barnes
VCP / VCA-DT / MCITP:EA / CCIA
Help, Guides and How Tos... www.VMadmin.co.uk

If you found this information useful please award points using the buttons at the top of the page accordingly.
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

We have a set of post-scripts that are executed upon the first reboot after the build, by default the local datastore should be named storage1

You can do the following:

ln -sf $(readlink -f /vmfs/volumes/storage1)  /vmfs/volumes/$(hostname -s)-local-storage

or to whatever naming convention you would like

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

0 Kudos