The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,603 other followers

Keeping your root visorfs clean: point the path to your own binaries stored on a vmfs volume

Posted by jpluimers on 2019/04/26

Some interesting commands derived from [WayBackESXi/ESX error: No free space left on device (1007638) | VMware KB:

  • finding large files:
    find / -path "/vmfs" -prune -o -type f -size +50000k -exec ls -lh '{}' \;
  • finding space on the root file system (which is not listed in df -h):
    stat -f /

This was in the process of trying to keep my local binaries out of [WayBackVisorFS: A Special-purpose File System for Efficient Handling of System Images – VMware Labs as it is inherently small in size (both total size and number of inodes) as it is a RAM disk based file system.

Based on that, at [WayBackTrouble shooting – esx.problem.visorfs.ramdisk.full – DefinIT I found this even more useful statement vdf -h | grep "%\|Ramdisk" which shows the exact usage of what’s in this filesystem. Example output on one of my systems:

# vdf -h | grep "%\|Ramdisk"
Ramdisk                   Size      Used Available Use% Mounted on
root                       32M        1M       30M   6% --
etc                        28M      184K       27M   0% --
opt                        32M        0B       32M   0% --
var                        48M      352K       47M   0% --
tmp                       256M        4K      255M   0% --
iofilters                  32M        0B       32M   0% --
hostdstats                678M        4M      673M   0% --

The easiest is not to store them in the root file system at all, but then you need to alter the default path:

# echo $PATH
/bin:/sbin

Since my local binaries are at /vmfs/volumes/Samsung512NVME/local-bin/, I wanted to persist this path change:

export PATH=$PATH:/vmfs/volumes/Samsung512NVME/local-bin/

Basically you can do this with any current directory on your system: export PATH=$PATH:`pwd`

The easiest way to persist that path is to ensure you can shoehorn the effect in a file that gets started during bootup.

The standard – but unsupported – way to do that is shown for instance by:

Final solution

So, edit vi /etc/rc.local.d/local.sh, then shutdown all your VMs and reboot the system to verify the effects. However inserting that export isn’t enough. This is the line you need to add before the exit 0:

sed -i -e 's!PATH=/bin:/sbin!PATH=/bin:/sbin:/vmfs/volumes/Samsung512NVME/local-bin/!' /etc/profile

Related

  • [WayBack] ESXi: Aliases definieren › /dev/blog/ID10T
  • [Archive.is] Solved: How to keep a .profile in / of ESXi? |VMware Communities

    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…

    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!

    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…

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: