Reclaiming space on VMs

Here are some great posts about reclaiming unused space in esxi.




To get automatic space reclamation you’ll need:

  • ESXi 6.5 Update 1
  • iSCSI volume formatted with VMFS6. (I think VMFS5 works but there are caveats.)
  • Thin provisioned disks.
  • discard option enabled on mount points for your Linux guests.

My new esxi 6.5 host connecting to iscsi volume on FreeNAS 11.0 works like a charm at least when I force and UNMAP with sudo fstrim /

I haven’t had it enabled long enough to watch it work it’s magic, but apparently this means no more filling the drive with zeros, then punching a hole while the machine is offline.

UPDATE 2018-01-20: The magic happens immediately. You can see the updated datastore size immediately after deleting a large file in a linux VM.

It also means that as much as I hate setting up iSCSI, I’m not going to go back to NFS if it doesn’t have this.


Brave on ElementaryOS

I wanted to install Brave on a test ElementaryOS install and I’d rather use apt instead of the .deb file that’s on Brave’s main site. Brave does have a repo available but it won’t work with ElementaryOS out of the box. Here are the instructions.

The trick is here: “You will want to make sure the bottom line of /etc/apt/sources.list lists a new repository and doesn not contain the word lsb_release.”

When you run the two provided commands:

curl | sudo apt-key add -
echo "deb [arch=amd64] `lsb_release -sc` main" | sudo tee -a /etc/apt/sources.list

…’loki’ is inserted into the new source in /etc/apt/sources.list. Replace it with ‘xenial’.

Brave installed just fine with apt after that.

OpenVPN and WTF is it with linux?

The more I work with Linux the more I’m convinced that the problem with the open source model is precisely the opposite of what I would think it would be. What I think would happen is that the heavy lifting code, the code that actually does work, would develop slower than the UI/UX code. But what I see happening is that the UI or UX code lags far behind the heavy-lifting code.

My example is OpenVPN. Now, I’m not a complete noob when it comes to linux. I’m a network admin (mostly MS) by trade and while certs can sometimes still confuse me at times, I get around fairly well. However, installing and configuring OpenVPN on an Ubuntu 14.04 box was beyond a pain in the ass. If it wasn’t for someone else writing a tutorial about how to do something vaguely similar to what I wanted to accomplish that mostly fits the distro I’m using in addition to myself being slightly familiar with Linux, I never would have been able to get my iPhone vpn’d into my home network.

I’m not trying to do anything out of the ordinary; however, in the Linux world, doing the mundane means you will still have a fight on your hands. It wouldn’t be sacrilege to put in a couple wizards to help configure OpenVPN in the most common configurations.

I don’t know if developing good UI/UX is tedious and boring. Or if projects change their methods so often that no one can make decent UI without everything changing underneath them.

I finally got OpenVPN configured and my phone connected up. I used this tutorial, and it’s good. But for Ubuntu 14.04 I would recommending adding the following addendum:

  • Make your life easier while configuring OpenVPN and do everything in root (sudo su) I’m not sure why, but the scripts won’t run under regular sudo.

That single tidbit of knowledge would have saved me an hour and a half of my time.

LVM in a Virtual Environment

I have been fighting against my owncloud server the past couple of nights. The drive is too small and I need to grow the disk. Now, I’m used to a Windows environment and this is a pretty simple task: Grow the disk in esxi, open Disk Management, right click, Extend. Profit. Easy-peesy. Even the command line in Windows is fairly straight forward: diskpart, list partitions, select partition #, extend. (Online resizing of boot/system partitions arrived with Server 2008.)

Not so much in Ubuntu. Now, I’m also dealing with LVM which adds annoyances and I’m left to wonder, “Why am I even using LVM in a virtual environment?” I’m late to the game figuring this stuff out. I’ve found other posts that share my sentiment. Then again, my Linux skills aren’t that great.

I did some mucking around with a desktop version of 15.04. I think my final choice will be to move the swap to a file (which I will name pagefile.sys just to annoy Linux fans), then delete the swap partitions. This will allow me to have a single partition and resize it easily: Grow disk in esx, resize the partition with parted*, reboot**, resize the filesystem with resize2fs.

I’m not finding anything that says I can get rid of LVM volumes and convert them to a partition scheme. Unfortunately, I’ll probably end up with a rebuild.

*I resized the partition while mounted with parted. It gave me a warning but it did work.
**I read somewhere that I’d need to reboot after resizing the partition if I did that while it’s mounted. I didn’t test to see if it was necessary.

This page was very useful for changing between a swap partition and swap file.

Re-run Your Boot Loader

While cleaning out some old kernels in the wiki server I built for work, I ran across this suspicious message:

The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old
 you may need to re-run your boot loader[grub]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old
 you may need to re-run your boot loader[grub]

It made me a little nervous to do a reboot. I’m not sure if anything was broken or would have been trouble, so I didn’t reboot. I found several blog and forum posts that said running the command, sudo update-grub would fix it. After running the command and rebooting, everything is still working.