itcommitting last two articles... it's been a while! - monochromatic - monochromatic blog: http://blog.z3bra.org Err z3bra.org 70 hgit clone git://z3bra.org/monochromatic URL:git://z3bra.org/monochromatic z3bra.org 70 1Log /scm/monochromatic/log.gph z3bra.org 70 1Files /scm/monochromatic/files.gph z3bra.org 70 1Refs /scm/monochromatic/refs.gph z3bra.org 70 i--- Err z3bra.org 70 1commit e0dc7c530b97d3badc993653019256588b996536 /scm/monochromatic/commit/e0dc7c530b97d3badc993653019256588b996536.gph z3bra.org 70 1parent 3067822909d9daf2fe6e62707496bc530a280488 /scm/monochromatic/commit/3067822909d9daf2fe6e62707496bc530a280488.gph z3bra.org 70 hAuthor: z3bra URL:mailto:willy@mailoo.org z3bra.org 70 iDate: Tue, 9 Jun 2015 21:57:23 +0200 Err z3bra.org 70 i Err z3bra.org 70 icommitting last two articles... it's been a while! Err z3bra.org 70 i Err z3bra.org 70 iDiffstat: Err z3bra.org 70 i A 2015/04/the-wrong-sysadmin.txt | 170 +++++++++++++++++++++++++++++++ Err z3bra.org 70 i A 2015/06/vomiting-colors.txt | 75 +++++++++++++++++++++++++++++++ Err z3bra.org 70 i M config.mk | 4 +++- Err z3bra.org 70 i M index.txt | 2 ++ Err z3bra.org 70 i Err z3bra.org 70 i4 files changed, 250 insertions(+), 1 deletion(-) Err z3bra.org 70 i--- Err z3bra.org 70 1diff --git a/2015/04/the-wrong-sysadmin.txt b/2015/04/the-wrong-sysadmin.txt /scm/monochromatic/file/2015/04/the-wrong-sysadmin.txt.gph z3bra.org 70 it@@ -0,0 +1,170 @@ Err z3bra.org 70 i+# [The wrong sysadmin](#) Err z3bra.org 70 i+## — 28 April, 2015 Err z3bra.org 70 i+ Err z3bra.org 70 i+*NOTE: This was replicated from the [Unix Err z3bra.org 70 i+Diary](http://nixers.net/showthread.php?tid=1539&pid=11836#pid11836) thread at Err z3bra.org 70 i+[http://nixers.net](http://nixers.net)* Err z3bra.org 70 i+ Err z3bra.org 70 i+Dear Unix diary, Err z3bra.org 70 i+ Err z3bra.org 70 i+today I've been a bad sysadmin. Err z3bra.org 70 i+It just happened. I host my own git repository, and earlier this evening I was working on my crux port tree, when I decided to commit and push my work. But this time, something went wrong and git didn't let me push any reference. Amongst all the messages returned by git, I saw this one: Err z3bra.org 70 i+ Err z3bra.org 70 i+ remote: fatal: write error: No space left on device Err z3bra.org 70 i+ Err z3bra.org 70 i+Fucking shit. I instantly imagine what's happening: my /var partition wasn't correctly sized upon creation. This is where I host my website, gopherhole, git repo, pictures, videos, ... Every 'production' service. And after serving me well for several years, it's now full. Err z3bra.org 70 i+ Err z3bra.org 70 i+Hopefully, I had setup all my partitions on top of LVM, and let like 200GiB available, just in case things go wrong. And they did. Err z3bra.org 70 i+ Err z3bra.org 70 i+So here am I, staring at my red prompt, typing a few commands: Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# df -h Err z3bra.org 70 i+ Filesystem Size Used Available Use% Mounted on Err z3bra.org 70 i+ mdev 1.0M 0 1.0M 0% /dev Err z3bra.org 70 i+ shm 499.4M 0 499.4M 0% /dev/shm Err z3bra.org 70 i+ /dev/dm-1 4.0G 797.9M 3.2G 20% / Err z3bra.org 70 i+ tmpfs 99.9M 208.0K 99.7M 0% /run Err z3bra.org 70 i+ cgroup_root 10.0M 0 10.0M 0% /sys/fs/cgroup Err z3bra.org 70 i+ /dev/sda1 96.8M 14.5M 77.3M 16% /boot Err z3bra.org 70 i+ /dev/mapper/vg0-var 50.0G 50.0G 20.0K 100% /var Err z3bra.org 70 i+ /dev/mapper/vg0-home 100.0G 12.9G 85.2G 13% /home Err z3bra.org 70 i+ /dev/mapper/vg0-data 600.0G 346.7G 252.1G 58% /data Err z3bra.org 70 i+ tmpfs 499.4M 0 499.4M 0% /tmp Err z3bra.org 70 i+ tmpfs 499.4M 32.4M 467.0M 6% /home/z3bra/tmp Err z3bra.org 70 i+ /dev/mapper/vg0-data 600.0G 346.7G 252.1G 58% /var/lib/mpd/music Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# mount | grep /var Err z3bra.org 70 i+ /dev/mapper/vg0-var on /var type xfs (rw,relatime,attr2,inode64,noquota) Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# lvs Err z3bra.org 70 i+ LV VG Attr LSize Err z3bra.org 70 i+ data vg0 -wi-ao---- 600.00g Err z3bra.org 70 i+ home vg0 -wi-ao---- 100.00g Err z3bra.org 70 i+ root vg0 -wi-ao---- 4.00g Err z3bra.org 70 i+ swap vg0 -wi-ao---- 1.00g Err z3bra.org 70 i+ var vg0 -wi-ao---- 50.00g Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# vgs Err z3bra.org 70 i+ VG #PV #LV #SN Attr VSize VFree Err z3bra.org 70 i+ vg0 1 5 0 wz--n- 931.41g 176.41g Err z3bra.org 70 i+ Err z3bra.org 70 i+Ok, so it's not the first time this happens, remember? You already grew your /home partition, and it went good! Just do the same with /var! It works without a reboot! Err z3bra.org 70 i+ Err z3bra.org 70 i+What was those commands again? Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# lvextend -L +20G vg0/var Err z3bra.org 70 i+ Extending logical volume var to 70.00 GiB Err z3bra.org 70 i+ 63e74d07f000-63e74d2c1000 r-xp 00000000 fd:01 8430401 /lib/libdevmapper.so.1.02: mlock failed: Out of memory Err z3bra.org 70 i+ 63e74d2c6000-63e74d4cb000 r-xp 00000000 fd:01 8430404 /lib/libdevmapper-event.so.1.02: mlock failed: Out of memory Err z3bra.org 70 i+ Logical volume var successfully resized Err z3bra.org 70 i+ Internal error: Reserved memory (9064448) not enough: used 9084928. Increase activation/reserved_memory? Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# lvs Err z3bra.org 70 i+ LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Err z3bra.org 70 i+ data vg0 -wi-ao---- 600.00g Err z3bra.org 70 i+ home vg0 -wi-ao---- 100.00g Err z3bra.org 70 i+ root vg0 -wi-ao---- 4.00g Err z3bra.org 70 i+ swap vg0 -wi-ao---- 1.00g Err z3bra.org 70 i+ var vg0 -wi-ao---- 70.00g Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# xfs_growfs -d /var Err z3bra.org 70 i+ meta-data=/dev/mapper/vg0-var isize=256 agcount=4, agsize=3276800 blks Err z3bra.org 70 i+ = sectsz=4096 attr=2, projid32bit=1 Err z3bra.org 70 i+ = crc=0 Err z3bra.org 70 i+ data = bsize=4096 blocks=13107200, imaxpct=25 Err z3bra.org 70 i+ = sunit=0 swidth=0 blks Err z3bra.org 70 i+ naming =version 2 bsize=4096 ascii-ci=0 ftype=0 Err z3bra.org 70 i+ log =internal bsize=4096 blocks=6400, version=2 Err z3bra.org 70 i+ = sectsz=4096 sunit=1 blks, lazy-count=1 Err z3bra.org 70 i+ realtime =none extsz=4096 blocks=0, rtextents=0 Err z3bra.org 70 i+ data blocks changed from 13107200 to 18350080 Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# df -h Err z3bra.org 70 i+ Filesystem Size Used Available Use% Mounted on Err z3bra.org 70 i+ mdev 1.0M 0 1.0M 0% /dev Err z3bra.org 70 i+ shm 499.4M 0 499.4M 0% /dev/shm Err z3bra.org 70 i+ /dev/dm-1 4.0G 797.9M 3.2G 20% / Err z3bra.org 70 i+ tmpfs 99.9M 208.0K 99.7M 0% /run Err z3bra.org 70 i+ cgroup_root 10.0M 0 10.0M 0% /sys/fs/cgroup Err z3bra.org 70 i+ /dev/sda1 96.8M 14.5M 77.3M 16% /boot Err z3bra.org 70 i+ /dev/mapper/vg0-var 70.0G 50.0G 20.0G 71% /var Err z3bra.org 70 i+ /dev/mapper/vg0-home 100.0G 12.9G 85.2G 13% /home Err z3bra.org 70 i+ /dev/mapper/vg0-data 600.0G 346.7G 252.1G 58% /data Err z3bra.org 70 i+ tmpfs 499.4M 0 499.4M 0% /tmp Err z3bra.org 70 i+ tmpfs 499.4M 32.4M 467.0M 6% /home/z3bra/tmp Err z3bra.org 70 i+ /dev/mapper/vg0-data 600.0G 346.7G 252.1G 58% /var/lib/mpd/music Err z3bra.org 70 i+ Err z3bra.org 70 i+Phew... I'm safe now! So what the hell was going on? I decided to investigate a bit further, to see what I should watch next time. Err z3bra.org 70 i+That's how I realised that I did a **HUGE** mistake... Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# cd /var/ Err z3bra.org 70 i+ root var# du -sh * Err z3bra.org 70 i+ 48.5G backup Err z3bra.org 70 i+ 156.7M cache Err z3bra.org 70 i+ 0 db Err z3bra.org 70 i+ 0 empty Err z3bra.org 70 i+ 228.8M git Err z3bra.org 70 i+ 5.7M gopher Err z3bra.org 70 i+ 4.5G lib Err z3bra.org 70 i+ 0 local Err z3bra.org 70 i+ 0 lock Err z3bra.org 70 i+ 7.9M log Err z3bra.org 70 i+ 0 mail Err z3bra.org 70 i+ 0 run Err z3bra.org 70 i+ 40.0K spool Err z3bra.org 70 i+ 0 tmp Err z3bra.org 70 i+ 1.1G www Err z3bra.org 70 i+ Err z3bra.org 70 i+ root var# cd backup/ Err z3bra.org 70 i+ Err z3bra.org 70 i+ root backup# du -sh * Err z3bra.org 70 i+ 12.0K bin Err z3bra.org 70 i+ 20.0K etc Err z3bra.org 70 i+ 48.5G out Err z3bra.org 70 i+ 20.0K usr Err z3bra.org 70 i+ 84.0K var Err z3bra.org 70 i+ Err z3bra.org 70 i+ root backup# mountpoint out Err z3bra.org 70 i+ out is not a mountpoint Err z3bra.org 70 i+ Err z3bra.org 70 i+ root backup# cd out/ Err z3bra.org 70 i+ Err z3bra.org 70 i+ root out# ll Err z3bra.org 70 i+ total 50841516 Err z3bra.org 70 i+ drwxr-sr-x 2 backup users 4.0K Apr 28 02:11 ./ Err z3bra.org 70 i+ drwxr-sr-x 8 backup users 4.0K Feb 2 20:24 ../ Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 5.3G Apr 25 07:43 data Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 0 Apr 25 07:43 data.0.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 12.0G Apr 26 04:37 homedir Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 12.0G Apr 22 04:43 homedir.0.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 12.0G Apr 25 05:00 homedir.1.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 44.0K Apr 26 04:42 homedir.2.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 1.2G Apr 28 02:11 production Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 1.2G Apr 21 02:10 production.0.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 1.2G Apr 22 02:11 production.1.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 1.2G Apr 23 02:11 production.2.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 1.2G Apr 24 02:11 production.3.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 1.2G Apr 25 02:12 production.4.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 0 Apr 26 02:11 production.5.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 5.3M Apr 27 02:12 production.6.BAK Err z3bra.org 70 i+ -rw-r--r-- 1 backup users 0 Apr 28 02:11 production.7.BAK Err z3bra.org 70 i+ Err z3bra.org 70 i+My backup system doesn't check wether it saves to a mountpoint or not. Shit. Err z3bra.org 70 i+For a whole week, all my backups where created in my /var partition instead of a backup USB drive meant for this purpose. And it filled it up pretty quickly. Err z3bra.org 70 i+ Err z3bra.org 70 i+My backup system send me a mail after each backup, explaining me how it went. The fact it's saving to a mountpoint or not is written in it. I just stopped checking. Silly me. Err z3bra.org 70 i+ Err z3bra.org 70 i+I realise that this issue could have been easily solved by mounting my backup disk elsewhere, then moving the files, and remounting where it should be. But I didn't. Instead, I grew a partition that didn't need to be (the backups filled 48GiB out of 50Gib allocated to /var), and this partition can't be shrinked anymore, as it's an XFS filesystem. Err z3bra.org 70 i+ Err z3bra.org 70 i+So today I learnt two things, the hard way: Err z3bra.org 70 i+ Err z3bra.org 70 i+1. Don't do anything until you know what's going on Err z3bra.org 70 i+2. Configure systems checks and READ THEM Err z3bra.org 70 i+ Err z3bra.org 70 i+I hope you'll learn from my mistakes. For now I think I'll just print this over my desktop, as a reminder: Err z3bra.org 70 i+ Err z3bra.org 70 i+ root ~# df -h /var/ Err z3bra.org 70 i+ Filesystem Size Used Available Use% Mounted on Err z3bra.org 70 i+ /dev/mapper/vg0-var 70.0G 1.5G 68.5G 2% /var Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 1diff --git a/2015/06/vomiting-colors.txt b/2015/06/vomiting-colors.txt /scm/monochromatic/file/2015/06/vomiting-colors.txt.gph z3bra.org 70 it@@ -0,0 +1,75 @@ Err z3bra.org 70 i+# [Vomiting colors](#) Err z3bra.org 70 i+## — 09 June, 2015 Err z3bra.org 70 i+ Err z3bra.org 70 i+Creating colorschemes is one of the hardest part of customizing your desktop. Err z3bra.org 70 i+The easiest way to create a new one is to start from a wallpaper made of colors Err z3bra.org 70 i+you like, and then rework it afterward. Err z3bra.org 70 i+ Err z3bra.org 70 i+the best tool for this job is without any doubt Err z3bra.org 70 i+[colors](http://git.2f30.org/colors) by sin. It uses [k-means Err z3bra.org 70 i+clustering](https://en.wikipedia.org/wiki/K-means_clustering) to extract Err z3bra.org 70 i+dominant colors from a PNG file, and is able to set those clusters in different Err z3bra.org 70 i+ways. Err z3bra.org 70 i+ Err z3bra.org 70 i+Without any further commenting, let's see how it works with this magnificent Err z3bra.org 70 i+picture, randomly taken from the internet: Err z3bra.org 70 i+ Err z3bra.org 70 i+[![bamboo.png](/img/thumb/20150609-bamboo.png)](/img/20150609-bamboo.png) Err z3bra.org 70 i+ Err z3bra.org 70 i+`colors` allow you to choose the number of clusters you want to see on the Err z3bra.org 70 i+output, so in our case, we'll output 16. It's possible that `colors` don't Err z3bra.org 70 i+output the number of clusters you asked for. You can "force" outputing empty Err z3bra.org 70 i+clusters with `-e`. Err z3bra.org 70 i+ Err z3bra.org 70 i+![default output](/img/20150609-colors0.png) Err z3bra.org 70 i+ Err z3bra.org 70 i+Then you can chose how to set you clusters (from the hue domain or pixel space Err z3bra.org 70 i+at the time of writing). Beware when using clusters choosen from the hue domain, Err z3bra.org 70 i+as it will output a multiple of 6 clusters. Best solution here is to ask for Err z3bra.org 70 i+more and truncate the output: Err z3bra.org 70 i+ Err z3bra.org 70 i+![output from hue](/img/20150609-colors1.png) Err z3bra.org 70 i+![output from pix](/img/20150609-colors2.png) Err z3bra.org 70 i+ Err z3bra.org 70 i+And then you can randomize the output, if you feel in the mood! You could also Err z3bra.org 70 i+try using the [k-medians](https://en.wikipedia.org/wiki/K-medians) method, which Err z3bra.org 70 i+takes longer but provides a better output regarding the initial file Err z3bra.org 70 i+ Err z3bra.org 70 i+![output random](/img/20150609-colors3.png) Err z3bra.org 70 i+ Err z3bra.org 70 i+Try different pictures and flag combinations for better results! Err z3bra.org 70 i+ Err z3bra.org 70 i+Once you have your output of choice, you can export it as an XRDB colorscheme Err z3bra.org 70 i+with the following script: Err z3bra.org 70 i+ Err z3bra.org 70 i+ #!/bin/sh Err z3bra.org 70 i+ Err z3bra.org 70 i+ CPT=0 Err z3bra.org 70 i+ while read HEXCODE; do Err z3bra.org 70 i+ printf '*color%d: %s\n' "$CPT" "$HEXCODE" Err z3bra.org 70 i+ done | column -t Err z3bra.org 70 i+ Err z3bra.org 70 i+This will allow live theme trying with the following command: Err z3bra.org 70 i+ Err z3bra.org 70 i+ colors -n 16 bamboo.png | toxrdb | xrdb -merge Err z3bra.org 70 i+ Err z3bra.org 70 i+Another nice way I found to create colorscheme is by randomizing the colors from Err z3bra.org 70 i+the hue domain, resulting in a monochromatic scheme that fits entirely you Err z3bra.org 70 i+wallpaper. This works by outputing 32 colors, extracting the 16 colors in the Err z3bra.org 70 i+middle and randomizing them. this way, your colors will not be too dark or too Err z3bra.org 70 i+light. Err z3bra.org 70 i+ Err z3bra.org 70 i+![output neat](/img/20150609-colors4.png) Err z3bra.org 70 i+ Err z3bra.org 70 i+You can then make a script to change your wall every now and then, and change Err z3bra.org 70 i+the colorscheme on the fly. Your colorscheme will ALWAYS match your current Err z3bra.org 70 i+mood! Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 i+**Keep tweaking!** Err z3bra.org 70 i+ Err z3bra.org 70 i+ Err z3bra.org 70 1diff --git a/config.mk b/config.mk /scm/monochromatic/file/config.mk.gph z3bra.org 70 it@@ -25,7 +25,9 @@ PAGES = index.html \ Err z3bra.org 70 i 2014/12/so-tox-me-maybe.html \ Err z3bra.org 70 i 2015/01/you-are-the-wm.html \ Err z3bra.org 70 i 2015/02/do-you-gopher.html \ Err z3bra.org 70 i- 2015/03/under-wendys-dress.html Err z3bra.org 70 i+ 2015/03/under-wendys-dress.html \ Err z3bra.org 70 i+ 2015/04/the-wrong-sysadmin.html \ Err z3bra.org 70 i+ 2015/06/vomiting-colors.html Err z3bra.org 70 i Err z3bra.org 70 i FEEDS = rss/feed.xml Err z3bra.org 70 i EXTRA = css img vid data errors favicon.ico Err z3bra.org 70 1diff --git a/index.txt b/index.txt /scm/monochromatic/file/index.txt.gph z3bra.org 70 it@@ -1,3 +1,5 @@ Err z3bra.org 70 i+* 0x0017 - [Vomiting colors](/2015/06/vomiting-colors.html) Err z3bra.org 70 i+* 0x0016 - [The wrong sysadmin](/2015/04/the-wrong-sysadmin.html) Err z3bra.org 70 i * 0x0015 - [Under Wendy's dress](/2015/03/under-wendys-dress.html) Err z3bra.org 70 i * 0x0014 - [Do you gopher ?](/2015/02/do-you-gopher.html) Err z3bra.org 70 i * 0x0013 - [You are the WM](/2015/01/you-are-the-wm.html) Err z3bra.org 70 .