Copy Linux sparse files over network

Sparse files are nice to use to store virtual machine’s virtual disks but can be a real pain in the ass to backup efficiently, especially over the network. Luckily rsync provides a way to intelligently copy sparse files both locally and over the network. The trick is use --sparse and --inplace options. Let’s say we have a sparse 60 GB qemu virtual disk with only around 7 GB used: $ ls -lh fedora24.qcow2 -rw------- 1 root root 61G Nov 8 19:11 fedora24.qcow2 $ du -h fedora24.qcow2 7.2G fedora24.qcow2 The first thing to note is that ls does not recognize sparse files while du does. The first time a file is copied use the --sparse option: …

Posted on

pdnsd automatic startup Arch Linux

I have this Arch Linux based ODROID-U3 I use as DLNA server, local web server…etc…and also as local DNS caching server. For some strange reason pdnsd doesn’t seem to start correctly on Arch Linux. [root@server ~]# systemctl status pdnsd -l ● pdnsd.service - proxy name server Loaded: loaded (/usr/lib/systemd/system/pdnsd.service; enabled) Active: failed (Result: exit-code) since Sat 2000-01-01 20:02:07 CET; 14 years 7 months ago Process: 182 ExecStart=/usr/bin/pdnsd (code=exited, status=3) Main PID: 182 (code=exited, status=3) Jan 01 20:02:06 server systemd[1]: Starting proxy name server... Jan 01 20:02:06 server systemd[1]: Started proxy name server. Jan 01 20:02:06 server pdnsd[182]: Error in config file (line 11): Failed to get IP address of eth0: Cannot assign requested address Jan 01 20:02:07 server systemd[1]: pdnsd.service: main process exited, code=exited, status=3/NOTIMPLEMENTED Jan 01 20:02:07 server systemd[1]: Unit pdnsd.service entered failed state. Adding After=network-online.target and Wants=network-online.target in the Unit section of the startup script doesn’t seem to make any difference. So far the only workaround which really works is adding the line After=multi-user.target in the service script. …

Posted on

Interesting read on Samba 4

In the last month or so despite not having much spare time I spent a few hours reading an interesting book: Implementing Samba 4 It actually is more than a simple book, it is a well written step-by-step guide on how to install (on Debian 7, not that it makes much difference, the installation is really similar on CentOS for example), configure, manage and even migrate an existing Active Directory domain controller from Windows Server to GNU/Linux. It consists of 9 chapters each one covering the most important features of Samba 4; everything explained in the book is also integrated with code snippets, scripts and command line examples. I am sure this book will come real handy in case I will have to setup a GNU/Linux based AD domain controller. …

Posted on

nginx and TLS v1.2

Given that SSL and TLS, especially v1.0, suffer from serious security issues (e.g. https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS) I thought it would be a good idea to use the latest and more secure version of it: v1.2. On CentOS 6.4 the openssl version included is quite old and doesn’t support TLS v1.1 and 1.2. So, first of all we have to install the latest version 1.0.1e, it can be done compiling from sources or by adding a third party repository; I chose the latter. …

Posted on

WordPress admin, SSL, Apache + nginx

Let’s say we have a WordPress blog and we would like to encrypt our login pages and the whole back-end of the site. There are many ways to do it, but since I already have a nginx instance configured as reverse proxy running in front of Apache I’ll use it to protect my admin pages and logins. In this page I’ll not cover Apache’s configuration, which, by the way, is trivial to say the least, so please refer to this other post: Apache + nginx as reverse proxy. Using the configuration posted in the above’s link as starting point, to add SSL encryption to admin pages we should add a couple more bunch of lines of code. First of all, we must create our own Certificate Authority and issue a SSL certificate. Another option is buying a certificate, but I don’t trust CA (certificate forgery anyone?) and I don’t mind having a properly signed certificate for a page I am the only one accessing to. Follows a brief explanation on how to create a CA and issue a certificate. …

Posted on

Linux Kernel 3.10 and VMware Workstation 9

A new Linux kernel version is released and guess what: VMware Workstation fucked up once again. The fix posted on the Arch Linux wiki is applicable also to Fedora 19, I’ll post it here for future reference. $ cd /tmp $ curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmblock-9.0.2-5.0.2-3.10.patch $ curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmnet-9.0.2-5.0.2-3.10.patch $ cd /usr/lib/vmware/modules/source # tar -xvf vmblock.tar # tar -xvf vmnet.tar # patch -p0 -i /tmp/vmblock-9.0.2-5.0.2-3.10.patch # patch -p0 -i /tmp/vmnet-9.0.2-5.0.2-3.10.patch # tar -cf vmblock.tar vmblock-only # tar -cf vmnet.tar vmnet-only # rm -r vmblock-only # rm -r vmnet-only # vmware-modconfig --console --install-all For more information: https://wiki.archlinux.org/index.php/VMware#3.10_kernels …

Posted on

Logitech G500 and Linux

Despite not being a gamer at all I see having a decent mouse as an important thing, I spend 10 to 15 hours a day in front of my PC and probably for at least half of the time I’m using the mouse, so I don’t get why I should not have the best input peripherals on the market. My current mouse is a Logitech G500 (NP 910-001262), of course it being the best mouse on the market is an highly debatable thing since, along side with the keyboard, mouse choice is highly subjective. G500 is something you love or you hate, starting from the unusual scroll wheel, going to the sensor position to the strange side buttons there are a lot of uncommon things. This small write-up is not meant to be a review nor a guide, I would like it to be just a bunch of tips from someone who is using a G500 on a Linux box. First of all: this mouse has no angle snapping, or better, out of the box angle snapping is enabled (Logitech, why? seriously, none like angle snapping) but it can be disabled from drivers. Obviously drivers are available only for Windows (Logitech…) and I don’t seem to be able to change mouse settings from a virtual machine (VMware Workstation 9), anyway I didn’t put much time on this so it could be doable. So what I suggest is plug G500 in a physical Windows machine, install drivers and tune the settings, once you are done, save settings on G500 internal memory and plug it in your Linux machine. Once in Linux, which in my case is Fedora 18 and XFCE as DE, there are still acceleration issues which can be solved quite easily using xinput. – Someone report that G500 sensor is flawed and it has some kind of built-in acceleration, honestly I don’t see it but could be that I’m just used to it – …

Posted on

Samba 4, simple directory sharing

With Samba being the clusterfuck it is, every time a new version is released you have to expect something to be messed up. This time they added a bunch of new features like MS Active Directory support, too bad that now the simple directory sharing is broken/not working like it did before. Something like 1 year ago I wrote a small guide about how to setup a Samba share on Centos 6 and I used the same smb.conf file on more than 10 machines without any problem since yesterday, when I tried it on my fresh installed Fedora 18 (which uses Samba 4.0.0). First of all, in the “Standalone Server Options” is reported that “security” options “share and server” are deprecated; too bad I just used “share” to save me the hassle of setting up a new user and stuff even if I would like the directory to be fully accessible by everyone without any restriction. I tried it anyway with “security = share” but there was no way to make the folder accessible, when trying to access the Samba share I always got a popup in which I had to login. So, at the end of the story, like it or not, I had to setup a new user, create a samba user and edit the “smb.conf” file. …

Posted on