Category Archives: SSH

Thin provision VM and thin provisions Equallogic LUN – Reclaim the space

I have been monitoring a growing thin provisioned LUN for some time trying to find the cause of the growth and why we never see the LUN reduce in size. I have been running some Veeam jobs for replication and noticed that when I changed the destination datastore for these replicated machines to the thin LUN, that volume would continue to grow and never reduce in size. I suspect the 2 snapshots (restore points) are the cause of the growth, since when I check on my vsphere client in Storage view on that LUN, the total snapshot space is about the same size as the growth each night when the job runs.
To remedy this, I migrated all of the critical machines onto another LUN. I then SSH’d onto one of the hosts and cd’d into the ‘/vmfs/volumes/’ directory –

cd /vmfs/volumes
ls

If you type ‘ls’ you will see all of the datastores attached to this host and you should see the name of the volume in question. Once you change directory into that folder you will actually go into the name of the folder (some symbolic link in place). We need to reclaim the space used on this LUN and we can do that with the unmap command.

esxcli storage vmfs unmap -u xxxxxxxx-xxxxxxxx-xxxx-xxxxxxxxxxxx

You will see a higher iops load but monitoring the host and other volumes I am not seeing much difference in load. All the VM’s located on the LUN I am reclaiming the space from are running fine, but since I am reclaiming TB’s of space, it is taking a while!

ssh-keygen

Scenario; set up ssh keys to machine so that you do not require a password for use with something like scp.

First you need a slave user. If you ‘adduser’ on both machines and pick a user name. Make sure they have a shell account but do not require authentication using a password.

On the remote machine you need to run ssh-keygen when you have logged in as that user. You can do something like – su username. Once you run that you will see in /home/username/.ssh/id_rsa.pub you now have a public key, which you need to copy onto the following file on the remote machine –

/home/username/.ssh/authorized_keys

You then need to ensure permissions are set properly on all the files to the user you created. chmod -R username /home/username/.ssh

Do this on both machines.

You can then – su username on the local machine and try a scp command and it should not prompt you for the password.

 

You can either then run a script via the crontab as that user, or if you like something like this should work –

su username -c “scp -B remotehost:/etc/somefile /tmp”