<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Autarchy of the Private Cave &#187; *nix</title> <atom:link href="https://bogdan.org.ua/categories/nix/feed" rel="self" type="application/rss+xml" /><link>https://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Wed, 28 Dec 2022 16:09:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>https://wordpress.org/?v=3.8.27</generator> <item><title>Slow memory allocation due to Transparent Huge Pages (THP)</title><link>https://bogdan.org.ua/2018/08/06/slow-memory-allocation-due-to-transparent-huge-pages-thp.html</link> <comments>https://bogdan.org.ua/2018/08/06/slow-memory-allocation-due-to-transparent-huge-pages-thp.html#comments</comments> <pubDate>Mon, 06 Aug 2018 19:49:00 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[fragmentation]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[RAM]]></category> <category><![CDATA[THP]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2535</guid> <description><![CDATA[Your software needs tons of RAM, and runs a bit too slow on your super-duper HPC cluster? Read this: Slow memory allocation due to Transparent Huge Pages (THP)]]></description> <content:encoded><![CDATA[<p>Your software needs tons of RAM, and runs a bit too slow on your super-duper HPC cluster? Read this: <a
href="http://itscalledbioinformatics.blogspot.com/2018/07/slow-memory-allocation-due-to.html">Slow memory allocation due to Transparent Huge Pages (THP)</a></p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2018%2F08%2F06%2Fslow-memory-allocation-due-to-transparent-huge-pages-thp.html&amp;linkname=Slow%20memory%20allocation%20due%20to%20Transparent%20Huge%20Pages%20%28THP%29" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2018%2F08%2F06%2Fslow-memory-allocation-due-to-transparent-huge-pages-thp.html&amp;linkname=Slow%20memory%20allocation%20due%20to%20Transparent%20Huge%20Pages%20%28THP%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2018%2F08%2F06%2Fslow-memory-allocation-due-to-transparent-huge-pages-thp.html&amp;linkname=Slow%20memory%20allocation%20due%20to%20Transparent%20Huge%20Pages%20%28THP%29" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2018%2F08%2F06%2Fslow-memory-allocation-due-to-transparent-huge-pages-thp.html&amp;linkname=Slow%20memory%20allocation%20due%20to%20Transparent%20Huge%20Pages%20%28THP%29" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2018%2F08%2F06%2Fslow-memory-allocation-due-to-transparent-huge-pages-thp.html&amp;linkname=Slow%20memory%20allocation%20due%20to%20Transparent%20Huge%20Pages%20%28THP%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2018%2F08%2F06%2Fslow-memory-allocation-due-to-transparent-huge-pages-thp.html&#038;title=Slow%20memory%20allocation%20due%20to%20Transparent%20Huge%20Pages%20%28THP%29" data-a2a-url="https://bogdan.org.ua/2018/08/06/slow-memory-allocation-due-to-transparent-huge-pages-thp.html" data-a2a-title="Slow memory allocation due to Transparent Huge Pages (THP)"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2018/08/06/slow-memory-allocation-due-to-transparent-huge-pages-thp.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Midnight Commander: panelize or select all files newer than specified date</title><link>https://bogdan.org.ua/2017/02/03/midnight-commander-panelize-or-select-all-files-newer-than-specified-date.html</link> <comments>https://bogdan.org.ua/2017/02/03/midnight-commander-panelize-or-select-all-files-newer-than-specified-date.html#comments</comments> <pubDate>Fri, 03 Feb 2017 14:56:52 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[find]]></category> <category><![CDATA[mc]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2482</guid> <description><![CDATA[If you ever need to select lots (hundreds, thousands) of files by their modification date, and your directory contains many more files (thousands, tens of thousands), then angel_il has the answer for you: touch -d &#8220;Jun 01 00:00 2011&#8243; /tmp/.date1 enter into your BIG dir press C-x ! (External panelize) add new command like a [&#8230;]]]></description> <content:encoded><![CDATA[<p>If you ever need to select lots (hundreds, thousands) of files by their modification date, and your directory contains many more files (thousands, tens of thousands), then angel_il has the <a
href="https://midnight-commander.org/ticket/2718#comment:5">answer</a> for you:</p><blockquote><ol><li>touch -d &#8220;Jun 01 00:00 2011&#8243; /tmp/.date1</li><li>enter into your BIG dir</li><li>press C-x ! (External panelize)</li><li>add new command like a &#8220;find . -type f \( -newer /tmp/.date1 \) -print&#8221;</li></ol></blockquote><p>I&#8217;ve used a slightly different approach, specifying desired date right in the command line of External Panelize:</p><blockquote><ol><li>enter your directory with many files</li><li>press <code>C-x !</code> (External Panelize)</li><li>add a command like <code>find . -type f -newermt "2017-02-01 23:55:00" -print</code> (<code>man find</code> for more details)</li></ol></blockquote><p>In both cases, the created panel will only have files matching your search condition.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2017%2F02%2F03%2Fmidnight-commander-panelize-or-select-all-files-newer-than-specified-date.html&amp;linkname=Midnight%20Commander%3A%20panelize%20or%20select%20all%20files%20newer%20than%20specified%20date" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2017%2F02%2F03%2Fmidnight-commander-panelize-or-select-all-files-newer-than-specified-date.html&amp;linkname=Midnight%20Commander%3A%20panelize%20or%20select%20all%20files%20newer%20than%20specified%20date" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2017%2F02%2F03%2Fmidnight-commander-panelize-or-select-all-files-newer-than-specified-date.html&amp;linkname=Midnight%20Commander%3A%20panelize%20or%20select%20all%20files%20newer%20than%20specified%20date" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2017%2F02%2F03%2Fmidnight-commander-panelize-or-select-all-files-newer-than-specified-date.html&amp;linkname=Midnight%20Commander%3A%20panelize%20or%20select%20all%20files%20newer%20than%20specified%20date" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2017%2F02%2F03%2Fmidnight-commander-panelize-or-select-all-files-newer-than-specified-date.html&amp;linkname=Midnight%20Commander%3A%20panelize%20or%20select%20all%20files%20newer%20than%20specified%20date" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2017%2F02%2F03%2Fmidnight-commander-panelize-or-select-all-files-newer-than-specified-date.html&#038;title=Midnight%20Commander%3A%20panelize%20or%20select%20all%20files%20newer%20than%20specified%20date" data-a2a-url="https://bogdan.org.ua/2017/02/03/midnight-commander-panelize-or-select-all-files-newer-than-specified-date.html" data-a2a-title="Midnight Commander: panelize or select all files newer than specified date"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2017/02/03/midnight-commander-panelize-or-select-all-files-newer-than-specified-date.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to: enable metadata duplication on an existing btrfs filesystem</title><link>https://bogdan.org.ua/2016/12/30/how-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html</link> <comments>https://bogdan.org.ua/2016/12/30/how-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html#comments</comments> <pubDate>Fri, 30 Dec 2016 19:43:51 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[btrfs]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2474</guid> <description><![CDATA[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&#8217;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 [&#8230;]]]></description> <content:encoded><![CDATA[<p>Just one command: <code>sudo btrfs balance start -v -mconvert=dup  /toplevel/</code><br
/> where <code>/toplevel/</code> is your <a
href="http://bogdan.org.ua/2016/02/15/how-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html">mountpoint of the btrfs root</a>, <code>-v</code> is there for verbosity (not too verbose, don&#8217;t worry), and <code>-mconvert=dup</code> literally says <em>act on metadata only, convert data profile to DUP</em>.</p><p>This will duplicate both metadata and btrfs system data.<br
/> Verify with: <code>sudo btrfs fi df /toplevel</code>:</p><blockquote><p>Data, single: total=10.00GiB, used=3.88GiB<br
/> System, DUP: total=64.00MiB, used=4.00KiB<br
/> Metadata, DUP: total=512.00MiB, used=286.18MiB<br
/> GlobalReserve, single: total=96.00MiB, used=0.00B</p></blockquote><p>Explanation: on SSDs, mkfs.btrfs creates metadata in <em>single</em> 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.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F30%2Fhow-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html&amp;linkname=How%20to%3A%20enable%20metadata%20duplication%20on%20an%20existing%20btrfs%20filesystem" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F30%2Fhow-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html&amp;linkname=How%20to%3A%20enable%20metadata%20duplication%20on%20an%20existing%20btrfs%20filesystem" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F30%2Fhow-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html&amp;linkname=How%20to%3A%20enable%20metadata%20duplication%20on%20an%20existing%20btrfs%20filesystem" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F30%2Fhow-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html&amp;linkname=How%20to%3A%20enable%20metadata%20duplication%20on%20an%20existing%20btrfs%20filesystem" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F30%2Fhow-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html&amp;linkname=How%20to%3A%20enable%20metadata%20duplication%20on%20an%20existing%20btrfs%20filesystem" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F30%2Fhow-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html&#038;title=How%20to%3A%20enable%20metadata%20duplication%20on%20an%20existing%20btrfs%20filesystem" data-a2a-url="https://bogdan.org.ua/2016/12/30/how-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html" data-a2a-title="How to: enable metadata duplication on an existing btrfs filesystem"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/12/30/how-to-add-enable-metadata-duplication-existing-btrfs-filesystem.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Mail-in-a-box, Sovereign, Modoboa, iRedMail, etc</title><link>https://bogdan.org.ua/2016/12/28/mail-in-a-box-sovereign-modoboa-iredmail-etc.html</link> <comments>https://bogdan.org.ua/2016/12/28/mail-in-a-box-sovereign-modoboa-iredmail-etc.html#comments</comments> <pubDate>Wed, 28 Dec 2016 14:43:17 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Comparison]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[mail-server]]></category> <category><![CDATA[self-hosted]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2465</guid> <description><![CDATA[Preparing to dismantle my physical server (and move different hosted things to one or more VPS), I&#8217;ve realized that an email server is necessary: to send website-generated emails, and also receive a few rare contact requests arriving at the websites. My current email server was configured eons ago, it works well, but I have no [&#8230;]]]></description> <content:encoded><![CDATA[<p>Preparing to dismantle my physical server (and move different hosted things to one or more VPS),<br
/> I&#8217;ve realized that an email server is necessary: to send website-generated emails, and also<br
/> receive a few rare contact requests arriving at the websites.</p><p>My current email server was configured eons ago, it works well,<br
/> but I have no desire to painfully transfer all the configuration&#8230;<br
/> Better install something new, shiny and exciting, right? <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p><p>I had 3 #self-hosted, #mail-server bookmarks:</p><ul><li><a
href="https://mailinabox.email/">Mail-in-a-box</a></li><li><a
href="http://www.iredmail.org/">iRedMail</a></li><li><a
href="https://modoboa.org/" class="broken_link" rel="nofollow">Modoboa</a></li><li><a
href="https://github.com/sovereign/sovereign">Sovereign</a></li></ul><p>(Sovereign, the 4th one, was addded after reading more about Mail-in-a-box.)</p><p>Here are my notes on what seemed important about these 4.<br
/> <span
id="more-2465"></span></p><ul><li><a
href="http://www.iredmail.org/">iRedMail</a></li><ul><li>has free and paid web-UIs</li><li>no DNSSEC, DMARC, HSTS</li><li>amavisd with clamav</li><li>has useful manual parts</li><li>containerized</li><li>not attractive</li></ul><li><a
href="https://modoboa.org/" class="broken_link" rel="nofollow">Modoboa</a></li><ul><li>less sophisticated than Sovereign or Mail-in-a-box</li><li>web-UI, also for amavisd filters</li><li>overall: focuses on better UI</li><li>has useful manual parts</li><li>recent (experimental?) LetsEncrypt support</li><li>has (some) unit tests</li><li>containerized</li><li>not that attractive</li></ul><li><a
href="https://github.com/sovereign/sovereign">Sovereign</a></li><ul><li>has more than I need, but components can be deactivated</li><li>has EncFS support (useful, but questionable because of reboots&#8230;)</li><li>no dedicated web-interface, configs are text</li><li>has proper testing against a vagrant virtual machine</li><li>can be dockerized using <a
href="https://github.com/kisamoto/dancible">github.com/kisamoto/dancible</a></li><li>attractive as &#8220;the next solution&#8221;, or to borrow EncFS support</li></ul><li><a
href="https://mailinabox.email/">Mail-in-a-box</a></li><ul><li>the most sophisticated email server (except for EncFS which is not used here)</li><li>simple but useful web-UI</li><li>no amavisd, clamav, UI for filters</li><li>has good relaying manual</li><li>more or less requires a separate machine (overwrites configs?)</li><li>has no well-established testing, not even for development; this is being worked on as of New Year 2017</li><li>problems with owncloud (which I don&#8217;t really need)</li><li><a
href="https://hub.docker.com/r/mtrnord/mailinabox/">hub.docker.com/r/mtrnord/mailinabox/</a> , <a
href="https://github.com/mail-in-a-box/mailinabox/blob/docker/containers/docker/run">github.com/mail-in-a-box/mailinabox/blob/docker/containers/docker/run</a></li><li><a
href="https://github.com/mail-in-a-box/mailinabox/issues/910">postscreen</a> is not yet configured, it is not obvious if it were beneficial</li><li>the most attractive; might be reasonable to fork and modify (e.g. drop owncloud?)</li></ul></ul><p><abbr
title="Mail-in-a-box">MIAB</abbr> appeared really attractive,<br
/> but then &#8211; do I really want to dedicate one of the VPS to the mail server only?<br
/> Not in my case &#8211; too low emails volume/traffic.</p><p>So running it in an <a
href="https://linuxcontainers.org/">LXC</a> (or some other) container would make sense.<br
/> And this is actually possible, some of the users over at MIAB&#8217;s <a
href="https://discourse.mailinabox.email/">discussion forum</a><br
/> have been running MIAB inside docker container for over a year now with no issues.<br
/> (An extra upside is that web-UI can be left unexposed, preventing external access to it.)<br
/> A possible long-term downside is, of course, lack of tests &#8211; Sovereign looks much better in this regard.</p><p>Sovereign looks very good overall. In fact, MIAB feels like<br
/> &#8220;Sovereign&#8217;s email component + webui for it&#8221; (MIAB was inspired by Sovereign).</p><p>One extra MIAB-specific feature is DNSSEC support.<br
/> MIAB takes on the role of your nameserver, and thus is able to setup (and refresh, when necessary)<br
/> all the DKIM/DNSSEC/etc-relevant DNS records for you.</p><p>As soon as I&#8217;ve started adding &#8220;containerization&#8221; to the mix, dozens of other projects entered my field of view:</p><ul><li><a
href="https://github.com/indiehosters/email">github.com/indiehosters/email</a>, inspired by MIAB, looks ok; lacks webmail, fail2ban, SPF, DANE, DNSSEC, but uses vimbadmin instead of a custom-coded MIAB UI</li><li><a
href="https://github.com/tomav/docker-mailserver">github.com/tomav/docker-mailserver</a> looks great! No UI, no SQL backend, only 2 text files (accounts and aliases) for all configuration &#8211; yay!</li><li><a
href="https://github.com/lava/dockermail">github.com/lava/dockermail</a>, much less active/polished, not really interesting</li><li><a
href="https://github.com/frankh/docker-compose-mailbox">github.com/frankh/docker-compose-mailbox</a> adds roundcube and vimbadmin containers; uses SQL; not sure why it has only 10 stars on github&#8230;</li><li><a
href="https://github.com/adaline/dockermail" class="broken_link" rel="nofollow">github.com/adaline/dockermail</a> &#8211; looks ok, less active and seems simpler than docker-mailserver</li><li><a
href="https://poste.io/">poste.io</a> : has free (downloadable) and 2 paid versions; packed with many features and containerized; there is no Dockerfile, but of course you can examine what&#8217;s inside the public image anyway; actually, looks good &#8211; not sure how posteio-specific the data directory structure is, though&#8230; still something to try</li><li><a
href="http://www.mailgun.com/">mailgun.com</a> &#8211; SMTP service with a more than sufficient free quota for a few low-traffic websites; can be coupled with some forwarding service to avoid any need in an email server; but not this time, I want a mail-server <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></li><li><a
href="https://yunohost.org/">yunohost.org</a> : I&#8217;m not entirely sure why this is here, maybe it does have email support built-in? ok, yes it does &#8211; this is a debian-based &#8220;home-server&#8221; software, which also includes LDAP and SSO and XMPP and DNS and nginx. Hmm, not bad. I wonder how well it works out of the box.</li><li><a
href="https://kolab.org/">kolab.org</a> : groupware; looks interesting as well, but I have no group (yet) to have a use for a full groupware solution</li><li>not reviewed: <a
href="https://mailcow.email/">mailcow.email</a>, <a
href="https://mailcow.email/dockerized/" class="broken_link" rel="nofollow">mailcow.email/dockerized</a>, <a
href="https://github.com/andryyy/mailcow" class="broken_link" rel="nofollow">github.com/andryyy/mailcow</a></li></ul><p>Finally, one can build an own LXC container, either by following this <a
href="http://arstechnica.com/information-technology/2014/02/how-to-run-your-own-e-mail-server-with-your-own-domain-part-1/">ArsTechnica</a> series,<br
/> or after examining the install scripts of MIAB or Sovereign.<br
/> Then automate all of this, keep it well-maintained &#8211; and there you have it, one more mail-server solution! <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p><p>To re-cap:</p><ul><li>MIAB looks very good &#8211; feature-rich, easy to install, and just works &#8211; you should try it!</li><li>docker-mailserver looks great &#8211; I should try it!</li><li>poste.io, yunohost.org and kolab.org are also some interesting solutions to try, along with Sovereign</li></ul><p>Not much of a summary, but this is definitely an accurate reflection of reality.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F28%2Fmail-in-a-box-sovereign-modoboa-iredmail-etc.html&amp;linkname=Mail-in-a-box%2C%20Sovereign%2C%20Modoboa%2C%20iRedMail%2C%20etc" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F28%2Fmail-in-a-box-sovereign-modoboa-iredmail-etc.html&amp;linkname=Mail-in-a-box%2C%20Sovereign%2C%20Modoboa%2C%20iRedMail%2C%20etc" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F28%2Fmail-in-a-box-sovereign-modoboa-iredmail-etc.html&amp;linkname=Mail-in-a-box%2C%20Sovereign%2C%20Modoboa%2C%20iRedMail%2C%20etc" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F28%2Fmail-in-a-box-sovereign-modoboa-iredmail-etc.html&amp;linkname=Mail-in-a-box%2C%20Sovereign%2C%20Modoboa%2C%20iRedMail%2C%20etc" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F28%2Fmail-in-a-box-sovereign-modoboa-iredmail-etc.html&amp;linkname=Mail-in-a-box%2C%20Sovereign%2C%20Modoboa%2C%20iRedMail%2C%20etc" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F12%2F28%2Fmail-in-a-box-sovereign-modoboa-iredmail-etc.html&#038;title=Mail-in-a-box%2C%20Sovereign%2C%20Modoboa%2C%20iRedMail%2C%20etc" data-a2a-url="https://bogdan.org.ua/2016/12/28/mail-in-a-box-sovereign-modoboa-iredmail-etc.html" data-a2a-title="Mail-in-a-box, Sovereign, Modoboa, iRedMail, etc"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/12/28/mail-in-a-box-sovereign-modoboa-iredmail-etc.html/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>How to: easily add swap partition to a live system on btrfs</title><link>https://bogdan.org.ua/2016/04/14/how-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html</link> <comments>https://bogdan.org.ua/2016/04/14/how-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html#comments</comments> <pubDate>Thu, 14 Apr 2016 13:09:23 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[btrfs]]></category> <category><![CDATA[filesystem]]></category> <category><![CDATA[partition]]></category> <category><![CDATA[resize]]></category> <category><![CDATA[swap]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2397</guid> <description><![CDATA[Recently I had a need to add a swap file to my Debian installation. However, I am now using btrfs, and &#8211; as with any other COW filesystem &#8211; 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 [&#8230;]]]></description> <content:encoded><![CDATA[<p>Recently I had a need to <a
href="http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html">add a swap file</a> to my Debian installation.<br
/> However, I am now using btrfs, and &#8211; as with any other <abbr
title="Copy On Write">COW</abbr> filesystem &#8211; it is not possible to simply create a swap file and use it.<br
/> There are workarounds (creating a file with a COW attribute removed, and then loop-mounting it), but I just did not like them.</p><p>So I have decided to add a swap partition.<br
/> It worked amazingly (and very easily), there was even no need to reboot &#8211; at all.<br
/> I still did restart, just to make sure the system is bootable &#8211; and all was perfectly fine.</p><p>My initial setup is very simple: a single /dev/sda1 partition on the /dev/sda disk, fully used by btrfs.<br
/> Different important paths/mountpoints are btrfs subvolumes, using <a
href="http://bogdan.org.ua/2016/02/15/how-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html">flat hierarchy</a>.<br
/> 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.</p><p>Brief explanation before we start:</p><ol><li>shrink btrfs <em>filesystem</em> by more than 2GB;</li><li>shrink btrfs <em>partition</em> by 2GB;</li><li>create new 2GB partition for the swap;</li><li>resize btrfs <em>filesystem</em> to full size of its new-size <em>partition</em>;</li><li>initialize swap and turn it on.</li></ol><p>Here are the very easy steps! Just make sure you do not make mistakes anywhere <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /><br
/> <span
id="more-2397"></span></p><ol><li>If your btrfs volume with ID 5 (top level) is a separate mountpoint: mount it now, e.g. <code>sudo mount /toplevel</code>.</li><li>Take note of your current partition label and UUID: <code>sudo blkid</code>.</li><li>Resize btrfs filesystem <strong>down</strong> (shrink) with a <strong>good</strong> margin; for example, if I want to add a 2 GB swap, then I can <code>sudo btrfs fi resize -3g /toplevel</code> &#8211; here, I&#8217;m shrinking btrfs <em>filesystem</em> by about a gigabyte more than necessary. The process is very quick if you have free space, so you can even use a larger margin &#8211; say, <code>sudo btrfs fi resize -5g /toplevel</code>.</li><li><code>sudo parted</code>, then <code>print</code> to make sure what is the number of your btrfs <em>partition</em>, then <code>resizepart 1</code> (where <strong>1</strong> is the partition number), and answer a few questions: <code>yes</code>, <code>new_size_here</code> (in our example: 23.0GB), <code>yes</code>. You can also create a swap partition from parted, then quit parted with <code>q</code> and Enter.</li><li><code>sudo partprobe</code> to let the OS know that partitions have changed.</li><li>I have used <strong>cfdisk</strong> to create a 2GB swap partition: it has a very simple ncurses UI, and is very intuitive. After creating swap partition, do run <code>sudo partprobe</code> again.</li><li>Resize btrfs <em>filesystem</em> back up to take all of the <em>partition</em>: <code>sudo btrfs fi resize max /toplevel</code>.</li><li>Simply to be sure, run a scrub: <code>sudo btrfs scrub start -B -r /toplevel</code>.</li><li>Initialize swap; you can specify uuid and/or label which you may already have in your fstab: <code>mkswap --label=swap --uuid=your1234-your-uuid-1234-youruuid1234 /dev/sda2</code>.</li><li><code>sudo blkid</code> to make sure your /dev/sda1 UUID stayed the same (or to get swap uuid/label if you haven&#8217;t specified any).</li><li>Optionally, add the swap line to your /etc/fstab. Then turn on swap with <code>swapon -a</code>.</li></ol><p>That&#8217;s it! Amazing, isn&#8217;t it? On-the-fly filesystem and partition resizing!</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F04%2F14%2Fhow-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html&amp;linkname=How%20to%3A%20easily%20add%20swap%20partition%20to%20a%20live%20system%20on%20btrfs" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F04%2F14%2Fhow-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html&amp;linkname=How%20to%3A%20easily%20add%20swap%20partition%20to%20a%20live%20system%20on%20btrfs" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F04%2F14%2Fhow-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html&amp;linkname=How%20to%3A%20easily%20add%20swap%20partition%20to%20a%20live%20system%20on%20btrfs" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F04%2F14%2Fhow-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html&amp;linkname=How%20to%3A%20easily%20add%20swap%20partition%20to%20a%20live%20system%20on%20btrfs" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F04%2F14%2Fhow-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html&amp;linkname=How%20to%3A%20easily%20add%20swap%20partition%20to%20a%20live%20system%20on%20btrfs" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F04%2F14%2Fhow-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html&#038;title=How%20to%3A%20easily%20add%20swap%20partition%20to%20a%20live%20system%20on%20btrfs" data-a2a-url="https://bogdan.org.ua/2016/04/14/how-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html" data-a2a-title="How to: easily add swap partition to a live system on btrfs"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/04/14/how-to-easily-add-swap-partition-to-a-live-system-on-btrfs.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to use mkfifo named pipes with prinseq-lite.pl</title><link>https://bogdan.org.ua/2016/02/24/how-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html</link> <comments>https://bogdan.org.ua/2016/02/24/how-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html#comments</comments> <pubDate>Wed, 24 Feb 2016 11:39:37 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Bioinformatics]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[FIFO]]></category> <category><![CDATA[gist]]></category> <category><![CDATA[mkfifo]]></category> <category><![CDATA[patch]]></category> <category><![CDATA[prinseq-lite.pl]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2360</guid> <description><![CDATA[prinseq-lite.pl is a utility written in Perl for preprocessing NGS reads, also in FASTQ format. It can read sequences both from files and from stdin (if you only have 1 sequence). I wanted to use it with compressed (gzipped/bzipped2) FASTQ input files. As I do not need to store decompressed input files, the most efficient [&#8230;]]]></description> <content:encoded><![CDATA[<p><img
src="http://bogdan.org.ua/wp-content/uploads/2016/02/prinseq_logo_1.png" alt="prinseq_logo_1" width="204" height="32" class="alignleft size-full wp-image-2361" /><a
href="http://prinseq.sourceforge.net/">prinseq-lite.pl</a> is a utility written in Perl for preprocessing NGS reads, also in <a
href="https://en.wikipedia.org/wiki/FASTQ_format">FASTQ format</a>.<br
/> It can read sequences both from files and from stdin (if you only have 1 sequence).</p><p>I wanted to use it with compressed (gzipped/bzipped2) FASTQ input files.<br
/> As I do not need to store decompressed input files, the most efficient solution is to use pipes.<br
/> This works well for a single file, but not for 2 files (paired-end reads).</p><p>For 2 files, <a
href="https://en.wikipedia.org/wiki/Named_pipe">named pipes</a> (also known as <a
href="https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)">FIFO</a>s) can be used.<br
/> You can create a named pipe in Linux with the help of <code>mkfifo</code> command, for example <code>mkfifo R1_decompressed.fastq</code>.<br
/> To use it, start decompressing something into it (either in a different terminal, or in background), for example <code>zcat R1.fastq.gz > R1_decompressed.fastq &#038;</code>;<br
/> we can call this a writing/generating process, because it writes into a pipe.<br
/> (If you are writing software to use named pipes, any processes writing into them should be started in a new thread, as they will block until all the data is consumed.)<br
/> Now if you give the R1_decompressed.fastq as a file argument to some other program, it will see decompressed content (e.g. <code>wc -l R1_decompressed.fastq</code> will tell you the number of lines in the decompressed file); we can call program reading from the named pipe a reading/consuming process.<br
/> As soon as a consuming process had consumed (read) all of the data, the writing/generating process will finally exit.</p><p>This, however, does not work with prinseq-lite.pl (version 0.20.4 or earlier), with a <strong>broken pipe</strong> error.<span
id="more-2360"></span></p><p>Named pipes are very similar to usual files, with two <strong>major differences</strong>:</p><ul><li>named pipes are <strong>not seekable</strong>: you cannot move file pointer (at least not backwards, not sure about skipping forward);</li><li>you <strong>cannot</strong> arbitrarily close/<strong>re-open</strong> a named pipe from the consuming end: closing a pipe on the consuming end also closes it for the writing/generating process.</li></ul><p>The reason why prinseq-lite.pl does not work with named pipes is that it performs file format checking first &#8211; by opening the file, reading the first 3 lines, and closing it.<br
/> Closing a named pipe causes <strong>broken pipe</strong> for the writing process, and when prinseq-lite.pl attempts to open the pipe again &#8211; it succeeds, but there is no data there anymore, so it just sits and waits for data <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p><p>I&#8217;m ok with a quick and dirty solution, so here it is: <a
href="https://gist.github.com/spock/7d4e46e1158e2e4a46d4">prinseq-lite.pl patch to enable mkfifo named pipes as input files</a> (also local <a
href="http://bogdan.org.ua/wp-content/uploads/2016/02/prinseq-lite.pl_.patch_.txt">prinseq-lite.pl.patch</a>).<br
/> <strong>WARNING</strong>: this patch simply disables file format checking!</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F24%2Fhow-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html&amp;linkname=How%20to%20use%20mkfifo%20named%20pipes%20with%20prinseq-lite.pl" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F24%2Fhow-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html&amp;linkname=How%20to%20use%20mkfifo%20named%20pipes%20with%20prinseq-lite.pl" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F24%2Fhow-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html&amp;linkname=How%20to%20use%20mkfifo%20named%20pipes%20with%20prinseq-lite.pl" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F24%2Fhow-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html&amp;linkname=How%20to%20use%20mkfifo%20named%20pipes%20with%20prinseq-lite.pl" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F24%2Fhow-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html&amp;linkname=How%20to%20use%20mkfifo%20named%20pipes%20with%20prinseq-lite.pl" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F24%2Fhow-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html&#038;title=How%20to%20use%20mkfifo%20named%20pipes%20with%20prinseq-lite.pl" data-a2a-url="https://bogdan.org.ua/2016/02/24/how-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html" data-a2a-title="How to use mkfifo named pipes with prinseq-lite.pl"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/02/24/how-to-use-mkfifo-named-pipes-with-prinseq-lite-pl.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>ZFS is the FS for Containers in Ubuntu 16.04 and how it compares to btrfs</title><link>https://bogdan.org.ua/2016/02/20/zfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html</link> <comments>https://bogdan.org.ua/2016/02/20/zfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html#comments</comments> <pubDate>Sat, 20 Feb 2016 18:45:00 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[btrfs]]></category> <category><![CDATA[comparison]]></category> <category><![CDATA[ext4]]></category> <category><![CDATA[FreeNAS]]></category> <category><![CDATA[vs]]></category> <category><![CDATA[XFS]]></category> <category><![CDATA[ZFS]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2354</guid> <description><![CDATA[Recently in hacker news the following was posted: ZFS is the FS for Containers in Ubuntu 16.04. I must admit the 16.04 demo does look very pleasant to work with. However, bringing in ZFS into Linux reminded me of a fairly recent comparison of ZFS and btrfs that I had to do when building my [&#8230;]]]></description> <content:encoded><![CDATA[<p>Recently in hacker news the following was posted: <a
href="https://news.ycombinator.com/item?id=11125063">ZFS is the FS for Containers in Ubuntu 16.04</a>.</p><p>I must admit the 16.04 demo does look very pleasant to work with.</p><p>However, bringing in ZFS into Linux reminded me of a fairly recent comparison of ZFS and btrfs that I had to do when building my home NAS.<br
/> At that time, few months ago, I&#8217;ve arrived (among others) at the following conclusions:</p><ul><li>ZFS on FreeBSD is reliable, though a memory hog;</li><li>on Debian, OpenVault seems to be a good NAS web-management interface;</li><li>on FreeBSD, FreeNAS is good (there is also Nas4Free fork of an older version, but I haven&#8217;t looked into it deep enough);</li><li>running ZFS on linux (even as a kernel module) is the least efficient solution, at least partially because kernel&#8217;s file caching and ZFS&#8217;s ARC cache are two separate entities;</li><li>although btrfs offers features very similar to ZFS, as of few months ago OpenVault did not offer btrfs volumes support from the web-interface.</li></ul><p>In the end, I&#8217;ve decided to go with FreeNAS, and it seems to work well so far.</p><p>But had anything changed in the <em>btrfs vs ZFS on Linux</em> field?<br
/> <span
id="more-2354"></span><br
/> Luckily, in the comments section of the <a
href="http://blog.dustinkirkland.com/2016/02/zfs-is-fs-for-containers-in-ubuntu-1604.html">original post</a> Brian Mullan linked to a recent Bachelor degree project titled <a
href="https://www.diva-portal.org/smash/get/diva2:822493/FULLTEXT01.pdf">A performance comparison of ZFS and btrfs on Linux</a> (<a
href="http://bogdan.org.ua/wp-content/uploads/2016/02/A_performance_comparison_of_ZFS_and_btrfs_on_Linux.pdf">local copy</a>). Here&#8217;s an excerpt from the abstract:</p><blockquote><p> The main conclusions that can be drawn from the analysis of the gathered data is that<br
/> Btrfs has improved greatly in recent years and is today showing great throughput whereas<br
/> ZFS on Linux is performing considerably worse than Btrfs.</p></blockquote><p>The document is definitely worth looking at &#8211; actual results start on page 22, and there are figures for easy comprehension <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /><br
/> XFS and ext4 are also added to the comparison, so if you are thinking about changing your FS &#8211; the document may help you, too.<br
/> The only area where ZFS excelled was database-like load; btrfs and XFS were the leaders in the majority of other tests.<br
/> (In fact, somewhat lower btrfs performance for database-like loads seems to be a well-known thing, and can be <em>cured</em> with the <code>nodatacow</code> mount option &#8211; see e.g. this <a
href="http://blog.pgaddict.com/posts/friends-dont-let-friends-use-btrfs-for-oltp" class="broken_link" rel="nofollow">nice rant about PostgreSQL on btrfs</a>.)</p><p>I do believe that ZFS is still more stable than btrfs, but I&#8217;m also still not convinced that <em>ZFS and Linux</em> are a good combination.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F20%2Fzfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html&amp;linkname=ZFS%20is%20the%20FS%20for%20Containers%20in%20Ubuntu%2016.04%20and%20how%20it%20compares%20to%20btrfs" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F20%2Fzfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html&amp;linkname=ZFS%20is%20the%20FS%20for%20Containers%20in%20Ubuntu%2016.04%20and%20how%20it%20compares%20to%20btrfs" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F20%2Fzfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html&amp;linkname=ZFS%20is%20the%20FS%20for%20Containers%20in%20Ubuntu%2016.04%20and%20how%20it%20compares%20to%20btrfs" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F20%2Fzfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html&amp;linkname=ZFS%20is%20the%20FS%20for%20Containers%20in%20Ubuntu%2016.04%20and%20how%20it%20compares%20to%20btrfs" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F20%2Fzfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html&amp;linkname=ZFS%20is%20the%20FS%20for%20Containers%20in%20Ubuntu%2016.04%20and%20how%20it%20compares%20to%20btrfs" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F20%2Fzfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html&#038;title=ZFS%20is%20the%20FS%20for%20Containers%20in%20Ubuntu%2016.04%20and%20how%20it%20compares%20to%20btrfs" data-a2a-url="https://bogdan.org.ua/2016/02/20/zfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html" data-a2a-title="ZFS is the FS for Containers in Ubuntu 16.04 and how it compares to btrfs"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/02/20/zfs-is-the-fs-for-containers-in-ubuntu-16-04-and-how-it-compares-to-btrfs.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to: convert your VPS root filesystem to btrfs (using rescue boot)</title><link>https://bogdan.org.ua/2016/02/15/how-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html</link> <comments>https://bogdan.org.ua/2016/02/15/how-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html#comments</comments> <pubDate>Mon, 15 Feb 2016 17:04:25 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[btrfs]]></category> <category><![CDATA[convert]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[filesystem]]></category> <category><![CDATA[VPS]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2349</guid> <description><![CDATA[I&#8217;m moving from (a kind of&#8230;) 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&#8230; That server is now about 6-7 years old, built with off-the-shelf components, some of which [&#8230;]]]></description> <content:encoded><![CDATA[<p>I&#8217;m moving from (a kind of&#8230;) a dedicated server to a VPS, to decrease my frightful anticipation of hardware failures.<br
/> <em>Honestly though, that server had been freezing up and restarting spontaneously for several months now, causing sometimes really long down-times&#8230;</em><br
/> That server is now about 6-7 years old, built with off-the-shelf components, some of which (the HDD <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> ) had weird noises from the very start.<br
/> Definitely time to move!</p><p>I&#8217;ve purchased a fairly cheap VPS with an easy, one-click upgrade option for after I&#8217;m done configuring it.<br
/> It comes with a wide selection of OSes to pre-install; I&#8217;ve chosen <strong>Debian Jessie</strong>, version 8.3 as of this writing.</p><p>I wanted to use <strong>btrfs</strong> from the beginning, so could have installed Debian myself, but&#8230; VPS provider does some initial configuration (like their Debian mirror and some other things), so I&#8217;ve felt that converting to btrfs <em>after the fact</em> would be easier. Now that I&#8217;ve done this &#8211; I guess it was fairly easy, although preparation did take some time.</p><p>Below, I&#8217;m providing step-by-step instructions on how to convert your root filesystem from (most likely) <strong>ext4 to btrfs</strong>.<br
/> <span
id="more-2349"></span><br
/> I&#8217;ll be using my provider&#8217;s <em>rescue boot</em> mode: this is a live Debian system which is network-booted on my own VPS, and thus has access to the SSD/HDD of my VPS. Hopefully, your provider has a similar feature.</p><p>Preparing for this conversion, I had mostly used two sources:</p><ul><li>an older <a
href="https://www.howtoforge.com/how-to-convert-an-ext3-ext4-root-file-system-to-btrfs-on-ubuntu-12.10-p2">howtoforge conversion tutorial</a>, and</li><li><a
href="https://btrfs.wiki.kernel.org/index.php/SysadminGuide">Sysadmin Guide</a></li></ul><p>Before we begin with actual conversion, here is a</p><h3>List of hints and useful practices/commands for a future btrfs user</h3><ul><li>Changing the default subvolume with <code>btrfs subvolume set-default</code> will make the top level of the filesystem inaccessible, except by use of the <code>subvol=/</code> or <code>subvolid=5</code> mount options.</li><li>If top level is no longer your default subvolume, it is useful to have an <strong>fstab</strong> entry for the top level (note the <strong>noauto</strong> option!):<br
/> <code>LABEL=toplevel   /root/btrfs-top-lvl   btrfs  subvol=/,defaults,noauto,noatime   0  0</code></li><li><a
href="http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html">scurbbing and repairing btrfs</a>; most of the hints below originate from Marc&#8217;s <a
href="http://events.linuxfoundation.org/sites/events/files/slides/Btrfs_1.pdf">2014 btrfs presentation</a></li><li>scrub script: <a
href="http://marc.merlins.org/linux/scripts/btrfs-scrub">http://marc.merlins.org/linux/scripts/btrfs-scrub</a></li><li><code>mount -o compress=lzo</code> is fast and best for SSDs; <code>mount -o compress=zlib</code> compresses better but is slower</li><li>you can turn off COW (copy-on-write) for specific files and directories with <code>chattr Â­-C /path</code> (new files will inherit this)</li><li>for a highly fragmented VM, <code>btrfs filesystem defragment vbox.vdi</code> could take hours; <code>cp -reflink=never vbox.vdi vbox.vdi.new; rm vbox.vdi</code> is much faster</li><li><code>cp -reflink=always</code> copies within and between subvolumes without duplicating data</li><li>run scrub nightly or weekly on all btrfs filesystems</li><li><strong>noatime</strong> is the best fstab mount option for btrfs <em>IF USING SNAPSHOTS</em>, because <strong>relatime</strong> still causes at least 1 write every 24h</li><li>if you have <strong>errors=remount-ro</strong> in your <strong>fstab</strong> for extX-filesystem, you should remove it after converting to <strong>btrfs</strong> as it does not understand the option.</li></ul><h3>We are almost ready to start! Just one last thing: partitioning!</h3><p>On my previous server, I did have a certain partition scheme, with separate <strong>/boot</strong>, <strong>/home</strong>, <strong>/var</strong>, <strong>/usr</strong>, and everything else under <strong>/</strong> partition.<br
/> It worked very well for me, never ran into problems (although this is more like a Debian&#8217;s feature, not that of my partition scheme <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> ).<br
/> However&#8230; With the current VPS, it started initially with just everything under <strong>/</strong>, in a single partition.<br
/> I could have re-partitioned everything from the rescue system while converting to <strong>btrfs</strong>, but what for? What would be the benefits?</p><p>Let&#8217;s have a look and evaluate</p><h3>Advantages/disadvantages of keeping specific partitions separate.</h3><ul><li><strong>/boot</strong> comes the first. Normally I format it with ext2, and set aside just 100-200 megabytes for this small partition.<br
/> This improves boot-reliability of the system. With <strong>btrfs</strong>, it was also the case that grub could not use <strong>/boot</strong> on a btrfs volume.<br
/> However,</p><blockquote><p> Newer GRUBs can handle a /boot partition which is btrfs, so you need not have a separate /boot partition formatted as ext3/4.</p></blockquote><p>So this time I&#8217;m going without a separate /boot.<br
/> I will not even create a separate subvolume for it: for snapshotting purposes, <strong>/boot</strong> fits perfectly under the <strong>/</strong> snapshots.</li><li>Next comes <strong>/home</strong>.<br
/> The reason to separate it is to safeguard user data when upgrading/reinstalling the OS.<br
/> This, however, can be achieved with <strong>btrfs subvolumes</strong> &#8211; no need for partitions!<br
/> I&#8217;m going with a &#8220;subvolume for home&#8221; here, then.</li><li>Next comes <strong>/var</strong>, or more precisely <strong>/var/log</strong>.<br
/> One of the reasons to keep <strong>/var/log</strong> separate is to prevent filesystem overfill if logs suddenly start growing too fast.<br
/> This, however, can be achieved with <strong>subvolume quotas</strong>. No need for a partition!</li><li>There is also <strong>/var/lib/<databasename></strong> (and also <strong>/var/lib/lxc/&#8230;</strong>), which hold fairly big data files, often with random write access patterns.<br
/> There are two reasons to make them subvolumes:</p><ol><li>for data-only snapshots</li><li>to enable <code>nocow</code>/<code>nodatacow</code> at mount time, to avoid high fragmentation with random writes</li></ol><p>However, this can be done later, when these databases/LXC get installed &#8211; in just a few commands, without rebooting.</li><li>Finally, <strong>/</strong> itself should be a separate subvolume &#8211; mostly for snapshot and reinstall/upgrade reasons.</li></ul><p>Ok, now we are <strong>really</strong> going to</p><h3>Convert the filesystem</h3><ol><li>Enable rescue system, write down access credentials. You may need to restart your VPS to boot into rescue system, but check with your VPS provider first.</li><li>Connect to and log in to the rescue system.</li><li>Install <strong>btrfs-tools</strong> in the rescue system, if not there yet. We&#8217;ll need <strong>btrfs-convert</strong>, which should be included in <strong>btrfs-tools</strong>.</li><li>I&#8217;m assuming that your SSD/HDD is device <strong>/dev/sda</strong>, and that the only (root) partition there is <strong>/dev/sda1</strong>; adjust the next steps if your setup is different. <em>Only proceed with commands if you understand what they are doing!</em></li><li>It never hurts to <code>fsck /dev/sda1</code> before doing filesystem conversion <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> You should see something like <em>/dev/sda1: clean, 27282/1564672 files, 351853/6249472 blocks</em>.</li><li><code>btrfs-convert -l toplevel /dev/sda1</code>; note that I&#8217;m adding a &#8220;toplevel&#8221; <em>LABEL</em> to the top level of btrfs, for easier mounting it later. The output should look like this:<br
/><blockquote><p> creating btrfs metadata.<br
/> creating ext2fs image file.<br
/> cleaning up system chunk.<br
/> conversion complete.</p></blockquote><p> At this point the system is already btrfs! <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></li><li>If you forgot to set btrfs label, or decide to do it later: list the filesystems with <code>btrfs filesystem show</code>, or just look for the label with <code>btrfs filesystem label /dev/sda1</code> (which will produce an empty line if there is no label), then simply <code>btrfs filesystem label /dev/sda1 toplevel</code>; it will produce no output on success.</li><li>Let&#8217;s change into the new system, and start configuring it:<br
/> <code>mount /dev/sda1 /mnt<br
/> for fs in proc sys dev dev/pts; do mount --bind /$fs /mnt/$fs; done<br
/> chroot /mnt</code></li><li><code>ls</code> now should show your root filesystem files and directories, plus the <strong>ext2_saved</strong> &#8220;directory&#8221; (which is a subvolume, actually):<br
/><blockquote><p> bin   dev  ext2_saved  initrd.img         installimage.debug  lib64       media  opt   root  sbin  sys  usr  vmlinuz<br
/> boot  etc  home        installimage.conf  lib                 lost+found  mnt    proc  run   srv   tmp  var</p></blockquote></li><li>Run <code>blkid /dev/sda1</code> to find out the UUID of the new btrfs top-level volume. You can also see it with <code>btrfs filesystem show</code>:<br
/><blockquote><p> /dev/sda1: LABEL=&#8221;toplevel&#8221; UUID=&#8221;3124c827-c3bd-4a62-843f-1d5a552f1858&#8243; UUID_SUB=&#8221;ffad5668-2ac7-4ea4-83ad-e6ccba7ccf96&#8243; TYPE=&#8221;btrfs&#8221; PARTUUID=&#8221;750b31a7-01&#8243;</p></blockquote></li><li>Edit <strong>/etc/fstab</strong> (with e.g. <code>nano /etc/fstab</code>):<ul><li>change <strong>UUID</strong> of <strong>/</strong> to the new one</li><li>change the filesystem type from ext3/ext4 to <strong>btrfs</strong></li><li>change the options to <strong>subvol=root,defaults,noatime,compress=lzo,ssd,discard</strong> (yes, <strong>subvol=root</strong> does not exist yet&#8230; also, <strong>ssd,discard</strong> are for SSDs only, and instead of adding <strong>discard</strong> here it might be better to setup an <strong>fstrim</strong> cronjob. Finally, <strong>noatime</strong> can be left out if you are not going to make snapshots.)</li><li>change the last number in the line from 1 to 0 (the fsck passes &#8211; btrfs does not want boot-time filesystem checking)</li></ul></li><li>Some guides mention editing /etc/grub.d/00_header in a specific way, running <em>grub-mkconfig | grep &#8221; ro &#8220;</em> to see if it adds the proper <em>rootflags=subvol=root</em>, then even run <em>update-grub</em> and <em>grub-install /dev/sda</em> here&#8230; But all of this seems redundant or plain unnecessary. First of all, the <em>root</em> subvolume simply does not exist yet, so <em>grub-mkconfig</em> will <strong>not</strong> produce correct <em>rootflags</em>. Secondly, we are not yet done with setting up subvolumes, and we are not going to reboot right now, so running <em>update-grub</em>/<em>grub-install</em> is a bit premature at this stage <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></li><li>Now we are going to create some subvolumes. As I want to name the <strong>root</strong> subvolume simply <em>root</em>, I should first move the root user&#8217;s home files somewhere else (otherwise <code>btrfs snapshot</code> complains &#8220;ERROR: incorrect snapshot name &#8216;/&#8217;&#8221;):<br
/> <code>mv /root /root_orig<br
/> btrfs subvolume snapshot / /root</code></li><li>The same <em>problem</em> with <strong>/home</strong>, need to move it as well: <code>mv /home /home_orig</code></li><li>I can NOT snapshot <strong>/home</strong> like I did with <strong>/</strong>, because it is just a directory, not a volume like <strong>/</strong>, so:<br
/> <code>btrfs subvolume create /home</code><br
/> Note: my <strong>/home</strong> (/home_orig) is still empty, as this is a brand-new installation with only the root user, so double-check steps below, as I haven&#8217;t really run them.<br
/> <code>rsync --progress -aHAX /home_orig/* /home<br
/> ls -la /home/<br
/> ls -la /home_orig/<br
/> rm -fr /home_orig/*<br
/> ls -la /root/home/<br
/> rm -fr /root/home/*</code> # be sure to leave the empty /root/home/ in place: it will be the mount point.</li><li><code>nano /etc/fstab</code> to add the <strong>/home</strong> mount line, using <strong>the same UUID as earlier for the / partition</strong>, but a different <strong>subvol</strong> option:<br
/> <strong>UUID=3124c827-c3bd-4a62-843f-1d5a552f1858 /home               btrfs   subvol=home,defaults 0       0</strong><br
/> Feel free to add more mount options, similar to those for root subvolume. While we are editing /etc/fstab, it also makes sense to add a <strong>non-automount /toplevel</strong> entry (<strong>UUID=3124c827-c3bd-4a62-843f-1d5a552f1858 /toplevel               btrfs   subvol=/,defaults,noauto 0       0</strong>) and create mountpoint for it: <code>mkdir /root/toplevel</code></li><li>Follow the same procedure to create the <strong>/var/log</strong> subvolume. I&#8217;m using <em>flat subvolumes</em> layout here:<br
/> <code>btrfs subvolume create /log<br
/> rsync --progress -aHAX /var/log/* /log<br
/> ls -la /log/<br
/> ls -la /var/log/<br
/> rm -fr /var/log/*<br
/> ls -la /root/var/log/<br
/> rm -fr /root/var/log/*<br
/> </code></li><li>Add <strong>/var/log</strong> entry to <strong>fstab</strong>:<br
/> <strong>UUID=&#8221;3124c827-c3bd-4a62-843f-1d5a552f1858&#8243; /var/log   btrfs   subvol=log,defaults,ssd,discard,compress=lzo,noatime   0   0</strong></li><li>/var/lib/<name> &#8211; databases, LXC, nodatacow/nocow &#8211; can be created later, not doing it here and now.</li><li><code>cp /etc/fstab /root/etc/fstab</code></li><li><code>exit</code> # chroot</li><li> <code>for fs in proc sys dev/pts dev; do umount /mnt/$fs; done<br
/> umount /mnt</code></li><li>Let&#8217;s enter the new root subvolume!<br
/> <code>mount -o subvol=root /dev/sda1 /mnt<br
/> for fs in proc sys dev dev/pts; do mount --bind /$fs /mnt/$fs; done<br
/> chroot /mnt</code></li><li>Oh, we forgot to move back root_orig into /root! That&#8217;s easy: <code>mv root_orig root</code>. If you want your root&#8217;s aliases/profile to load, then just <code>exit</code> and <code>chroot /mnt</code> again (I had to do that for the nice pre-configured prompt colours <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley" /> )</li><li><code>btrfs subvolume list /</code> to see our new and shiny subvolumes:<br
/><blockquote><p> ID 256 gen 8 top level 5 path ext2_saved<br
/> ID 260 gen 49 top level 5 path root<br
/> ID 261 gen 35 top level 5 path home<br
/> ID 262 gen 42 top level 5 path log</p></blockquote></li><li>Let&#8217;s make <strong>root</strong> the default subvolume! If suddenly <em>rootflags</em> get lost during grub configuration, then the system should still be able to boot. Subvol ID comes from the output of the command above (260 in my case):<br
/> <code>btrfs subvolume set-default 260 /</code> # no output<br
/> <code>btrfs subvolume get-default /</code> # to verify</p><blockquote><p>ID 260 gen 49 top level 5 path root</p></blockquote></li><li>Now let&#8217;s check grub-mkconfig output: <code>grub-mkconfig | grep " ro "</code>. Now that the subvolume exists, it does show all the desired <em>rootflags=subvol=root</em>.</li><li>Let&#8217;s make sure our system will be bootable:<br
/> <code>update-grub<br
/> grub-install /dev/sda</code></li><li>Leave the chroot:<br
/> <code>exit<br
/> for fs in proc sys dev/pts dev; do umount /mnt/$fs; done<br
/> umount /mnt</code></li><li>Now let&#8217;s mount top-level again, for cleanup. If you remember, we had all the <strong>/</strong> files there &#8211; which are now in the <strong>root</strong> subvolume:<br
/> <code>mount -o subvol=/ /dev/sda1 /mnt</code></li><li>Navigate to /mnt (<code>cd /mnt</code>, yes <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /> ) and delete from here everything that is <strong>NOT</strong> a subvolume.<br
/> The command which supposedly does this is <code>find /mnt -xdev -delete</code> (<strong>-xdev</strong> is supposed to not descend into mounts of other filesystems), but I haven&#8217;t used it &#8211; was a bit tired and did not want to screw up the so-far-successful conversion, so I just did <code>rm -rf bin boot dev etc initrd.img lib lib64 lost+found media mnt opt proc run sbin srv sys tmp usr vmlinuz var root_orig</code> &#8211; basically, deleted everything except for ext2_saved, home, root, and log &#8211; which are all subvolumes.</li><li>Confirm that only subvolumes are left now:<br
/> <code>ls -la</code>:</p><blockquote><p> drwxr-xr-x 1 root root  10 Feb 13 21:30 ext2_saved<br
/> drwxr-xr-x 1 root root   0 Feb 13 22:04 home<br
/> drwxr-xr-x 1 root root 510 Feb 13 22:13 log<br
/> drwxr-xr-x 1 root root 318 Feb 13 22:18 root</p></blockquote><p><code>btrfs subvolume list /mnt</code>:</p><blockquote><p> ID 256 gen 8 top level 5 path ext2_saved<br
/> ID 260 gen 52 top level 5 path root<br
/> ID 261 gen 35 top level 5 path home<br
/> ID 262 gen 42 top level 5 path log</p></blockquote><p><code>btrfs subvolume get-default /mnt</code>:</p><blockquote><p>ID 260 gen 52 top level 5 path root</p></blockquote></li><li>We can leave now: <code>cd / &#038;&#038; umount /mnt</code></li><li>Reboot into the new system. If this fails: can boot rescue again, chroot and check what went wrong&#8230;</li><li>In my case, conversion seemed to have succeeded, BUT: a) for some reason <strong>/toplevel</strong> was mounted at boot and full of root-like files which should not have been there anymore; b) I could not delete <strong>ext2_saved</strong>, at all, neither from <strong>/</strong> nor from <strong>/toplevel</strong>. The problem was with the <strong>toplevel</strong> mount line in <strong>/etc/fstab</strong> (initially, I forgot to specify the filesystem type). After fixing this and rebooting once more, everything was perfect: <strong>/toplevel</strong> not mounted, and when mounted it only had subvolumes in it. And of course the system booted without any problems. Now I could delete the previous filesystem snapshot: <code>mount /toplevel; btrfs subvolume delete /toplevel/ext2_saved; umount /toplevel</code>. Note that there was also another, different <strong>ext2_saved</strong> in the <strong>root</strong> subvolume: it is NOT a subvolume, which was not carried over when we created the <strong>/</strong> snapshot &#8211; only the empty directory was left in place. (Yes, snapshots do not descend into subvolumes.)</li></ol><p>The last 2 commands to issue (after <code>mount /toplevel</code>) are <code>btrfs filesystem defragment -r /toplevel</code> and <code>btrfs balance start /toplevel</code>.<br
/> I&#8217;m not including them in the instructions above: they are not strictly required, and if your filesystem had some heavy use before conversion, you may want to run these 2 commands more intelligently, in phases (metadata first, then big files, then smaller, etc). Another reason is that it may produce significant system load. On my fresh system both finished very quickly.</p><p>&#8230;And we are done!</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F15%2Fhow-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html&amp;linkname=How%20to%3A%20convert%20your%20VPS%20root%20filesystem%20to%20btrfs%20%28using%20rescue%20boot%29" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F15%2Fhow-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html&amp;linkname=How%20to%3A%20convert%20your%20VPS%20root%20filesystem%20to%20btrfs%20%28using%20rescue%20boot%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F15%2Fhow-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html&amp;linkname=How%20to%3A%20convert%20your%20VPS%20root%20filesystem%20to%20btrfs%20%28using%20rescue%20boot%29" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F15%2Fhow-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html&amp;linkname=How%20to%3A%20convert%20your%20VPS%20root%20filesystem%20to%20btrfs%20%28using%20rescue%20boot%29" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F15%2Fhow-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html&amp;linkname=How%20to%3A%20convert%20your%20VPS%20root%20filesystem%20to%20btrfs%20%28using%20rescue%20boot%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F15%2Fhow-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html&#038;title=How%20to%3A%20convert%20your%20VPS%20root%20filesystem%20to%20btrfs%20%28using%20rescue%20boot%29" data-a2a-url="https://bogdan.org.ua/2016/02/15/how-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html" data-a2a-title="How to: convert your VPS root filesystem to btrfs (using rescue boot)"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/02/15/how-to-convert-your-vps-root-filesystem-to-btrfs-using-rescue-boot.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to fix: mod_proxy&#8217;s ProxyPass directive does not work</title><link>https://bogdan.org.ua/2016/02/10/how-to-fix-mod_proxy-proxypass-directive-does-not-work.html</link> <comments>https://bogdan.org.ua/2016/02/10/how-to-fix-mod_proxy-proxypass-directive-does-not-work.html#comments</comments> <pubDate>Wed, 10 Feb 2016 19:37:24 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[mod_proxy]]></category> <category><![CDATA[ProxyPass]]></category> <category><![CDATA[proxy_http]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2341</guid> <description><![CDATA[So&#8230; 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 &#8211; say, on port 8000 in [&#8230;]]]></description> <content:encoded><![CDATA[<p>So&#8230; 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.<br
/> From your client-side JavaScript UI you talk (in JSON) to the API, which is implemented as a separate node.js/Python/etc server &#8211; say, on port 8000 in the same LXC container.</p><p>The simplest solution to forward requests from the web-frontend to your API is by using <strong>mod_proxy</strong>.<br
/> 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:</p><blockquote><p> ProxyPass               &#8220;/api&#8221;  &#8220;http://localhost:8000&#8243;<br
/> ProxyPassReverse        &#8220;/api&#8221;  &#8220;http://localhost:8000&#8243;</p></blockquote><p>I&#8217;d suggest <em>not</em> wrapping this fragment with the classical <strong>IfModule</strong>: as your application will not really work without its API back-end, you actually <em>want</em> Apache to fail as soon as possible if <strong>mod_proxy</strong> is missing.</p><p>That was easy, right? What, it doesn&#8217;t work? Can&#8217;t be! It&#8217;s dead simple! No way you could make a mistake in 2 lines of configuration!!! :mad_rage: <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p><p>Oh wait&#8230; I remember I had this problem before&#8230;<span
id="more-2341"></span></p><p>Let&#8217;s check:</p><ol><li><strong>Step 1.</strong> Did you disable (using <code>a2dissite default</code> or <code>a2dissite 000-default</code>, depending on your Debian-based GNU/Linux) the default website? If your application and the default website are configured in a similar way, then it might be the <em>default</em> site which is serving your app&#8217;s pages. The most sure way is to just disable it.</li><li><strong>Step 2.</strong> Did you enable also the <strong>proxy_http</strong> sub-module? (Using <code>a2enmod proxy_http</code>, followed by <code>service apache2 restart</code>) <strong>mod_proxy</strong> is only the core module, actual per-protocol work is done by these sub-modules.</li></ol><p>Your requests to /api should now be passed on to your API server. If not &#8211; please write in the comments what was the problem in your case and how you solved it. HTH!</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F10%2Fhow-to-fix-mod_proxy-proxypass-directive-does-not-work.html&amp;linkname=How%20to%20fix%3A%20mod_proxy%E2%80%99s%20ProxyPass%20directive%20does%20not%20work" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F10%2Fhow-to-fix-mod_proxy-proxypass-directive-does-not-work.html&amp;linkname=How%20to%20fix%3A%20mod_proxy%E2%80%99s%20ProxyPass%20directive%20does%20not%20work" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F10%2Fhow-to-fix-mod_proxy-proxypass-directive-does-not-work.html&amp;linkname=How%20to%20fix%3A%20mod_proxy%E2%80%99s%20ProxyPass%20directive%20does%20not%20work" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F10%2Fhow-to-fix-mod_proxy-proxypass-directive-does-not-work.html&amp;linkname=How%20to%20fix%3A%20mod_proxy%E2%80%99s%20ProxyPass%20directive%20does%20not%20work" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F10%2Fhow-to-fix-mod_proxy-proxypass-directive-does-not-work.html&amp;linkname=How%20to%20fix%3A%20mod_proxy%E2%80%99s%20ProxyPass%20directive%20does%20not%20work" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2016%2F02%2F10%2Fhow-to-fix-mod_proxy-proxypass-directive-does-not-work.html&#038;title=How%20to%20fix%3A%20mod_proxy%E2%80%99s%20ProxyPass%20directive%20does%20not%20work" data-a2a-url="https://bogdan.org.ua/2016/02/10/how-to-fix-mod_proxy-proxypass-directive-does-not-work.html" data-a2a-title="How to fix: mod_proxy’s ProxyPass directive does not work"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2016/02/10/how-to-fix-mod_proxy-proxypass-directive-does-not-work.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Midnight Commander (mc): convenient hard links creation from user menu</title><link>https://bogdan.org.ua/2015/12/03/midnight-commander-mc-convenient-hard-links-creation-from-user-menu.html</link> <comments>https://bogdan.org.ua/2015/12/03/midnight-commander-mc-convenient-hard-links-creation-from-user-menu.html#comments</comments> <pubDate>Thu, 03 Dec 2015 13:51:28 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2315</guid> <description><![CDATA[Midnight Commander is a convenient two-panel file manager with tons of features. You can create hard links and symbolic links using C-x l and C-x s keyboard shortcuts. However, these two shortcuts invoke two completely different dialogs. While for C-x s you get 2 pre-populated fields (path to the existing file, and path to the [&#8230;]]]></description> <content:encoded><![CDATA[<p><a
href="https://www.midnight-commander.org/" title="project website">Midnight Commander</a> is a <a
href="https://en.wikipedia.org/wiki/Midnight_Commander" title="wikipedia article about mc">convenient two-panel file manager</a> with tons of features.</p><p>You can create hard links and symbolic links using <strong>C-x l</strong> and <strong>C-x s</strong> keyboard shortcuts. However, these two shortcuts invoke two completely different dialogs.</p><p>While for <strong>C-x s</strong> you get 2 pre-populated fields (path to the existing file, and path to the link &#8211; which is pre-populated with your opposite file panel path plus the name of the file under cursor; simply try it to see what I mean), for <strong>C-x l</strong> you only get 1 empty field: path of the hard link to create for a file under cursor. Symlink&#8217;s behaviour would be much more convenient&#8230;</p><p>Fortunately, a good man called <em>Wiseman1024</em> created a <a
href="https://www.midnight-commander.org/ticket/2092" title="Better hard link creation, support for directories">feature request in the MC&#8217;s bug tracker</a> 6 years ago. Not only had he done so, but he had also uploaded a sample <a
href="https://www.midnight-commander.org/attachment/ticket/2092/mc.menu.hardlink-example" title="mc user menu script" class="broken_link" rel="nofollow">mc user menu script</a> (<a
href="http://bogdan.org.ua/wp-content/uploads/2015/12/mc.menu_.hardlink.txt">local copy</a>), which works wonderfully! You can select multiple files, then <strong>F2 l</strong> (lower-case L), and hard-links to your selected files (or a file under cursor) will be created in the opposite file panel. Great, thank you <em>Wiseman1024</em>!</p><p>Word of warning: you must know what <a
href="https://en.wikipedia.org/wiki/Hard_link" title="wikipedia article about hard links">hard links</a> are and what their limitations are before using this menu script. You also must check and understand the user menu code before adding it to your mc (by <strong>F9 C m u</strong>, and then pasting the script from the file).</p><p>Word of hope: 4 years ago Wiseman&#8217;s feature request was assigned to <em>Future Releases</em> version, so a more convenient <strong>C-x l</strong> will (sooner or later) become the part of mc. Hopefully.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F12%2F03%2Fmidnight-commander-mc-convenient-hard-links-creation-from-user-menu.html&amp;linkname=Midnight%20Commander%20%28mc%29%3A%20convenient%20hard%20links%20creation%20from%20user%20menu" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F12%2F03%2Fmidnight-commander-mc-convenient-hard-links-creation-from-user-menu.html&amp;linkname=Midnight%20Commander%20%28mc%29%3A%20convenient%20hard%20links%20creation%20from%20user%20menu" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F12%2F03%2Fmidnight-commander-mc-convenient-hard-links-creation-from-user-menu.html&amp;linkname=Midnight%20Commander%20%28mc%29%3A%20convenient%20hard%20links%20creation%20from%20user%20menu" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F12%2F03%2Fmidnight-commander-mc-convenient-hard-links-creation-from-user-menu.html&amp;linkname=Midnight%20Commander%20%28mc%29%3A%20convenient%20hard%20links%20creation%20from%20user%20menu" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F12%2F03%2Fmidnight-commander-mc-convenient-hard-links-creation-from-user-menu.html&amp;linkname=Midnight%20Commander%20%28mc%29%3A%20convenient%20hard%20links%20creation%20from%20user%20menu" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2015%2F12%2F03%2Fmidnight-commander-mc-convenient-hard-links-creation-from-user-menu.html&#038;title=Midnight%20Commander%20%28mc%29%3A%20convenient%20hard%20links%20creation%20from%20user%20menu" data-a2a-url="https://bogdan.org.ua/2015/12/03/midnight-commander-mc-convenient-hard-links-creation-from-user-menu.html" data-a2a-title="Midnight Commander (mc): convenient hard links creation from user menu"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2015/12/03/midnight-commander-mc-convenient-hard-links-creation-from-user-menu.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Tools to manage Debian services and start-up scripts</title><link>https://bogdan.org.ua/2015/04/08/tools-to-manage-debian-services-and-start-up-scripts.html</link> <comments>https://bogdan.org.ua/2015/04/08/tools-to-manage-debian-services-and-start-up-scripts.html#comments</comments> <pubDate>Wed, 08 Apr 2015 09:52:21 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[bum]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[rcconf]]></category> <category><![CDATA[runlevel]]></category> <category><![CDATA[sysv-rc-conf]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2269</guid> <description><![CDATA[sysv-rc-conf: text-UI, allows editing multiple runlevels, but seems to be failing recently rcconf: another good-looking text-UI alternative; can only modify current runlevel bum: GUI tool (BootUp Manager) More details about these tools and runlevels (in German).]]></description> <content:encoded><![CDATA[<ul><li>sysv-rc-conf: text-UI, allows editing multiple runlevels, but seems to be failing recently</li><li>rcconf: another good-looking text-UI alternative; can only modify current runlevel</li><li>bum: GUI tool (BootUp Manager)</li></ul><p>More details about these <a
href="http://wiki.ubuntuusers.de/Dienste">tools and runlevels</a> (in German).</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F04%2F08%2Ftools-to-manage-debian-services-and-start-up-scripts.html&amp;linkname=Tools%20to%20manage%20Debian%20services%20and%20start-up%20scripts" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F04%2F08%2Ftools-to-manage-debian-services-and-start-up-scripts.html&amp;linkname=Tools%20to%20manage%20Debian%20services%20and%20start-up%20scripts" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F04%2F08%2Ftools-to-manage-debian-services-and-start-up-scripts.html&amp;linkname=Tools%20to%20manage%20Debian%20services%20and%20start-up%20scripts" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F04%2F08%2Ftools-to-manage-debian-services-and-start-up-scripts.html&amp;linkname=Tools%20to%20manage%20Debian%20services%20and%20start-up%20scripts" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F04%2F08%2Ftools-to-manage-debian-services-and-start-up-scripts.html&amp;linkname=Tools%20to%20manage%20Debian%20services%20and%20start-up%20scripts" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2015%2F04%2F08%2Ftools-to-manage-debian-services-and-start-up-scripts.html&#038;title=Tools%20to%20manage%20Debian%20services%20and%20start-up%20scripts" data-a2a-url="https://bogdan.org.ua/2015/04/08/tools-to-manage-debian-services-and-start-up-scripts.html" data-a2a-title="Tools to manage Debian services and start-up scripts"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2015/04/08/tools-to-manage-debian-services-and-start-up-scripts.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Compressors galore: pbzip2, lbzip2, plzip, xz, and lrzip tested on a FASTQ file</title><link>https://bogdan.org.ua/2015/03/28/compressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html</link> <comments>https://bogdan.org.ua/2015/03/28/compressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html#comments</comments> <pubDate>Fri, 27 Mar 2015 23:34:14 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Comparison]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Misc]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[benchmark]]></category> <category><![CDATA[bzip2]]></category> <category><![CDATA[fastq]]></category> <category><![CDATA[lbzip2]]></category> <category><![CDATA[lrzip]]></category> <category><![CDATA[pbzip2]]></category> <category><![CDATA[plzip]]></category> <category><![CDATA[test]]></category> <category><![CDATA[xz]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2257</guid> <description><![CDATA[About 2 years ago I had already reviewed some parallel (and not) compressing utilities, settling at that time on pbzip2 &#8211; it scales quasi-linearly with the number of CPUs/cores, stores compressed data in relatively small 900k blocks, is fast, and has good compression ratio. pbzip2 was (and still is) a very good choice. Yesterday I [&#8230;]]]></description> <content:encoded><![CDATA[<p>About 2 years ago I had already <a
href="http://bogdan.org.ua/2013/10/17/favourite-file-compressor-gzip-bzip2-7z.html">reviewed some parallel (and not) compressing utilities</a>, settling at that time on <strong>pbzip2</strong> &#8211; it scales quasi-linearly with the number of CPUs/cores, stores compressed data in relatively small 900k blocks, is fast, and has good compression ratio. <strong>pbzip2</strong> was (and still is) a very good choice.</p><p>Yesterday I got somewhat distracted, and thus found <strong>lbzip2</strong> -</p><blockquote><p>an independent, multi-threaded implementation of bzip2. It is commonly the fastest SMP (and uniprocessor) bzip2 compressor and decompressor</p></blockquote><p>- as it says in the Debian package description. Is it really &#8220;commonly the fastest&#8221; one? How does it compare to <strong>pbzip2</strong>? Should I use <strong>lbzip2</strong> instead of <strong>pbzip2</strong>?</p><p>This minor distraction had grown into a full-scale web-search and comparison, adding to the mix <strong>plzip</strong> (a parallel version of <strong>lzip</strong>), <strong>xz</strong>, and <strong>lrzip</strong>. After reading thousands of characters, all of these were put to a simple test: compressing an about 2 gigabyte FASTQ file with default options.</p><p>All the external links and benchmarks, as well as my own mini-benchmark results, are provided below.</p><p><strong>The conclusion is that</strong> out of all the tested compressors <strong>lbzip2 is indeed the best one</strong> (for my <em>practical</em> use). It is only slightly better than the trusty <strong>pbzip2</strong>, which takes the second place. All the other compressors performed so poorly, that they do not get any place in my <em>practical</em> rating&#8230;</p><p>So, let us first ask internet wisdom/foolishness, <strong>if lbzip2 or pbzip2 is faster/better?</strong><br
/> <span
id="more-2257"></span></p><ul><li>this <a
href="http://askubuntu.com/questions/63224/what-should-i-rely-on-lbzip2-or-pbzip2">askubuntu question</a> shows that <strong>lbzip2</strong> is compressing faster (1:43) than <strong>pbzip2</strong> (2:34)</li><li>this <a
href="http://vbtechsupport.com/1614/">nice benchmark</a> also confirms that <strong>lbzip2</strong> is indeed faster at compressing; <strong>lbzip2</strong> also appears to use less RAM and a little bit less CPU during compression; during decompression, <strong>lbzip2</strong> (reportedly) uses much more RAM. <strong>lbzip2</strong> achieved at least as good (and even marginally better) compression ratios as <strong>pbzip2</strong>.</li><li><a
href="https://github.com/kjn/lbzip2">lbzip2 github</a> page and also <a
href="http://fibrevillage.com/sysadmin/81-parallel-compression-utilities-on-linux-lbzip2-pbzip2-and-pigz" class="broken_link" rel="nofollow">this unrelated page</a> both say that <strong>lbzip2</strong> is fully cross-compatible with <strong>bzip2</strong></li><li>probably most importantly, lbzip2 github readme says that even <strong>bzip2</strong>-compressed archives get a decompression speedup (which is definitely not the case with <strong>pbzip2</strong>)</li><li><strong>lbzip2</strong> also uses 100-900k blocks (900k by default)</li><li>it is not clear if <strong>lbzip2</strong> is somewhat less widely tested than <strong>pbzip2</strong></li><li><strong>lbzip2</strong>&#8216;s author has <a
href="https://lists.debian.org/debian-mentors/2009/02/msg00135.html">performed some testing</a> (back in 2009, mind you!), and these were the most important results:</li><ul><li><strong>lbzip2</strong> is better when decompressing from a pipe, no matter the producer, and also when the compressed input coming from a regular file is single stream</li><li><strong>pbzip2</strong> beats <strong>lbzip2</strong> when the compressed input is coming from a regular file and is multi-stream (yes, pbzip2 can decompress even lbzip2&#8242;s compressed output faster than lbzip2 itself, when it&#8217;s coming from a regular file) <em>note: if you check the vbsupport benchmark above, you&#8217;ll see that lbzip2 had probably fixed slight lagging behind pbzip2 for regular multi-stream files; this improvement is also confirmed by my testing</em></li></ul></ul><p>So, at least in theory <strong>lbzip2</strong> is indeed better than <strong>pbzip2</strong>, even if only at faster decompression of <strong>bzip2</strong>-compressed files.</p><p>While looking for benchmarks, I&#8217;ve found <a
href="https://aliver.wordpress.com/2010/06/22/huge-unix-file-compresser-shootout-with-tons-of-datagraphs/">this one</a> (old but good), which highly praises <strong>lzop</strong> compressor. Apparently, <strong>lzop</strong> is noticeably faster than even <strong>gzip</strong>, and compresses only a little bit worse. However, I am not really interested in a faster gzip: I need something with much better compression, but still fast enough for multi-gigabyte files.</p><p>Next, I have stumbled upon <a
href="http://www.nongnu.org/lzip/lzip.html">lzip</a> and <a
href="http://www.nongnu.org/lzip/plzip.html">plzip</a> (.lz). What are these compressors?</p><ul><li><strong>plzip</strong> is a parallel version of <strong>lzip</strong>, and fully lzip-compatible</li><li><strong>lzip</strong> is an LZMA compressor</li><li>reading the documentation leaves an impression that <strong>[p]lzip</strong> achieves better compression, is slower, and needs much more RAM than competing compressors</li><li>there is a special utility called <strong>lziprecover</strong>, which helps recover data from damaged lzip archives, by leveraging, on the one hand, CRC checksums of compressed blocks, and, on the other, multiple damaged copies of the archive (if available)</li><li>from the official website:<br
/><blockquote><p><strong>Lzip</strong> is a lossless data compressor with a user interface similar to the one of <strong>gzip</strong> or <strong>bzip2</strong>. <strong>Lzip</strong> is about as fast as <strong>gzip</strong>, compresses most files more than <strong>bzip2</strong>, and is better than both from a data recovery perspective.</p></blockquote></li><li>default &#8220;member&#8221; (compressed block/chunk) size is 4 <em>petabytes</em>, but can be set to a lower value (minimal 100kb), mimicking bzip2&#8242;s chunk size</li><li>supports multiple, independent volumes (loosing one volume will still allow recovering data from all other volumes)</li><li>with multiple cores, <strong>plzip</strong> creates multi-member files by default (but it is not clear, what is the size of these members? Default is said to be twice the dictionary size, but default for dictionary size is not specified in the manual &#8211; so lzip/plzip seem to require compression level -1&#8230;-9 specification)</li><li><a
href="https://aliver.wordpress.com/2010/06/22/huge-unix-file-compresser-shootout-with-tons-of-datagraphs/">here</a> <strong>lzip</strong> compresses a little bit better than <strong>xz</strong> without the <code>--extreme</code> option</li><li><strong>(l|p)bzip2</strong> should still be faster than either <strong>lzip</strong> or <strong>xz</strong></li><li>I started mentioning <strong>xz</strong>, because <strong>lzip</strong> and <strong>xz</strong> (at least historically) are competing LZMA-based compressors</li><li>a 1 year old <a
href="https://blogs.gentoo.org/mgorny/2014/02/22/a-few-words-on-lzip-compressor/">opinion</a> makes the following statements about lzip:</li><ul><li><strong>lzip</strong> is a marginal archiver with no real benefits since the appearance of <strong>xz</strong> (<em>note: <strong>xz</strong> is a successor of lzma-utils</em>)</li><li><strong>xz</strong> is more popular, more widely accepted</li><li><strong>xz</strong> has a community, while <strong>lzip</strong> has 1 author</li><li>performance of <strong>xz</strong> and <strong>lzip</strong> is comparable</li><li><strong>xz</strong> has more features</li><li>but <strong>lzip</strong> does indeed have a recovery utility that <strong>xz</strong> doesn&#8217;t</li></ul></ul><p>That doesn&#8217;t really tell us much on how <strong>plzip</strong>/<strong>lzip</strong> compare to, say, <strong>pbzip2</strong>. But before performance, let us pay some more attention to long-term storage features of <strong>lzip</strong>:</p><blockquote><p>The <strong>lzip</strong> file format is designed for data sharing and long-term archiving, taking into account both data integrity and decoder availability:</p><ul><li>The <strong>lzip</strong> format provides very safe integrity checking and some data recovery means. The <strong>lziprecover</strong> program can repair bit-flip errors (one of the most common forms of data corruption) in <strong>lzip</strong> files, and provides data recovery capabilities, including error-checked merging of damaged copies of a file.</li><li>The <strong>lzip</strong> format is as simple as possible (but not simpler). The <strong>lzip</strong> manual provides the code of a simple decompressor along with a detailed explanation of how it works, so that with the only help of the <strong>lzip</strong> manual it would be possible for a <em>digital archaeologist</em> to extract the data from a <strong>lzip</strong> file long after quantum computers eventually render LZMA obsolete.</li><li>Additionally, the <strong>lzip</strong> reference implementation is copylefted, which guarantees that it will remain free forever.</li></ul></blockquote><p>(I really liked the part about the <em>digital archaeologist</em>! And the copyleft, to a lesser extent.)</p><p>Looks really attractive! Because what I am using compressors for is, essentially, longer-term archiving, with unpredictable needs to sometimes decompress some of the files. And, of course, storage media will fail fully or partially, so recovering is important, too. But what is this <strong>xz</strong> compressor?.. I&#8217;ve seen it before, in the contexts with words &#8220;overtake the world&#8221; or similar&#8230;</p><p><strong>xz</strong></p><ul><li><strong>much</strong> more complex file format than <strong>lzip</strong>, but  maybe it has some benefits for client programs and/or recovery?</li><li>supports integrity checks and multiple compressed blocks</li><li>according to this <a
href="http://gcc.gnu.org/ml/gcc/2012-03/msg00549.html">post from 2012</a>, <strong>xz</strong> (single-threaded) both compressed and decompressed much faster than <strong>lzip</strong>&#8230; and <strong>lrzip</strong> (depends on settings, of course)</li><li><strong>lzip</strong> is older than <strong>xz</strong>, and was better than <strong>xz</strong> predecessor &#8211; <strong>lzma-utils</strong></li><li><strong>xz</strong> is adopted by some linux distributions and software projects for package compression</li><li><strong>xz</strong> does not seem to have an equivalent of <strong>lziprecover</strong></li><li><strong>tar</strong> supports both <code>--lzip</code> and <code>--xz</code>, also with <code>--auto-compress</code></li></ul><p>This hasn&#8217;t really added any clarity, has it? Moreover, we now have one more unknown &#8211; the <a
href="https://github.com/ckolivas/lrzip" title="long-range zip">lrzip</a> compressor. <strong>lrzip</strong> is a redundancy compressor with LZO, gzip, bzip2, ZPAQ and LZMA back-ends. It is highly efficient for highly redundant data, even if redundancies are separated with long stretches of other data. (FASTQ files are fairly redundant, though <strong>bzip2</strong> seems to utilize that fairly well already; can <strong>lrzip</strong> do better?)</p><p>However, what if a part of the archive is damaged? How much information is lost then? Is it at all possible to recover some of the data from damaged .lrz archives?<br
/> <a
href="http://ck.kolivas.org/apps/lrzip/README.benchmarks">Author&#8217;s benchmarks</a> showcase how good <strong>lrzip</strong> is at redundant data compression (although <strong>lrzip</strong> is multithreaded, so comparison in the benchmark to non-multithreaded algorithm implementations is not quite correct&#8230;). Damaged archive recovery concerns would have prevented me from using <strong>lrzip</strong> anyway, but I was really interested if a &#8220;long-range redundancy&#8221; compressor can do better than usual, &#8220;short-range redundancy&#8221; compressors.</p><p><strong>My testing setup</strong></p><blockquote><ul><li>Debian testing 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt7-1 (2015-03-01) x86_64 GNU/Linux</li><li>Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz (4 physical cores with HT enabled: 8 hardware threads)</li><li>16GiB RAM</li><li>test file name: test.fastq</li><li>test file size: 2 223 860 346 bytes (a little over 2 gigabytes)</li><li>test file was copied once to RAM-mounted /tmp, to exclude any I/O bottleneck effects on compression speeds</li><li>bzip2: 1.0.6</li><li>lbzip2: 2.5</li><li>pbzip2: 1.1.9</li><li>xz: 5.1.0alpha</li><li>plzip: 1.2</li><li>lrzip: 0.616</li><li>command execution time and maximal process RSS memory were measured with <code>/usr/bin/time -f '%C: %e s, %M Kb' compressor arguments</code> (note: this is <strong>not</strong> bash&#8217;s built-in <strong>time</strong>); please note that memory measurement can be incorrect for multithreaded compressors</li></ul></blockquote><p>Below come testing results. I have not put them into a single table, but I do comment the results in a few places. Entire testing followed this pattern:</p><ul><li>compress test.fastq, deleting the original</li><li>test compressed archive (<em>note: this was done only for some compressors, not all</em>)</li><li>decompress archive back to test.fastq, delete archive</li><li>if 3 previous steps are fast enough: repeat 1-2 more times (but only show the best result below); otherwise continue</li><li>repeat with the next compressor</li></ul><p><strong>bzip2: 309 159 275 bytes</strong><br
/> <strong>bzip2</strong> was used as a baseline, to highlight speed benefits of both <strong>lbzip2</strong> and <strong>pbzip2</strong>.</p><blockquote><p> test.fastq:  7.193:1,  1.112 bits/byte, 86.10% saved, 2223860346 in, 309159275 out.<br
/> <strong>bzip2</strong> -v test.fastq: <strong>190.63 s</strong>, 7608 Kb<br
/> <strong>bzip2</strong> -v -d test.fastq.bz2: <strong>51.58 s</strong>, 4620 Kb</p></blockquote><p><strong>Bzip2</strong> is neither particularly slow, nor particularly fast. It also seems to have modest memory requirements.</p><p><strong>pbzip2: 310 462 610 bytes</strong><br
/> <strong>pbzip2</strong> is the currently used reference. For any other compressor to become a successor of <strong>pbzip2</strong>, that other compressor must be either a little faster (while compressing as good as <strong>pbzip2</strong>), or a little better compressor (while being as fast as <strong>pbzip2</strong>), or both. Note that compressed file size is only a tiny bit larger than with <strong>bzip2</strong>.</p><blockquote><p> &#8220;test.fastq.bz2&#8243;: compression ratio is 1:7.163, space savings is 86.04%<br
/> <strong>pbzip2</strong> -v test.fastq: <strong>46.22 s</strong>, 67436 Kb<br
/> <strong>pbzip2</strong> -dv test.fastq.bz2: <strong>19.80 s</strong>, 46672 Kb</p></blockquote><p>Interestingly, <code>pbzip2 --test</code> uses 1 thread only (but also consumes only 6MB RAM), resulting in decompression times similar to those of <strong>bzip2</strong>. <strong>lbzip2</strong> uses all 8 threads also during testing.</p><p><strong>lbzip2: 311 040 543 bytes</strong></p><blockquote><p> lbzip2: compressing &#8220;test.fastq&#8221; to &#8220;test.fastq.bz2&#8243;<br
/> lbzip2: &#8220;test.fastq&#8221;: compression ratio is 1:7.150, space savings is 86.01%<br
/> <strong>lbzip2</strong> -v test.fastq: <strong>22.67 s</strong>, 49812 Kb</p><p>lbzip2: decompressing &#8220;test.fastq.bz2&#8243; to &#8220;test.fastq&#8221;<br
/> lbzip2: &#8220;test.fastq.bz2&#8243;: compression ratio is 1:7.150, space savings is 86.01%<br
/> <strong>lbzip2</strong> -vd test.fastq.bz2: <strong>18.86 s</strong>, 46652 Kb</p></blockquote><p>I repeated <strong>pbzip2</strong> and <strong>lbzip2</strong> tests several times, and it was always that <strong>lbzip2</strong> compressed this same file about twice as fast&#8230; Wow! Decompression speed is about the same, compressed file size is marginally larger than with <strong>pbzip2</strong>. Overall, <strong>lbzip2</strong> does look like a new drop-in replacement of <strong>bzip2</strong>/<strong>pbzip2</strong> for me.</p><p><strong>xz -0 &ndash;&ndash;threads=8: 517 967 372 bytes</strong><br
/> I would call this one <em>major test disappointment</em>. Default setting, -6, was way too slow (estimated 28 minutes to compress!!!). Even the fastest -0 setting was still too slow! And here&#8217;s one of the reasons, straight from the <strong>xz</strong> man page:</p><blockquote><p> Multithreaded compression and decompression are not implemented yet, so this option has no effect for now. As of writing (2010-09-27), it hasn&#8217;t been decided if threads will be used by default on multicore systems once support for threading has been implemented.</p></blockquote><p>Also, I forgot to use the <code>--block-size=900k</code> option, but that seems to be of no concern with such results:</p><blockquote><p> 100 %     492.5 MiB / 2,120.8 MiB = 0.232    18 MiB/s       1:59<br
/> <strong>xz</strong> -0 -v test.fastq: <strong>119.25 s</strong>, 4780 Kb<br
/> <strong>xz</strong> &ndash;&ndash;test &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.xz: <strong>36.00 s</strong>, 2568 Kb<br
/> 100 %     492.5 MiB / 2,120.8 MiB = 0.232    58 MiB/s       0:36<br
/> <strong>xz</strong> -d -v test.fastq.xz: <strong>36.54 s</strong>, 2500 Kb</p></blockquote><p><strong>xz -0</strong> was both slower and had significantly worse compression when compared to <strong>lbzip2</strong> and <strong>pbzip2</strong>. <strong>xz -0</strong> was faster than good old <strong>bzip2</strong>, but had significantly worse compression&#8230; Really, <em>major test disappointment</em>.</p><p><strong>plzip: between 407 696 562 and 498 708 539 bytes</strong><br
/> One more <em>major test disappointment</em>. (Or am I somehow using these compressors in a wrong way?&#8230;) I haven&#8217;t found a way to set block/member size (for <strong>lzip</strong>, that would be the <code>-b</code> option). Default speed setting -6 was also way too slow, but settings -1 to -3 were comparable to <strong>pbzip2</strong>, so I did all three.</p><p><strong>plzip -1: 498 708 539 bytes</strong></p><blockquote><p> test.fastq:  4.459:1,  1.794 bits/byte, 77.57% saved, 2223860346 in, 498708539 out.<br
/> <strong>plzip</strong> -1 &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq: <strong>30.27 s</strong>, 126360 Kb (this seems to be per-thread memory&#8230;)<br
/> <strong>plzip</strong> &ndash;&ndash;test &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.lz: <strong>6.86 s</strong>, 11640 Kb<br
/> <strong>plzip</strong> -d &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.lz: <strong>7.24 s</strong>, 11644 Kb</p></blockquote><p>Compression speed and ratio: both worse than <strong>lbzip2</strong>. But the fastest testing and decompression so far.</p><p><strong>plzip -2: 456 301 558 bytes</strong></p><blockquote><p> test.fastq:  4.874:1,  1.641 bits/byte, 79.48% saved, 2223860346 in, 456301558 out.<br
/> <strong>plzip</strong> -2 &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq: <strong>38.81 s</strong>, 193416 Kb<br
/> <strong>plzip</strong> &ndash;&ndash;test &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.lz: <strong>6.26 s</strong>, 14828 Kb<br
/> <strong>plzip</strong> -d &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.lz: <strong>6.38 s</strong>, 14736 Kb</p></blockquote><p>Compression time worse than <strong>lbzip2</strong>, a little better than <strong>pbzip2</strong>, but compression ratio worse than any one of these. But even faster testing and decompression.</p><p><strong>plzip -3: 407 696 562 bytes</strong></p><blockquote><p> test.fastq:  5.455:1,  1.467 bits/byte, 81.67% saved, 2223860346 in, 407696562 out.<br
/> <strong>plzip</strong> -3 &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq: <strong>63.74 s</strong>, 245756 Kb<br
/> <strong>plzip</strong> &ndash;&ndash;test &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.lz: <strong>5.82 s</strong>, 18936 Kb<br
/> <strong>plzip</strong> -d &ndash;&ndash;verbose &ndash;&ndash;threads=8 test.fastq.lz: <strong>6.10 s</strong>, 18944 Kb</p></blockquote><p>Even faster testing and decompression! But compression ratio and speed are still worse than <strong>lbzip2</strong> and <strong>pbzip2</strong>.</p><p>And the final contestant, <strong>lrzip</strong>! All 5 back-ends were tested: LZO, gzip, bzip2, LZMA, ZPAQ.</p><p><strong>lrzip</strong> has several peculiarities, which hinder its use as a drop-in replacement for, say, <strong>bzip2</strong>. Most importantly, when a file is compressed, it is not deleted, unless a <code>-D</code> options is specified. Unlike <strong>pbzip2</strong> and <strong>lbzip2</strong>, which use all available CPUs/cores by default, <strong>lrzip</strong> only uses 2 by default (<code>-p 8</code> in the results below requests use of 8 cores). Another unusual feature is that during testing a file is uncompressed to a storage medium, and then deleted; almost all the other compressors only verify the decompressed data stream, which is then immediately discarded and never written to storage medium. Related feature is a <code>-c</code> option, which performs file verification after decompression by reading the decompressed file from storage medium and comparing it to the decompressed stream. <strong>lrzip</strong> also stores MD5 hashes of data, and allows verifying these. <strong>lrzip</strong> comes with several helper scripts &#8211; for example, one which allows tarballing and lrzipping a chosen directory in a single command. Actually, <strong>lrzip</strong> is more of an archive utility, and not just a compressor.</p><p><strong>lrzip -D -p 8: 334 504 383 bytes</strong><br
/> In this default (LZMA) mode, <strong>lrzip</strong> starts with 1 thread, but eventually uses more and more cores (though never all 8, or I haven&#8217;t noticed this). Decompressing seems to use more threads, but that also depends on the back-end used (the slower it is &#8211; the more threads will be used, e.g. ZPAQ versus LZO).</p><blockquote><p> test.fastq &#8211; Compression Ratio: 6.648. Average Compression Speed:  3.113MB/s.<br
/> Total time: 00:11:21.85<br
/> <strong>lrzip</strong> -D -p 8 test.fastq: <strong>681.84 s</strong>, 3331080 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 124.706MB/s<br
/> [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:17.13<br
/> <strong>lrzip</strong> -t -p 8 test.fastq.lrz: <strong>17.21 s</strong>, 2567608 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 117.778MB/s<br
/> Output filename is: test.fastq: [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:17.59<br
/> <strong>lrzip</strong> -d -p 8 -D test.fastq.lrz: <strong>17.67 s</strong>, 2567664 Kb</p></blockquote><p>In the default LZMA mode, lrzip is significantly slower than even bzip2, and has somewhat worse compression ratio. Yes, this is the 3rd <em>major test disappointment</em>.</p><p><strong>gzip back-end: lrzip -g -L 9 -D -p 8: 430 013 769 bytes</strong><br
/> Despite specifying <code>-p 8</code>, <strong>lrzip</strong> mostly operates in 1 thread, and only sometimes in 2 (probably invokes <strong>gzip</strong> library). Testing is also done with 1 thread only, but is very fast (but slower than <strong>plzip</strong>). The <code>-L 9</code> option is supposed to be translated into -9 for gzip; as this normally has nearly no effect, it wasn&#8217;t used in the following <strong>lrzip</strong> tests.</p><blockquote><p> test.fastq &#8211; Compression Ratio: 5.172. Average Compression Speed:  0.704MB/s.<br
/> Total time: 00:50:11.34<br
/> <strong>lrzip</strong> -p 8 -g -L 9 -D test.fastq: <strong>3011.34 s</strong>, 2745520 Kb</p><p>100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 163.077MB/s<br
/> [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:12.71<br
/> <strong>lrzip</strong> -t -p 8 test.fastq.lrz: <strong>12.79 s</strong>, 2577632 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 163.077MB/s<br
/> Output filename is: test.fastq: [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:12.88<br
/> <strong>lrzip</strong> -d -p 8 -D test.fastq.lrz: <strong>12.95 s</strong>, 2577728 Kb</p></blockquote><p>And again, compression speed <strong>and</strong> ratio are worse than for <strong>bzip2</strong>&#8230;</p><p><strong>LZO back-end: lrzip -l -D -p 8: 766 520 776 bytes</strong></p><blockquote><p> test.fastq &#8211; Compression Ratio: 2.901. Average Compression Speed:  4.690MB/s.<br
/> Total time: 00:07:32.89<br
/> <strong>lrzip</strong> -l -D -p 8 test.fastq: <strong>452.88 s</strong>, 2714452 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 212.000MB/s<br
/> [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:10.58<br
/> <strong>lrzip</strong> -t -p 8 test.fastq.lrz: <strong>10.66 s</strong>, 2582516 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 192.727MB/s<br
/> Output filename is: test.fastq: [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:11.32<br
/> <strong>lrzip</strong> -d -p 8 -D test.fastq.lrz: <strong>11.39 s</strong>, 2582504 Kb</p></blockquote><p>No comments.</p><p><strong>bzip2 back-end: lrzip -b -D -p 8: 353 473 476 bytes</strong></p><blockquote><p> test.fastq &#8211; Compression Ratio: 6.291. Average Compression Speed:  4.473MB/s.<br
/> Total time: 00:07:53.95<br
/> <strong>lrzip</strong> -b -D -p 8 test.fastq: <strong>473.94 s</strong>, 2781104 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 68.387MB/s<br
/> [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:30.69<br
/> <strong>lrzip</strong> -t -p 8 test.fastq.lrz: <strong>30.77 s</strong>, 2583156 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB<br
/> Average DeCompression Speed: 66.250MB/s<br
/> Output filename is: test.fastq: [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:00:31.92<br
/> <strong>lrzip</strong> -d -p 8 -D test.fastq.lrz: <strong>32.00 s</strong>, 2583108 Kb</p></blockquote><p>Hadn&#8217;t I done all of these simple tests myself, by now I&#8217;d think that this test was <em>rigged</em> to show how good <strong>pbzip2</strong> and <strong>lbzip2</strong> are at compressing FASTQ files <img
src="https://bogdan.org.ua/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley" /></p><p><strong>ZPAQ back-end: lrzip -z -D -p 8: 292 380 439 bytes</strong></p><blockquote><p> test.fastq &#8211; Compression Ratio: 7.606. Average Compression Speed:  2.804MB/s.%  7:100%<br
/> Total time: 00:12:36.51<br
/> <strong>lrzip</strong> -z -D -p 8 test.fastq: <strong>756.51 s</strong>, 3585740 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB	1:100%  2:100%  3:100%  4:100%  5:100%  6:100%  7:100%<br
/> Average DeCompression Speed:  3.970MB/s<br
/> [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:08:54.57<br
/> <strong>lrzip</strong> -t -p 8 test.fastq.lrz: <strong>534.65 s</strong>, 2583424 Kb</p><p>Decompressing&#8230;<br
/> 100%    2120.84 /   2120.84 MB	1:100%  2:100%  3:100%  4:100%  5:100%  6:100%  7:100%<br
/> Average DeCompression Speed:  3.759MB/s<br
/> Output filename is: test.fastq: [OK] &#8211; 2223860346 bytes<br
/> Total time: 00:09:24.27<br
/> <strong>lrzip</strong> -d -p 8 -D test.fastq.lrz: <strong>564.36 s</strong>, 2583460 Kb</p></blockquote><p><strong>Finally!!!</strong> We have compression better than <strong>bzip2</strong>! But it is also much slower than <strong>bzip2</strong> (and some 12 times slower than <strong>pbzip2</strong>), so not really an option. Alas. And decompression time is the worst in the test &#8211; almost <strong>10 minutes</strong> for what <strong>plzip</strong> does in under <strong>7 seconds</strong>! (I do realize that compression ratio is also different &#8211; but not <strong>that</strong> much.) I wonder if slow <strong>lrzip</strong> speeds have anything to do with test.fastq being effectively in RAM? I do not know if there are any performance penalties to <strong>mmap</strong>ing a file which is already on a RAM-mounted partition.</p><p>The test.fastq file that I&#8217;ve used was somehow really hard for the tested compressors to tackle as fast and as good as <strong>lbzip2</strong> and <strong>pbzip2</strong> could&#8230;</p><p>Questions? Comments? Improvements, including plots of these figures? Comment below.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F03%2F28%2Fcompressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html&amp;linkname=Compressors%20galore%3A%20pbzip2%2C%20lbzip2%2C%20plzip%2C%20xz%2C%20and%20lrzip%20tested%20on%20a%20FASTQ%20file" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F03%2F28%2Fcompressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html&amp;linkname=Compressors%20galore%3A%20pbzip2%2C%20lbzip2%2C%20plzip%2C%20xz%2C%20and%20lrzip%20tested%20on%20a%20FASTQ%20file" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F03%2F28%2Fcompressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html&amp;linkname=Compressors%20galore%3A%20pbzip2%2C%20lbzip2%2C%20plzip%2C%20xz%2C%20and%20lrzip%20tested%20on%20a%20FASTQ%20file" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F03%2F28%2Fcompressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html&amp;linkname=Compressors%20galore%3A%20pbzip2%2C%20lbzip2%2C%20plzip%2C%20xz%2C%20and%20lrzip%20tested%20on%20a%20FASTQ%20file" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F03%2F28%2Fcompressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html&amp;linkname=Compressors%20galore%3A%20pbzip2%2C%20lbzip2%2C%20plzip%2C%20xz%2C%20and%20lrzip%20tested%20on%20a%20FASTQ%20file" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2015%2F03%2F28%2Fcompressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html&#038;title=Compressors%20galore%3A%20pbzip2%2C%20lbzip2%2C%20plzip%2C%20xz%2C%20and%20lrzip%20tested%20on%20a%20FASTQ%20file" data-a2a-url="https://bogdan.org.ua/2015/03/28/compressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html" data-a2a-title="Compressors galore: pbzip2, lbzip2, plzip, xz, and lrzip tested on a FASTQ file"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2015/03/28/compressors-galore-pbzip2-lbzip2-plzip-xz-and-lrzip-tested-on-a-fastq-file.html/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>My smartd.conf, explained</title><link>https://bogdan.org.ua/2015/02/28/my-smartd-conf-explained.html</link> <comments>https://bogdan.org.ua/2015/02/28/my-smartd-conf-explained.html#comments</comments> <pubDate>Fri, 27 Feb 2015 23:01:11 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[SMART]]></category> <category><![CDATA[smartd]]></category> <category><![CDATA[smartd.conf]]></category> <category><![CDATA[smartmontools]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2216</guid> <description><![CDATA[After fixing offline uncorrectable sector warning email, I have taken a closer look at my /etc/smartd.conf, and now it looks like this: DEFAULT -d sat -H -f -p -t -W 0,40,45 -n standby -S on -m example@example.com # Attributes 1, 230, and 231 are very important (-r 1! -r 230! -R 230! -r 231! -R [&#8230;]]]></description> <content:encoded><![CDATA[<p>After <a
href="http://bogdan.org.ua/2015/02/26/how-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html">fixing offline uncorrectable sector warning email</a>, I have taken a closer look at my /etc/<strong>smartd.conf</strong>, and now it looks like this:</p><blockquote><p> DEFAULT -d sat -H -f -p -t -W 0,40,45 -n standby       -S on -m example@example.com<br
/> # Attributes 1, 230, and 231 are very important (-r 1! -r 230! -R 230! -r 231! -R 231!), but likely covered by -t.<br
/> /dev/sda -s (S/../../6/01|L/../(01|02|03|04|05|06|07)/7/00) -C 0 -I 189 -I 194<br
/> # -a implies -f and -p (through -t)<br
/> DEFAULT -d sat -a -I 194   -W 0,40,45 -n standby -o on -S on -m example@example.com<br
/> /dev/sdb -s (S/../../6/02|L/../(01|02|03|04|05|06|07)/7/02)<br
/> # This drive does not decrement Offline_Uncorrectable (198) after re-allocation,<br
/> # so only monitoring for increase, not for non-zero value.<br
/> /dev/sdc -s (S/../../6/03|L/../(01|02|03|04|05|06|07)/7/04) -U 198+<br
/> # This drive has 40 &#8220;normally&#8221;.<br
/> /dev/sdd -s (S/../../6/04|L/../(01|02|03|04|05|06|07)/7/06) -W 0,42,45</p></blockquote><p><em>Note: explanations below are intentionally simplified; please consult <strong>man smartd.conf</strong> for more precise, complete, and up-to-date information.</em></p><p>Ok, so what do these settings mean, and how is this different from default settings?<br
/> <span
id="more-2216"></span></p><p>By default, <strong>smartd</strong> assumes a <code>DEVICESCAN</code> directive, which auto-detects all HDDs, and enables reasonable default monitoring of SMART attributes.<br
/> However, there are several benefits to individually specifying your disks:</p><ul><li>less verbose smartd startup log messages (no messages about auto-detection and missing attributes)</li><li>ability to run scheduled offline, short, and long SMART self-tests</li><li>ability to monitor or exclude attributes individually for each drive (including temperature)</li></ul><p><em>Reasonable default</em> mentioned above is the <strong>-a</strong> option, equivalent to the following individual options:</p><blockquote><p>-H -f -t -l error -l selftest -C 197 -U 198</p></blockquote><p>This is important to know, because my only SSD has no attribute 197, no self-test log, no error log, and no automatic offline testing.<br
/> But I still want to start with quasi-default settings, and that is why the first configuration line includes all the options from <strong>-a</strong>, except those that my SSD does not support:</p><blockquote><p>DEFAULT -d sat -H -f -p -t -W 0,40,45 -n standby       -S on -m example@example.com</p></blockquote><p>Here and in the <strong>-a</strong> options above,</p><ul><li><strong>-H</strong>: monitor overall health status (passed/failed)</li><li><strong>-d sat</strong>: HDD type is SATA</li><li><strong>-f</strong>: check if any of the Usage attributes (those not marked as Pre-fail) are below the manufacturer-set thresholds</li><li><strong>-p</strong>: report changes in Pre-fail attributes (implied by <strong>-t</strong> below, so can be omitted)</li><li><strong>-t</strong>: same as <strong>-p</strong> (above) with <strong>-u</strong> (report changes in Usage attributes)</li><li><strong>-W 0,40,45</strong>: log a message if drive&#8217;s temperature goes above 40 degrees Celsius; log a critical messages if above 45</li><li><strong>-n standby</strong>: do not wake-up (spin-up) the HDD if it is in sleep or standby mode (in which platters do not spin)</li><li><strong>-S on</strong>: enable attributes auto-saving</li><li><strong>-m example@example.com</strong>: address (or several comma-separated addresses) to receive warnings from smartd</li></ul><p>The <code>DEFAULT</code> directive is for convenience: options set by this directive apply to all the individual disk configuration lines below, until a different <code>DEFAULT</code> line is encountered.<br
/> Here, I had used it to separate all /dev/sda options into 2 logical groups: supported defaults, and drive-specific configuration.<br
/> SSD&#8217;s configuration is</p><blockquote><p>/dev/sda -s (S/../../6/01|L/../(01|02|03|04|05|06|07)/7/00) -C 0 -I 189 -I 194</p></blockquote><p>Here,</p><ul><li><strong>-C 0</strong>: explicitly disable attribute 197 monitoring (which is not present in this SSD)</li><li><strong>-I 189</strong> and <strong>-I 194</strong>: ignore attributes 189 and 194 (they both show temperature in this SSD)</li><li><strong>-s (S/../../6/01|L/../(01|02|03|04|05|06|07)/7/00)</strong>: schedule for short and long tests</li></ul><p>As for the tests&#8230;<br
/> I want short self-tests every Saturday night, between 1 AM and 5 AM (shifted by 1H for every disk).<br
/> I want long self-tests on the 1st Sunday of every month, between midnight and 8 AM (shifted by 2H for every disk).<br
/> This is exactly what is encoded in my configuration for all drives. The easiest way to figure out the format is to read the relevant section of <strong>man smartd.conf</strong>.</p><p>The remaining 3 drives are all HDDs, so I had defined a different common <code>DEFAULT</code> for them.<br
/> The only new option that we see is <strong>-U 198+</strong>, which instructs smartd to only report increases of the Offline_Uncorrectable (198) attribute.<br
/> This is necessary because my /dev/sdc <a
href="http://bogdan.org.ua/2015/02/26/how-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html">does not decrement this attribute after sector re-allocation</a>.</p><p>I hope you found this post helpful.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F28%2Fmy-smartd-conf-explained.html&amp;linkname=My%20smartd.conf%2C%20explained" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F28%2Fmy-smartd-conf-explained.html&amp;linkname=My%20smartd.conf%2C%20explained" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F28%2Fmy-smartd-conf-explained.html&amp;linkname=My%20smartd.conf%2C%20explained" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F28%2Fmy-smartd-conf-explained.html&amp;linkname=My%20smartd.conf%2C%20explained" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F28%2Fmy-smartd-conf-explained.html&amp;linkname=My%20smartd.conf%2C%20explained" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F28%2Fmy-smartd-conf-explained.html&#038;title=My%20smartd.conf%2C%20explained" data-a2a-url="https://bogdan.org.ua/2015/02/28/my-smartd-conf-explained.html" data-a2a-title="My smartd.conf, explained"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2015/02/28/my-smartd-conf-explained.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to fix Offline Uncorrectable sector outside of a partition</title><link>https://bogdan.org.ua/2015/02/26/how-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html</link> <comments>https://bogdan.org.ua/2015/02/26/how-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html#comments</comments> <pubDate>Wed, 25 Feb 2015 22:20:09 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2210</guid> <description><![CDATA[A few days ago my smartd daemon (from the smartmontools package) notified me about a +1 increase in Current_Pending_Sector (197) and Offline_Uncorrectable (198) SMART attributes. The 2.5&#8243; Fujitsu laptop hard-drive these appeared on is very old, and it also has been working 24/365 since a little over a year. Running a short SMART self-test (sudo [&#8230;]]]></description> <content:encoded><![CDATA[<p>A few days ago my smartd daemon (from the smartmontools package) notified me about a +1 increase in Current_Pending_Sector (197) and Offline_Uncorrectable (198) SMART attributes. The 2.5&#8243; Fujitsu laptop hard-drive these appeared on is very old, and it also has been working 24/365 since a little over a year.</p><p>Running a short SMART self-test (<code>sudo smartctl -t short /dev/sdc</code>) produced a read error at sector 1289:</p><blockquote><p> Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error<br
/> 1 Short offline Completed: read failure 80% 22339 <strong>1289</strong></p></blockquote><p>Looking at the partition table of /dev/sdc, we see that this sector is outside of the only RAID partition on the disk, which starts at sector 2048:</p><blockquote><p> Device Boot Start End Blocks Id System<br
/> /dev/sdc1 <strong>2048</strong> 117209087 58605088 fd Lnx RAID auto</p></blockquote><p><span
id="more-2210"></span></p><p>To make sure that sector 1289 is re-allocated, some data needs to be written to it, e.g. with <code>sudo dd if=/dev/zero of=/dev/sdc count=1 seek=1289</code>.<br
/> You may also try to read the sector first, then &#8211; if successful &#8211; write it back to the disk:<br
/> <code>i=1289 ; sudo dd if=/dev/sdc of=/tmp/sector count=1 skip=$i &#038;&#038; sleep 1 &#038;&#038; sudo dd if=/tmp/sector of=/dev/sdc count=1 seek=$i</code></p><p>Another solution (<strong>untested!</strong>) would be to read/write a bunch of sectors around the problematic one (this is similar to what <code>badblocks -n</code> does):<br
/> <code><br
/> export i=1280<br
/> while [ $i -lt 1300 ]<br
/> do echo $i<br
/> # read once (count=1) 512 bytes (default ibs/obs values of dd) to a temporary file, skipping first $i ibs-sized blocks (skip=$i);<br
/> # if successful, then (wait a bit and) write the same data back to disk, skipping $i obs-sized blocks (seek=$i)<br
/> dd if=/dev/sdc of=/tmp/sector count=1 skip=$i &#038;&#038; sleep 1 &#038;&#038; dd if=/tmp/sector of=/dev/sdc count=1 seek=$i<br
/> let i+=1<br
/> done<br
/> </code></p><p>After sector re-allocation both Reallocated_Sector_Ct (5) and Reallocated_Event_Count (196) SMART attributes increased from 0 to 1, while Current_Pending_Sector (197) decreased from 1 to 0. In addition, running <code>badblocks /dev/sdc</code> and <code>diskscan --output diskscan-sdc-out-25-02-2015.json /dev/sdc</code> (both in read-only mode, of course) has not shown any read errors, and another short SMART self-test also finished successfully. So, is the problem solved?</p><p>Unfortunately, Offline_Uncorrectable (198) stayed at 1, and I kept getting warning emails. Apparently, my HDD simply does not decrease the Offline_Uncorrectable (198) attribute after sector re-allocation.</p><p>In this case the proper solution is to edit <code>/etc/smartd.conf</code> so that it only sends emails if Offline_Uncorrectable (198) attribute increases, and not if it is non-zero. Just add this option to your HDD scan line in <code>smartd.conf</code>: <strong><code>-U 198+</code></strong>.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F26%2Fhow-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html&amp;linkname=How%20to%20fix%20Offline%20Uncorrectable%20sector%20outside%20of%20a%20partition" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F26%2Fhow-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html&amp;linkname=How%20to%20fix%20Offline%20Uncorrectable%20sector%20outside%20of%20a%20partition" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F26%2Fhow-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html&amp;linkname=How%20to%20fix%20Offline%20Uncorrectable%20sector%20outside%20of%20a%20partition" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F26%2Fhow-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html&amp;linkname=How%20to%20fix%20Offline%20Uncorrectable%20sector%20outside%20of%20a%20partition" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F26%2Fhow-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html&amp;linkname=How%20to%20fix%20Offline%20Uncorrectable%20sector%20outside%20of%20a%20partition" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2015%2F02%2F26%2Fhow-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html&#038;title=How%20to%20fix%20Offline%20Uncorrectable%20sector%20outside%20of%20a%20partition" data-a2a-url="https://bogdan.org.ua/2015/02/26/how-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html" data-a2a-title="How to fix Offline Uncorrectable sector outside of a partition"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2015/02/26/how-to-fix-offline-uncorrectable-sector-outside-of-a-partition.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to update a multisite Drupal 6/7 installation using Drush</title><link>https://bogdan.org.ua/2014/08/25/how-to-update-a-multisite-drupal-6-7-installation-using-drush.html</link> <comments>https://bogdan.org.ua/2014/08/25/how-to-update-a-multisite-drupal-6-7-installation-using-drush.html#comments</comments> <pubDate>Mon, 25 Aug 2014 15:35:27 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Drupal]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[D6]]></category> <category><![CDATA[D7]]></category> <category><![CDATA[drupal]]></category> <category><![CDATA[drush]]></category> <category><![CDATA[update]]></category> <category><![CDATA[upgrade]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2167</guid> <description><![CDATA[There are quite a lot of posts on how to do this, but my differs a tiny little bit, so I&#8217;m saving it for my own future reference, and also for the benefits of the wider audience. I am updating a multisite Drupal 6 installation. To the best of my knowledge, the only difference for [&#8230;]]]></description> <content:encoded><![CDATA[<p>There are quite a lot of posts on how to do this, but my differs a tiny little bit, so I&#8217;m saving it for my own future reference, and also for the benefits of the wider audience.</p><p>I am updating a multisite Drupal 6 installation. To the best of my knowledge, the only difference for Drupal 7 is that instead of the <strong>site_offline</strong> D6 variable the <strong>maintenance_mode</strong> variable is used in D7.</p><p>On Debian stable and later, you can <code>sudo aptitude install drush</code> and then just use it immediately after that.</p><p>Note: I recommend <code>su webuser</code> (or <code>sudo -s</code> followed by <code>sudo -s -u webuser</code>) before you run any non-testing <a
href="http://drush.ws/">drush</a> commands, where <em>webuser</em> is the user which owns your web-exposed files (e.g. Debian&#8217;s default is, I think, <strong>www-data</strong>). I&#8217;ve seen a lot of recommendations to run drush as a super-user, but that does not make sense, and may actually cause problems with file ownership.</p><p>One last thing before we start: if your <a
href="http://bogdan.org.ua/2014/08/25/drush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html">drush seems to work fine but hangs when untarring modules &#8211; check this solution</a>.</p><p><span
id="more-2167"></span></p><ol><li>Run some innocent command in drush to see if it produces any PHP warnings/errors you may want to fix before running actual update: <code>drush @sites core-status</code>. In my case, all the sites had the <a
href="https://www.drupal.org/project/cacherouter" class="broken_link" rel="nofollow">CacheRouter</a> module for in-RAM caching with a server daemon back-end, which was not initialized properly when drush bootstrapped Drupal from the command line. In my case, the only working solution was to edit <code>settings.php</code> files of every site to comment out the CacheRouter configuration for the period of update. If you get no warnings/errors, proceed to the next step. <em>Note: I was running drush from the Drupal&#8217;s root (directory which has top-level <code>index.php</code> and <code>.htaccess</code> files), but this should also work if you run from <code>sites/</code> or even <code>sites/sitename</code>.</em></li><li>Here would be several more steps &#8211; copying your production website(s) to a dev-server (if you do not have one already), performing an update on the dev-server first to see if anything breaks and needs fixes, then migrating updated website(s) from the dev-server to production server. Drush actually has tools to simplify all of these procedures. However, the websites I was updating were not critical, and short downtime was not a problem, so I was updating <strong>live</strong> websites. Modify these steps as you see fit to make the process more reliable.</li><li>Backup databases of all your sites. With drush: <code>drush @sites sql-dump --result-file --gzip</code>. This puts backups somewhere into the home directory of your <em>webuser</em>. Backups are named with a human-readable timestamp. Of course, you can also create a manual <a
href="https://www.drupal.org/project/backup_migrate" class="broken_link" rel="nofollow">Backup and Migrate</a> backup, or use phpMyAdmin, or just <code>mysqldump</code>.</li><li>Backup your site&#8217;s files. This step might be unnecessary, as drush seems to backup modules it is upgrading. I would still recommend making a backup, e.g. with <code>tar -acf multidrupal.tar.bz2 html</code>, where <em>html</em> is the directory containing your multisite Drupal&#8217;s root <code>index.php</code>.</li><li>Put the websites into maintenance mode and clear all caches; see the D7-specific note above: <code>drush @sites variable-set site_offline 1 ; drush @sites cache-clear all</code>.</li><li>The actual update! The easiest way would probably be to <code>drush @sites pm-update</code>, but I haven&#8217;t tested that and used a process which I understand better, and which seems more reliable to me (if anything goes wrong). If in your drupal root you have <strong>sites/site1</strong> and <strong>sites/site2</strong>, then run:<br
/> <code><br
/> drush site1 pm-updatecode<br
/> drush @sites updatedb<br
/> drush site2 pm-updatecode<br
/> drush @sites updatedb<br
/> </code><br
/> The <code>pm-updatecode</code> command only updates files, and does not run database update. So with these commands I am first updating modules from site1, then running database update on all sites, then update modules of site2, and run database update on all sites again. Running <code>drush @sites updatedb</code> multiple times, even when there are no updates, should be safe. Take note of any warnings/errors reported, you will want to fix them later, for example:</p><blockquote><p>WARNING:  Updating core will discard any modifications made to Drupal core files, most noteworthy among these are .htaccess and robots.txt.  If you have made any modifications to these files, please back them up before updating so that you can re-create your modifications in the updated version of the file.</p></blockquote></li><li>Disable maintenance mode. Cleaning the cache seems unnecessary, as <code>updatedb</code> command does that. <code>drush @sites variable-set site_offline 0</code>.</li><li>Finalize: re-enable anything disabled before the updates, fix warnings/errors you noted during the update.</li></ol><p>This worked well for me, and I hope it works well for you.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fhow-to-update-a-multisite-drupal-6-7-installation-using-drush.html&amp;linkname=How%20to%20update%20a%20multisite%20Drupal%206%2F7%20installation%20using%20Drush" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fhow-to-update-a-multisite-drupal-6-7-installation-using-drush.html&amp;linkname=How%20to%20update%20a%20multisite%20Drupal%206%2F7%20installation%20using%20Drush" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fhow-to-update-a-multisite-drupal-6-7-installation-using-drush.html&amp;linkname=How%20to%20update%20a%20multisite%20Drupal%206%2F7%20installation%20using%20Drush" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fhow-to-update-a-multisite-drupal-6-7-installation-using-drush.html&amp;linkname=How%20to%20update%20a%20multisite%20Drupal%206%2F7%20installation%20using%20Drush" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fhow-to-update-a-multisite-drupal-6-7-installation-using-drush.html&amp;linkname=How%20to%20update%20a%20multisite%20Drupal%206%2F7%20installation%20using%20Drush" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fhow-to-update-a-multisite-drupal-6-7-installation-using-drush.html&#038;title=How%20to%20update%20a%20multisite%20Drupal%206%2F7%20installation%20using%20Drush" data-a2a-url="https://bogdan.org.ua/2014/08/25/how-to-update-a-multisite-drupal-6-7-installation-using-drush.html" data-a2a-title="How to update a multisite Drupal 6/7 installation using Drush"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2014/08/25/how-to-update-a-multisite-drupal-6-7-installation-using-drush.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>drush pm-update fails: tar hangs when extracting *.tar.gz module archives from drupal.org</title><link>https://bogdan.org.ua/2014/08/25/drush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html</link> <comments>https://bogdan.org.ua/2014/08/25/drush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html#comments</comments> <pubDate>Mon, 25 Aug 2014 14:53:10 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Drupal]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[archive]]></category> <category><![CDATA[drupal]]></category> <category><![CDATA[extract]]></category> <category><![CDATA[hangs]]></category> <category><![CDATA[module]]></category> <category><![CDATA[strace]]></category> <category><![CDATA[tar]]></category> <category><![CDATA[trace]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2164</guid> <description><![CDATA[Drush is awesome, especially for updating multisite Drupal installations. I had only started using it a few days ago, and I&#8217;ve immediately hit a problem, to which I did find a workaround. Symptoms running drush @sites pm-update results in normal execution up to after answering &#8216;y[es]&#8216;; then drush seems to hang indefinitely (haven&#8217;t waited beyond [&#8230;]]]></description> <content:encoded><![CDATA[<p><a
href="http://drush.ws/">Drush</a> is awesome, especially for <a
href="http://bogdan.org.ua/2014/08/25/how-to-update-a-multisite-drupal-6-7-installation-using-drush.html">updating multisite Drupal installations</a>.<br
/> I had only started using it a few days ago, and I&#8217;ve immediately hit a problem, to which I did find a workaround.</p><p><strong>Symptoms</strong></p><ul><li>running <code>drush @sites pm-update</code> results in normal execution up to after answering &#8216;y[es]&#8216;; then drush seems to hang indefinitely (haven&#8217;t waited beyond about 10 minutes, maybe it does produce an error after a long while);</li><li>running the same command with <code>--debug</code> shows that drush hangs when trying to untar the downloaded module.tar.gz archive; there are no errors/warnings, it just hangs with no CPU usage;</li><li>trying to untar any of the modules downloaded from drupal.org manually is also unsuccessful: <code>tar -xzvf module.tar.gz</code> seems to do nothing, it also hangs with zero CPU usage/time and no warnings/errors;</li><li>interestingly, if I create some <code>test.tar.gz</code> locally, <code>tar</code> does happily extract that;</li><li>finally, running <code>strace tar -xzvf module.tar.gz</code> shows a number of unexpected lines, such as references to NSS and libnss files (I am only showing some of the lines of strace output, including the last line):<br
/><blockquote><p>open(&#8220;/etc/nsswitch.conf&#8221;, O_RDONLY)    = 4<br
/> read(4, &#8220;# /etc/nsswitch.conf\n#\n# Example&#8221;&#8230;, 4096) = 683<br
/> open(&#8220;/lib/x86_64-linux-gnu/libnss_nis.so.2&#8243;, O_RDONLY) = 4<br
/> open(&#8220;/lib/x86_64-linux-gnu/libnss_files.so.2&#8243;, O_RDONLY) = 4<br
/> open(&#8220;/etc/passwd&#8221;, O_RDONLY|O_CLOEXEC) = 4<br
/> open(&#8220;/usr/lib/x86_64-linux-gnu/libnss_mysql.so.2&#8243;, O_RDONLY) = 4<br
/> open(&#8220;/etc/group&#8221;, O_RDONLY|O_CLOEXEC)  = 4<br
/> open(&#8220;/etc/libnss-mysql.cfg&#8221;, O_RDONLY) = -1 EACCES (Permission denied)<br
/> open(&#8220;/etc/libnss-mysql-root.cfg&#8221;, O_RDONLY) = -1 EACCES (Permission denied)<br
/> futex(0x7fd0816e8c48, FUTEX_WAIT_PRIVATE, 2, NULL</p></blockquote></li></ul><p><span
id="more-2164"></span></p><p><strong>Analysis</strong><br
/> <code>strace</code> output provided enough information to understand the issue and generate a workaround. Briefly, we see tar querying users and groups information. On the system where this problem was identified, MySQL is used as a name-service back-end. This is why we see references to mysql libraries in the trace. Apparently, <code>tar</code> is trying to resolve some user/groups information, but for some reason does not get what it is asking in a timely manner, or possibly never gets it and will only fail/proceed when the request times out.</p><p><strong>Workaround</strong><br
/> <em>Not a solution</em>, but works: <code>tar -xzv --numeric-owner -f module.tar.gz</code>. The <code>--numeric-owner</code> switch asks <code>tar</code> to use numeric file/directory owner information as-is, without trying to resolve the name of the owner. This works. I have not checked <code>strace</code> for the workaround, but I expect to see no MySQL/NSS references in it with the switch.</p><p>To actually be able to use drush with this workaround, I had to edit <code>drush.inc</code> somewhere under <code>/usr/share/drush/</code>; look for &#8216;tar &#8216; string, and add <code>--numeric-owner</code> where necessary. Do not forget that <code>-f</code> has to be just in front of the archive filename, otherwise your edits will not work.</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fdrush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html&amp;linkname=drush%20pm-update%20fails%3A%20tar%20hangs%20when%20extracting%20%2A.tar.gz%20module%20archives%20from%20drupal.org" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fdrush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html&amp;linkname=drush%20pm-update%20fails%3A%20tar%20hangs%20when%20extracting%20%2A.tar.gz%20module%20archives%20from%20drupal.org" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fdrush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html&amp;linkname=drush%20pm-update%20fails%3A%20tar%20hangs%20when%20extracting%20%2A.tar.gz%20module%20archives%20from%20drupal.org" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fdrush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html&amp;linkname=drush%20pm-update%20fails%3A%20tar%20hangs%20when%20extracting%20%2A.tar.gz%20module%20archives%20from%20drupal.org" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fdrush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html&amp;linkname=drush%20pm-update%20fails%3A%20tar%20hangs%20when%20extracting%20%2A.tar.gz%20module%20archives%20from%20drupal.org" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2014%2F08%2F25%2Fdrush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html&#038;title=drush%20pm-update%20fails%3A%20tar%20hangs%20when%20extracting%20%2A.tar.gz%20module%20archives%20from%20drupal.org" data-a2a-url="https://bogdan.org.ua/2014/08/25/drush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html" data-a2a-title="drush pm-update fails: tar hangs when extracting *.tar.gz module archives from drupal.org"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2014/08/25/drush-pm-update-fails-tar-hangs-when-extracting-tar-gz-module-archives-from-drupal-org.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Debian command of the day: popcon-largest-unused</title><link>https://bogdan.org.ua/2014/01/02/debian-command-of-the-day-popcon-largest-unused.html</link> <comments>https://bogdan.org.ua/2014/01/02/debian-command-of-the-day-popcon-largest-unused.html#comments</comments> <pubDate>Thu, 02 Jan 2014 11:22:25 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[dpigs]]></category> <category><![CDATA[popcon-largest-unused]]></category> <category><![CDATA[wajig]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2073</guid> <description><![CDATA[From the Debian squeeze to wheezy upgrade guide: Remove packages that take up too much space and are not currently needed (you can always reinstall them after the upgrade). If you have popularity-contest installed, you can use sudo popcon-largest-unused to list the packages you do not use that occupy the most space. You can find [&#8230;]]]></description> <content:encoded><![CDATA[<p>From the Debian <a
href="http://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.en.html">squeeze to wheezy upgrade guide</a>:</p><blockquote><p> Remove packages that take up too much space and are not currently needed (you can always reinstall them after the upgrade). If you have <em>popularity-contest</em> installed, you can use <strong>sudo popcon-largest-unused</strong> to list the packages you do not use that occupy the most space. You can find the packages that just take up the most disk space with <strong>dpigs</strong> (available in the <em>debian-goodies</em> package) or with <strong>wajig</strong> (running <strong>wajig size</strong>). They can also be found with <strong>aptitude</strong>. Start <strong>aptitude</strong> in â€œvisual modeâ€, select <strong>Views â†’ New Flat Package List</strong>, press <strong>l</strong> and enter <strong>~i</strong>, then press <strong>S</strong> and enter <strong>~installsize</strong>. This will give you a handy list to work with.</p></blockquote><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F01%2F02%2Fdebian-command-of-the-day-popcon-largest-unused.html&amp;linkname=Debian%20command%20of%20the%20day%3A%20popcon-largest-unused" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F01%2F02%2Fdebian-command-of-the-day-popcon-largest-unused.html&amp;linkname=Debian%20command%20of%20the%20day%3A%20popcon-largest-unused" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F01%2F02%2Fdebian-command-of-the-day-popcon-largest-unused.html&amp;linkname=Debian%20command%20of%20the%20day%3A%20popcon-largest-unused" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F01%2F02%2Fdebian-command-of-the-day-popcon-largest-unused.html&amp;linkname=Debian%20command%20of%20the%20day%3A%20popcon-largest-unused" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2014%2F01%2F02%2Fdebian-command-of-the-day-popcon-largest-unused.html&amp;linkname=Debian%20command%20of%20the%20day%3A%20popcon-largest-unused" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2014%2F01%2F02%2Fdebian-command-of-the-day-popcon-largest-unused.html&#038;title=Debian%20command%20of%20the%20day%3A%20popcon-largest-unused" data-a2a-url="https://bogdan.org.ua/2014/01/02/debian-command-of-the-day-popcon-largest-unused.html" data-a2a-title="Debian command of the day: popcon-largest-unused"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2014/01/02/debian-command-of-the-day-popcon-largest-unused.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Alternatives to GNU make</title><link>https://bogdan.org.ua/2013/10/19/alternatives-to-gnu-make.html</link> <comments>https://bogdan.org.ua/2013/10/19/alternatives-to-gnu-make.html#comments</comments> <pubDate>Sat, 19 Oct 2013 00:49:38 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[alternative]]></category> <category><![CDATA[anduril]]></category> <category><![CDATA[doit]]></category> <category><![CDATA[make]]></category> <category><![CDATA[paver]]></category> <category><![CDATA[rake]]></category> <category><![CDATA[ruffus]]></category> <category><![CDATA[SCons]]></category> <category><![CDATA[snakemake]]></category> <category><![CDATA[waf]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2019</guid> <description><![CDATA[Right now, when I see that I have to often repeat/retype some sets and sequences of commands, I&#8217;m trying to wrap them up into some kind of a script, every time choosing the most appropriate language &#8211; shell when I need to start lots of existing command-line tools, Python when there&#8217;s some data handling and [&#8230;]]]></description> <content:encoded><![CDATA[<p>Right now, when I see that I have to often repeat/retype some sets and sequences of commands, I&#8217;m trying to wrap them up into some kind of a script, every time choosing the most appropriate language &#8211; shell when I need to start lots of existing command-line tools, Python when there&#8217;s some data handling and processing involved, and R when I&#8217;m invoking commands from R packages. So far I have been avoiding the fairly popular makefile-based approach to automating pipelines and workflows which rely heavily on existing tools. However, being curious, I&#8217;ve compiled a short list of modern make-like alternatives, to possibly explore&#8230; sometime later&#8230;</p><ul><li>First comes <a
href="http://software-carpentry.org/v4/make/index.html" class="broken_link" rel="nofollow">make</a> itself &#8211; the oldest and the most widely used software build tool. Stable and powerful. Still, even people who got used to using <strong>make</strong>, have some gripes about it. The most detailed list of gripes is probably <a
href="http://www.conifersystems.com/whitepapers/gnu-make/">here</a>.</li><li><a
href="http://www.scons.org/">SCons</a> is a build tool written in Python. I guess I like that &#8220;configuration files are Python scripts&#8221; &#8211; maybe knowing Python is enough to use SCons, which makes SCons a better choice than <strong>make</strong> for me. SCons seems to have gained <a
href="http://software-carpentry.org/blog/2010/07/popular-fast-or-usable-pick-one.html">some support</a> (scroll down for comments/discussion). There were some doubts about SCons performance (<a
href="http://www.electric-cloud.com/blog/2010/03/08/how-scalable-is-scons/">1</a>, <a
href="http://www.electric-cloud.com/blog/2010/07/21/a-second-look-at-scons-performance/">2</a>, and <a
href="http://www.electric-cloud.com/blog/2010/08/11/the-last-word-on-scons-performance/">3</a>); not sure where SCons is at right now in that regard.</li><li><a
href="http://code.google.com/p/waf/" class="broken_link" rel="nofollow">waf</a>, a Python-based framework for configuring, compiling and installing applications.</li><li>py<a
href="http://pydoit.org/">DoIt</a> is a Python automation tool. It seems to use Python syntax. It aims at bringing the power of build-tools to execute <em>any</em> kind of task, where a task describes some computation to be done (actions), and contains some extra meta-data. Based on the description alone, I&#8217;m quite intrigued! I wonder if anyone had already worked with pyDoIt and can share experiences?&#8230;</li><li>Rake &#8211; Ruby make &#8211; is a simple build program with capabilities similar to those of make. Had seen a lot of positive feedback about this one &#8211; mostly regarding simplicity of use. Still [py]DoIt so far looks more attractive to me personally.</li><li><a
href="http://code.google.com/p/ruffus/">Ruffus</a> is a lightweight python module for running computational pipelines. Sounds like some good competition to [py]DoIt!</li><li><a
href="http://www.anduril.org/anduril/site/">Anduril</a> is an open source component-based workflow framework for scientific data analysis. Sounds promising, though the latest downloadable version is over 400 MBs&#8230; It probably already contains a bunch of binaries and maybe even data and complete workflows for data analysis. Probably worth a look, but may turn out a little overweight for simple pipelining.</li><li><a
href="https://bitbucket.org/johanneskoester/snakemake/wiki/Home">snakemake</a> is a scalable bioinformatics workflow engine. I get the feeling that Python is truly dominating the pipelines/workflows world: snakemake, as even the name suggests, is in Python, too. The front-page example is so simple and clear, that snakemake immediately pushes DoIt down from the 1st place! Awesome.</li><li><a
href="http://paver.github.io/paver/">Paver</a> is a yet-another Python-based software project scripting tool along the lines of Make or Rake, designed to help out with repetitive tasks with the convenience of Pythonâ€™s syntax. Sounds similar to DoIt. Have no idea how they actually compare to each other.</li></ul><p>That is it for now.</p><p>What were your experiences with automating repetitive tasks and building simple pipelines?</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F19%2Falternatives-to-gnu-make.html&amp;linkname=Alternatives%20to%20GNU%20make" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F19%2Falternatives-to-gnu-make.html&amp;linkname=Alternatives%20to%20GNU%20make" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F19%2Falternatives-to-gnu-make.html&amp;linkname=Alternatives%20to%20GNU%20make" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F19%2Falternatives-to-gnu-make.html&amp;linkname=Alternatives%20to%20GNU%20make" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F19%2Falternatives-to-gnu-make.html&amp;linkname=Alternatives%20to%20GNU%20make" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F19%2Falternatives-to-gnu-make.html&#038;title=Alternatives%20to%20GNU%20make" data-a2a-url="https://bogdan.org.ua/2013/10/19/alternatives-to-gnu-make.html" data-a2a-title="Alternatives to GNU make"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2013/10/19/alternatives-to-gnu-make.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Saving and restoring the list of packages installed on a Debian system using aptitude or deborphan</title><link>https://bogdan.org.ua/2013/10/18/saving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html</link> <comments>https://bogdan.org.ua/2013/10/18/saving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html#comments</comments> <pubDate>Fri, 18 Oct 2013 00:08:13 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[aptitude]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[deborphan]]></category> <category><![CDATA[dpkg]]></category> <category><![CDATA[package]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=2011</guid> <description><![CDATA[The usual, or even classical way is to create the list of installed packages with sudo dpkg --get-selections > package_list, and then restore when/if necessary with cat package_list &#124; xargs sudo apt-get -y install. As VihangD points out in his serverfault answer, the same can be achieved with aptitude, while also excluding dependent, automatically installed [&#8230;]]]></description> <content:encoded><![CDATA[<p>The usual, or even <em>classical</em> way is to create the list of installed packages with <strong><code>sudo dpkg --get-selections > package_list</code></strong>, and then restore when/if necessary with <strong><code>cat package_list | xargs sudo apt-get -y install</code></strong>.</p><p>As VihangD points out in his <a
href="http://serverfault.com/a/61472/25852">serverfault answer</a>, the same can be achieved with aptitude, while also excluding dependent, automatically installed packages (which are included by the <em>classical</em> method). To create the list of packages, run <strong><code>aptitude search -F '%p' '~i!~M' > package_list</code></strong>. Here, <strong><code>-F '%p'</code></strong> asks aptitude to only print package names (instead of the default output, which also contains package state and description); search term <strong>&#8216;~i!~M&#8217;</strong> asks for all non-automatically installed packages.</p><p>To install packages using the created list, run <strong><code>xargs aptitude --schedule-only install < package_list; aptitude install</code></strong>. The first of these two commands instructs aptitude to mark all the packages from the list as scheduled for installation. The second command actually performs the installation.</p><p>Hamish Downer <a
href="http://serverfault.com/a/1333/25852">suggests</a> an alternative way of getting the initial package_list: using the deborphan utility, <strong><code>deborphan -a --no-show-section > package_list</code></strong>. This command asks deborphan to show a list of packages, which have no dependencies on them. Sounds very similar to what we did with aptitude above, but using deborphan will most likely result in a much shorter list of packages (on my system, deborphan printed 291 package names, aptitude printed 847, and dpkg printed 3650 package names). One more potentially important difference between aptitude- and deborphan-produced package lists is that aptitude only specifies package architecture when it is different from native (e.g. 'googleearth:i386' on a 64-bit system), while deborphan specifies architectures for all the packages (resulting in e.g. 'google-talkplugin:amd64' and 'googleearth-package:all' on a 64-bit system).</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F18%2Fsaving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html&amp;linkname=Saving%20and%20restoring%20the%20list%20of%20packages%20installed%20on%20a%20Debian%20system%20using%20aptitude%20or%20deborphan" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F18%2Fsaving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html&amp;linkname=Saving%20and%20restoring%20the%20list%20of%20packages%20installed%20on%20a%20Debian%20system%20using%20aptitude%20or%20deborphan" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F18%2Fsaving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html&amp;linkname=Saving%20and%20restoring%20the%20list%20of%20packages%20installed%20on%20a%20Debian%20system%20using%20aptitude%20or%20deborphan" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F18%2Fsaving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html&amp;linkname=Saving%20and%20restoring%20the%20list%20of%20packages%20installed%20on%20a%20Debian%20system%20using%20aptitude%20or%20deborphan" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F18%2Fsaving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html&amp;linkname=Saving%20and%20restoring%20the%20list%20of%20packages%20installed%20on%20a%20Debian%20system%20using%20aptitude%20or%20deborphan" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F18%2Fsaving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html&#038;title=Saving%20and%20restoring%20the%20list%20of%20packages%20installed%20on%20a%20Debian%20system%20using%20aptitude%20or%20deborphan" data-a2a-url="https://bogdan.org.ua/2013/10/18/saving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html" data-a2a-title="Saving and restoring the list of packages installed on a Debian system using aptitude or deborphan"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2013/10/18/saving-restoring-list-of-packages-installed-on-debian-using-aptitude-deborphan.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>GUIs for R</title><link>https://bogdan.org.ua/2013/10/17/guis-for-r.html</link> <comments>https://bogdan.org.ua/2013/10/17/guis-for-r.html#comments</comments> <pubDate>Thu, 17 Oct 2013 20:59:01 +0000</pubDate> <dc:creator><![CDATA[Bogdan]]></dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Science]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[cantor]]></category> <category><![CDATA[deducer]]></category> <category><![CDATA[ipython]]></category> <category><![CDATA[notebook]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[R]]></category> <category><![CDATA[rkward]]></category> <category><![CDATA[rstudio]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1870</guid> <description><![CDATA[I&#8217;ve tried [briefly] Cantor (which also supports Octave and KAlgebra as backends), rkward, deducer/JGR, R Commander, and RStudio. My personal choice was RStudio: it is good-looking, intuitive, easy-to-use, while powerful. Next step would be using some R-equivalent of the excellent ipython&#8217;s Mathematica-like Notebook webinterface&#8230;]]></description> <content:encoded><![CDATA[<p>I&#8217;ve tried [briefly] Cantor (which also supports Octave and KAlgebra as backends), rkward, deducer/JGR, R Commander, and RStudio.</p><p>My personal choice was RStudio: it is good-looking, intuitive, easy-to-use, while powerful.</p><p>Next step would be using some R-equivalent of the excellent ipython&#8217;s Mathematica-like Notebook webinterface&#8230;</p><p><a
class="a2a_button_citeulike" href="https://www.addtoany.com/add_to/citeulike?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F17%2Fguis-for-r.html&amp;linkname=GUIs%20for%20R" title="CiteULike" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F17%2Fguis-for-r.html&amp;linkname=GUIs%20for%20R" title="Pocket" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_kindle_it" href="https://www.addtoany.com/add_to/kindle_it?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F17%2Fguis-for-r.html&amp;linkname=GUIs%20for%20R" title="Kindle It" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_evernote" href="https://www.addtoany.com/add_to/evernote?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F17%2Fguis-for-r.html&amp;linkname=GUIs%20for%20R" title="Evernote" rel="nofollow noopener" target="_blank"></a><a
class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F17%2Fguis-for-r.html&amp;linkname=GUIs%20for%20R" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a
class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fbogdan.org.ua%2F2013%2F10%2F17%2Fguis-for-r.html&#038;title=GUIs%20for%20R" data-a2a-url="https://bogdan.org.ua/2013/10/17/guis-for-r.html" data-a2a-title="GUIs for R"><img
src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded> <wfw:commentRss>https://bogdan.org.ua/2013/10/17/guis-for-r.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>