I had carelessly allowed the root filesystem on one of my Ubuntu servers to become full. Here's how I recovered from it.
Setup: Ubuntu server 16.04, entire disk for LVM, all disk space assigned to one volume group (VG), root (4GB) and swap (1.5GB) in their own logical volumes (LV), with the remaining disk space allocated to LXD containers using LVM thin provisioning.
The root filesystem, from here on referred to as root if the context is clear, had become full because I hadn't been purging old Linux kernels. Being full, the filesystem was then unable to complete "apt-get autoremove". I needed to add some space to root, which I took from swap.
Following commands were performed online with the server in multi-user mode. First, turn off swap.
Then, reduce the size of swap LV by 1GB.
Add the 1GB taken to root; the command grows the root LV and resizes the filesystem within the LV.
"df -k" shows that root now has an additional 1GB and is no longer full. Fix any broken apt dependencies and purge the old Linux kernels.
"df -k" now shows that root has even more free space.
Now I set about to give the 1GB back to swap. While it is possible to grow root's LV and filesystem online, shrinking root needs to be done offline by booting from live DVD into single user mode at the server console. (The server runs virtually somewhere "in the cloud". Console access is via VNC. I use the Linux client Vinagre. Obligatory Smalltalk content: Vinagre is also the client I use to connect to RFBServer running in the Pharo image that runs this blog.)
For below commands, I'm at single user mode, booted from live DVD, with all server filesystems unmounted. First, check the root filesystem.
Remember the root filesystem is contained within the root LV. Now resize the filesystem. Here "4G" refers to the absolute size.
Next, resize the root LV.
Check root filesystem again.
Now, give 1GB back to swap.
Reboot into multi-user mode, turn swap back on, and look around.
This incident happened to the server that is running this blog. That you are now reading this blog post means that the above procedure succeeded. :-P
In the previous post I mentioned using Iceberg successfully. The code I was pushing is SLRCalculator, a simple linear regression calculator, written to take Oleksandr Zaytsev's DataFrame library for a spin, by way of porting Jason Brownlee's excellent simple linear regression in Python to Pharo.
Firstly, install DataFrame. This also pulls in Roassal.
SLRCalculator implements mean, variance, covariance, coefficients etc, and also incorporates the Swedish automobile insurance dataset used by Jason in his Python example.
The computation for covariance also uses DataFrame.
Let's see how to use SLRCalculator to perform linear regression, with graphing using Roassal. First declare the variables and instantiate some objects:
Next, split the data set into training and test subsets. Splitting without shuffling means to always take the first 60% of the data for training.
Set up for graphing. Load `allData' as points.
Create the points to plot the linear regression of the full data set, using the coefficients computed from the training subset.
Make the plot look nice.
Putting the code altogether:
Copy/paste the code into a playground, press shift-ctrl-g...
On a laptop that I've just rebuilt recently, I created and have been using an ED25519 SSH key pair, including with Github. Iceberg doesn't work with it though, throwing the error 'LGit_GIT_ERROR: No ssh-agent suitable credentials found". This is because Iceberg uses libgit2, which uses libssh2, which apparently doesn't support ED25519 keys. Created a new RSA key pair, registered it with Github, and Iceberg works.
- OS = Linux Mint 18.1
- Pharo image = 60510-64
- Pharo VM = pulled from GH opensmalltalk-vm today and built on said laptop
I have started a booklet on Pharo, hopefully the first of, um, more than one. It is entitled RedditSt20, on my fork and extension of Sven Van Caekenberghe's excellent "Reddit.st in 10 elegant classes", to cover the following in another 10 or so classes:
- username/password authentication
- 2-factor authentication
The book is being written using Pillar, of course. Note that the Pharo 5 version of Pillar that I downloaded from InriaCI doesn't work - the supporting makefiles aren't able to obtain the output of "./pillar introspect <something>". Use the Pharo 6 version.