Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Archive for the 'how-to' Category

    How to: enable metadata duplication on an existing btrfs filesystem

    30th December 2016

    Just one command: sudo btrfs balance start -v -mconvert=dup /toplevel/
    where /toplevel/ is your mountpoint of the btrfs root, -v is there for verbosity (not too verbose, don’t worry), and -mconvert=dup literally says act on metadata only, convert data profile to DUP.

    This will duplicate both metadata and btrfs system data.
    Verify with: sudo btrfs fi df /toplevel:

    Data, single: total=10.00GiB, used=3.88GiB
    System, DUP: total=64.00MiB, used=4.00KiB
    Metadata, DUP: total=512.00MiB, used=286.18MiB
    GlobalReserve, single: total=96.00MiB, used=0.00B

    Explanation: on SSDs, mkfs.btrfs creates metadata in single mode (because of widely spread SSD deduplication algorithms negating duplicate entries). However, second copy of metadata increases recovery chances, especially so if your SSD does not deduplicate writes. Hence the desire to add metadata/systemdata duplication after the filesystem is created.

    Share

    Posted in *nix, how-to, Notepad, Software | No Comments »

    How to: install Windows 7 on a recent laptop/PC from a bootable USB drive

    12th June 2016

    If you had ever seen the not-so-descriptive error message
    A required CD/DVD drive device driver is missing,
    then you have been trying to install Windows 7 (possibly using a bootable flash drive) on a recent laptop or desktop.

    There are two major obstacles for a somewhat-dated Windows 7 when it sees modern hardware:

    • USB 3.0
    • SSDs and newer disk drives in general

    Fortunately, both problems are easy to fix.
    Just follow the steps below; skip steps 1 and 2 if you already have a bootable Win7 flash drive.
    Read the rest of this entry »

    Share

    Posted in how-to | No Comments »

    Evernote web-interface beta: how to fix: saved searches are crossed out and do not work

    9th May 2016

    Another symptom is a message along the lines of

    the notebook you are searching in has been moved or renamed since the saved search was created

    (which is not true).

    I had this problem, and found a solution.

    Go to your Evernote on a client where you can edit saved searches (Windows for me),
    edit all the searches, and make sure that notebook name is quoted in the search (and also, possibly, with all proper letter cases).

    I found this solution by first creating a search from the web-beta interface, it looked like this: notebook:"Mynotebook" tag:1-now
    All the crossed-out searches (despite working totally fine on Windows) looked like this: notebook:Mynotebook tag:1-now
    or even like this (note the lower-case 1st letter of the notebook name): notebook:mynotebook tag:1-now.

    After editing saved searches and synchronizing, they all appear (and work) just fine in the beta web-interface.

    If you cannot edit your searches right now, there is another workaround: all the saved searches work fine for me from the Shortcuts menu (a star in the left panel).

    Hope this helps!

    Share

    Posted in how-to, Notepad, Software, Web | No Comments »

    How to: easily add swap partition to a live system on btrfs

    14th April 2016

    Recently I had a need to add a swap file to my Debian installation.
    However, I am now using btrfs, and – as with any other COW filesystem – it is not possible to simply create a swap file and use it.
    There are workarounds (creating a file with a COW attribute removed, and then loop-mounting it), but I just did not like them.

    So I have decided to add a swap partition.
    It worked amazingly (and very easily), there was even no need to reboot – at all.
    I still did restart, just to make sure the system is bootable – and all was perfectly fine.

    My initial setup is very simple: a single /dev/sda1 partition on the /dev/sda disk, fully used by btrfs.
    Different important paths/mountpoints are btrfs subvolumes, using flat hierarchy.
    For this example, let us assume that /dev/sda (and /dev/sda1) is 25GB large, and that I want to add a 2GB swap /dev/sda2 after /dev/sda1.

    Brief explanation before we start:

    1. shrink btrfs filesystem by more than 2GB;
    2. shrink btrfs partition by 2GB;
    3. create new 2GB partition for the swap;
    4. resize btrfs filesystem to full size of its new-size partition;
    5. initialize swap and turn it on.

    Here are the very easy steps! Just make sure you do not make mistakes anywhere ;)
    Read the rest of this entry »

    Share

    Posted in *nix, how-to | No Comments »

    How to: export only notes to PDF from LibreOffice Impress 5

    28th February 2016

    If you want to export Notes to a PDF from LibreOffice Impress 5,
    and dutifully set the appropriate checkbox in PDF export dialog,
    then you will get all slides twice: first just all the slides as with usual PDF export, and then all the Notes pages.

    There is an easy solution to get Notes-only without editing the PDF.

    If you have a PDf printer installed (most Linux distributions, and Windows 10), just do File -> Print from Impress,
    then under the Print sub-header choose Notes from the Document drop-down (see picture).
    Make sure to set the proper paper format for the PDF printer (A4 in my case).
    Then print, and save the resulting PDF.
    Read the rest of this entry »

    Share

    Posted in how-to, Notepad, Software | No Comments »

    How to: convert your VPS root filesystem to btrfs (using rescue boot)

    15th February 2016

    I’m moving from (a kind of…) a dedicated server to a VPS, to decrease my frightful anticipation of hardware failures.
    Honestly though, that server had been freezing up and restarting spontaneously for several months now, causing sometimes really long down-times…
    That server is now about 6-7 years old, built with off-the-shelf components, some of which (the HDD :) ) had weird noises from the very start.
    Definitely time to move!

    I’ve purchased a fairly cheap VPS with an easy, one-click upgrade option for after I’m done configuring it.
    It comes with a wide selection of OSes to pre-install; I’ve chosen Debian Jessie, version 8.3 as of this writing.

    I wanted to use btrfs from the beginning, so could have installed Debian myself, but… VPS provider does some initial configuration (like their Debian mirror and some other things), so I’ve felt that converting to btrfs after the fact would be easier. Now that I’ve done this – I guess it was fairly easy, although preparation did take some time.

    Below, I’m providing step-by-step instructions on how to convert your root filesystem from (most likely) ext4 to btrfs.
    Read the rest of this entry »

    Share

    Posted in *nix, how-to | No Comments »

    How to fix: mod_proxy’s ProxyPass directive does not work

    10th February 2016

    So… You had finally built a nice LXC container for your web-facing application, and even configured Apache (Debian package version 2.14.18-1 in my case) to serve some static/web-only components.
    From your client-side JavaScript UI you talk (in JSON) to the API, which is implemented as a separate node.js/Python/etc server – say, on port 8000 in the same LXC container.

    The simplest solution to forward requests from the web-frontend to your API is by using mod_proxy.
    If you want to forward any requests to /api/* to your custom back-end server on port 8000, you just add the following lines to your VirtualHost configuration:

    ProxyPass “/api” “http://localhost:8000″
    ProxyPassReverse “/api” “http://localhost:8000″

    I’d suggest not wrapping this fragment with the classical IfModule: as your application will not really work without its API back-end, you actually want Apache to fail as soon as possible if mod_proxy is missing.

    That was easy, right? What, it doesn’t work? Can’t be! It’s dead simple! No way you could make a mistake in 2 lines of configuration!!! :mad_rage: :)

    Oh wait… I remember I had this problem before… Read the rest of this entry »

    Share

    Posted in *nix, how-to, Web | No Comments »