paulehoffman
Contributor
Contributor

How to keep a .profile in / of ESXi?

Jump to solution

Greetings. On an ESXi 6 box, I enter a .profile file in / with a few simple aliases in it. It remains just fine when I log out from SSH and log in again. However, if I restart the box, the file disappears. How do I tell ESXi on bootup to not remove this file?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JarryG
Expert
Expert

ESXi does not remove that file on boot-up, it simply does not save it. ESXi runs from memory. So if you created some file (i.e. /.profile) it is only in "memory-disk", not in disk-image which is loaded again at the next boot-up.

Either create custom vib and install it as every other, or use rc.local which is persistent (any changes you make to this file survive boot-up). You can create & save that file somewhere else and use rc.local to copy it to /, or use rc.local with shell commands to create .profile at every boot-up.

Wait a minute, you are using ESXi 6.0, right? I'm not sure if there is /etc/rc.local, but it used to be in 5.0/5.5...

_____________________________________________ If you found my answer useful please do *not* mark it as "correct" or "helpful". It is hard to pretend being noob with all those points! 😉

View solution in original post

4 Replies
JarryG
Expert
Expert

ESXi does not remove that file on boot-up, it simply does not save it. ESXi runs from memory. So if you created some file (i.e. /.profile) it is only in "memory-disk", not in disk-image which is loaded again at the next boot-up.

Either create custom vib and install it as every other, or use rc.local which is persistent (any changes you make to this file survive boot-up). You can create & save that file somewhere else and use rc.local to copy it to /, or use rc.local with shell commands to create .profile at every boot-up.

Wait a minute, you are using ESXi 6.0, right? I'm not sure if there is /etc/rc.local, but it used to be in 5.0/5.5...

_____________________________________________ If you found my answer useful please do *not* mark it as "correct" or "helpful". It is hard to pretend being noob with all those points! 😉

View solution in original post

Nithy07cs055
Hot Shot
Hot Shot

as per my understanding if you looking for backing up the esxi configuration and changes made, use the below command, the changes should be saved

# backup ESXi configuration to persist changes 

/sbin/auto-backup.sh

Thanks and Regards, Nithyanathan R Please follow my page and Blog for more updates. Blog : https://communities.vmware.com/blogs/Nithyanathan Twitter @Nithy55 Facebook Vmware page : https://www.facebook.com/Virtualizationworld
0 Kudos
paulehoffman
Contributor
Contributor

I edited /etc/rc.local.d/local.sh to copy the file that I keep on one of my datastores. After reboot, it worked fine. (So, yes, this does work in 6.0.) Thanks!

0 Kudos
JarryG
Expert
Expert

I'm glad it worked for you. BTW you are right: instead of single file /etc/rc.local (as in 5.0) there is now the whole sub-dir /etc/rc.local.d/ but functionality is the same...

_____________________________________________ If you found my answer useful please do *not* mark it as "correct" or "helpful". It is hard to pretend being noob with all those points! 😉
0 Kudos