The build in file editor does not enable folder upload, and only one file at a time. This makes copying a folder with multiple files and subfolders pretty cumbersome. I searched for a smarter method of doing it, but didn’t really find anything good, what to do?
Back to good old SSH
One of the add-ons available is “Terminal & SSH”, it gives the option to enable SSH, and by doing that we can use SSHFS (SFTP) to copy files and folders to our homeassistant.
Installation and configuration
Go to add-ons in the settings menu. Search for “terminal & ssh” and install it. When installed got to the configuration tab, add a pulic ssh key to the authorized keys option (prefered) or add a password. Save and restart terminal & SSH.
Verify
You are now able to login with username root, and the key/password you have configured in the previous step. When you have verified this is working, you are ready to connect with sshfs or sftp.
Mount
On linux sshfs is very easy to use, install with apt/yum/dnf or whatever you use, create a directory and do:
sshfs homeassistant:/ -i .ssh/id_file.pub -l root
You now have the filesystem from you homeassistant on the folder you created
On Windows I think sshfs is part of the base system since Windows 11. if not, you can use WinSCP
Once again my employeer forces me to work from an inferior platform, so what are my options to get the best possible working environment? Heres some tips to what I’ve done so far.
The windows terminal is one of the better things produced by Microsoft the last couple of years. I have already written a bit about it before, so search for windows terminal, and you will get the other articles. Even though the terminal is nice, there are some minor annoyances, when you are used to work in a bash environment.
No nice “inline” editor
Does not obey ctrl-d to exit the session
Does not have tab completion on entries in the ssh config file
To fix these three annoyances, we need to download vim from www.vim.org, install it and the rest is done creating and configuring a powershell profile, lets dive into it.
Not only do I have to work from a windows machine (my department does primarily FOSS solutions) I also don’t have any elevated permissions on my machine. IT proffesionlas are treated just the same as office workers š
This means I cannot install any software, besides whats picked by the Windows admins. Luckily vim is not picky, and you can install it in your own home folder. So lauch the installer and change the install path accordingly.
When vim is installed, all we need to do is to create a powershell profile file. The file has to be named Microsoft.PowerShell_Profile.ps1 and has to be placed under $home\Documents\PowerShell\ When placed here it will be a user specific profile, you can also do system-wide profiles, take a look at $pshome.
The RVGL launcher project has made it even easier to install and play the good old racing game ReVolt.
To play on ubuntu, there are some prereqs you need to have in place, and not all of them are mentioned on the official RVGL launcher. To help you, I have gathered everything in a one liner, just here:
When lauched, you may get an error about a lock file, dont worry, it’s only the first time you run it. Press “Download and Install” in th bottom, and you are ready to play. Remember to explore additional options in the rvgl launcher, it’s packed with cool features š
Gnome NetworkManager is awsome, supporting almost all kinds of VPN solutions, and all you need to do is install a plugin. My main issue is, that my customers often have a pre-build package (for Windows) containing a VPN client including configuration, so they actually dont know how it’s configured.
I usaually figure it out, and then its a breeze to click the network icon, select VPN and activate the connection, this is how it should be on all OS’es.
Unfortunatly there are some minor issues, one of them beeing that if you install the network-manager-vpnc module, you will have the option to create a VPNC based connection, and if you type everything right the first time, it will work. But….
You will not be able to edit the connection, it’s simply not listed when you select VPN settings (Ubuntu 22.04). using nmcli will list the connection, and you will be able to modify it, but I found another soluition, that is much easier.
nm-connection-editor
It will open a small GUI, letting you create, modify or delete all connections.
I have been a very satisfied user of autofs for several years. Using a laptop in multiple location without reboot, could often cause annoying timeouts with hard mounted NFS shares.
So I found autofs, which did a great job, especially the ghost option is nice, making you able to browse the filesystem when it’s not mounted, and only seeing a small delay when the autofs mounts it for you at your wish.
The above options will mount when you try to access the share, and it will unmount after 1 minute of idling, and the _netdev tells the system not to mount it before the network is ready. More or less the same functionality as autofs, but no need to install additional software.
when working with yaml files, indentation is crucial. You can setup vim to make it a little easier, like this:
:set ai ts=2 sw=2 expandtab
The above will set tabstop and shiftwidth to 2 spaces, and make the tab key create spaces instead of tabs. So with this config, you will type 2 spaces, whenever you press tab, just like yaml likes it.
So, you are trying to update your system and get this:
Requesting to save current system state ERROR couldn’t save system state: Minimum free space to take a snapshot and preserve ZFS performance is 20%. Free space on pool “bpool” is xx%
The zfs filesystem is creating a snapshot every time you install a new kernel, this will add up, and suddenly you are not able to update anymore, and you are seeing a lot of error caused by this. If you are unlucky and reboot, it might even brake your system!
Running Ubuntu with zfs will create a pool called bpool as your /boot device. Continuing I will refer to this as bpool.
To get an overview of your zfs pools, use this command: zfspool list
kasper@AsusPro:~$ zpool list NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT bpool 1.88G 1.64G 238M – – 32% 87% 1.00x ONLINE – rpool 114G 26.3G 87.7G – – 7% 23% 1.00x ONLINE–
As you see, my bpool pool is 87% filled up, I have a problem.
To get an overview of snapshots in the bpool pool, use this command: zfs list -t snapshot | grep bpool
Seems like zfs is not doing any housecleaning by itself, we need to help! To remove a snapshot, we need to destroy it. This is done with the destroy option, like this:
sudo zfs destroy /path/to/snapshot
To remove all snashots in the bpool, you can use the following:
for i in $(zfs list -t snapshot | grep bpool | cut -d ” ” -f 1);do sudo zfs destroy $i; done
This will destroy all snapshots and free up your bpool pool.
If you don’t want to remove all snapshots, pipe your snapshots listing into tail or head. You can add a creation column to the list like this:
zfs list -t snapshot -o name,creation -s creation
This will list your snapshots in order of creation date. Use wc -l to count them and use head to get x amount fewer.
zfs list -t snapshot -o name,creation -s creation | wc -l 20 for i in $(zfs list -t snapshot | grep bpool | cut -d ” ” -f 1 | head -15);do sudo zfs destroy $i; done
I did try to format the commands, but as usual Word Press make things so complicated to use, that i had to revert all the special formatting, instead of spending the entire day figuring out why html tags are not respected in “enlighter inline code”
Adding storage to servers is part of every day work. this can be anything from a virtual disk on a virtual machine, to LUN’s presented from some external storage system.
When the new disk has been added, ususally nothing happens. You need to scan for the new disk/disks in order to operate them. Theres a tool called rescan-scsi-bus.sh for doing this specific task, but sometimes you don’t have that, then you need to do it manually, and it’s actually not that difficult.
You then need to echo “- – -” to the scsi system. I have found a lot of different methods to do the same thing, a lot of them telling you to do something like: echo “- – -” >> /sys/class/scsi_host/hostxx/scan where xx can be anything, and sometimes there’s a lot, so typing all the different host numbers is not optimal. Then someone suggests a for loop, like: for i in $(/sys/class/scsi_host/hosts); do echo “- – -” /sys/class/scsi_host/host$i/scan; done
I have tried them all (I think) but in my opinion, the best and easiest solution is the one below, as it is pretty easy to remember:
echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan
List your newly installed disk with lsblk and partition them with fdisk
Sometimes someone forgets to unmount the CD drive of a VM. This will interfere with operation tasks like setting a host in maintenance mode or using Update Manager.
I recently had this issue, and the “update manager compliance check” told me that several VM’s where connected to a CD drive, which may interrupt the update process. I quickly found my favorite tool for vcenter management, the powerCLI. The quick and dirty oneliner ended up like this:
Replace %clustername% with your cluster name, and all your troubles will be over š
I have always loved oneliners. I have spent the part time of my time working in bash terminals, where the history has always been persistent. Luckily Microsoft has also seen the light, and history is now persistent (and searchable) in powershell. Search for a phrase using ctrl+r, search further back by pressing ctrl+r again. I’m sure you will learn to love it, if you don’t already do.
The default location for the docker data directory, when using overlay2 storage driver is /var/lib/docker. Maybe you want to move it to another location, and it’s actually pretty easy.
Stop the docker service: sudo systemctl stop docker.service
Copy the docker folder to the new location: sudo cp -rp /var/lib/docker /path/to/new/location The p in -rp will preserve ownership, permissions and timestamps
Tell the docker daemon about the new location by editing the /etc/docker/daemon.json file with the following:
{
"data-root": "/path/to/new/location"
}
4. Start the docker service: sudo systemctl start docker.service
Thats it, the docker directory has been moved.
The above guide is tested on Ubuntu 20.04, but will probably be very much alike on other flavours.