<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Raymond P. Burkholder - Things I Do - BTRFS</title>
    <link>http://blog.raymond.burkholder.net/</link>
    <description>In And Around Technology and The Arts</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.7.2 - http://www.s9y.org/</generator>
    <pubDate>Mon, 10 Jul 2023 00:18:39 GMT</pubDate>

    <image>
        <url>http://blog.raymond.burkholder.net/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: Raymond P. Burkholder - Things I Do - BTRFS - In And Around Technology and The Arts</title>
        <link>http://blog.raymond.burkholder.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Debian Apt Btrfs Auto-Snapshot Retrofit</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/1238-Debian-Apt-Btrfs-Auto-Snapshot-Retrofit.html</link>
            <category>BTRFS</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/1238-Debian-Apt-Btrfs-Auto-Snapshot-Retrofit.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=1238</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1238</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;&lt;a href=&quot;https://github.com/david-cortes/snapper-in-debian-guide&quot; target=_blank&gt;Debian with Automated Snapper Rollbacks&lt;/a&gt; is a short tutorial about setting up a Debian linux system with automated BTRFS snapshots of the system and easy rollback to previous auto-generated snapshots.  Once it&#039;s setup, it&#039;ll automatically take pre/post snapshots when you run `apt` and you can boot them from grub. 
    </content:encoded>

    <pubDate>Mon, 10 Jul 2023 00:18:39 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/1238-guid.html</guid>
    
</item>
<item>
    <title>linux: serious corruption issue with btrfs</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/1024-linux-serious-corruption-issue-with-btrfs.html</link>
            <category>BTRFS</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/1024-linux-serious-corruption-issue-with-btrfs.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=1024</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1024</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;From &lt;a href=&quot;https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=940105&quot; target=_blank&gt;Debian Bug report logs - #940105&lt;/a&gt;:

&lt;blockquote&gt;
&lt;p&gt;There were some reports over the last weeks from users on linux-btrfs which
suffered from catastrophic btrfs corruption.
&lt;p&gt;The bug which is apparently a regression introduced in 5.2 has now been found[0]
an a patch is available[1].
&lt;p&gt;Since it&#039;s unclear how long it will take to be part of a stable release and when
Debian will pick this up in unstable, please consider to cherry-pick the patch.

&lt;ul&gt;
  &lt;li&gt;[0] &lt;a href=&quot;https://lore.kernel.org/linux-btrfs/9731b0e7-81f3-4ee5-6f89-b4fd8d981736@petaramesh.org/T/#m38d726b09e784f1ffbd26edf13f723f71045723e&quot; target=_blank&gt;lore.kernel.org&lt;/a&gt;
  &lt;li&gt;[1] &lt;a href=&quot;https://patchwork.kernel.org/patch/11141559/&quot; target=_blank&gt;patchwork.kernel.org&lt;/a&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Sun, 15 Sep 2019 17:06:06 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/1024-guid.html</guid>
    
</item>
<item>
    <title>BTRFS on Debian</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/814-BTRFS-on-Debian.html</link>
            <category>BTRFS</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/814-BTRFS-on-Debian.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=814</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=814</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;Debian has a &lt;a href=&quot;https://wiki.debian.org/Btrfs&quot; target=_blank&gt;BTRFS Wiki&lt;/a&gt;.  One item there, which affected me, is that kernel 4.11 has issues and will cause corruption.  I am now on kernel 4.12.  I&#039;m not sure if having duplicated metadata would have prevented some of the pain of recovery.  To see if metadata is redundant:

&lt;blockquote&gt;&lt;pre&gt;
 btrfs fi df /
Data, single: total=14.00GiB, used=12.63GiB
System, single: total=32.00MiB, used=16.00KiB
Metadata, single: total=520.00MiB, used=317.27MiB
GlobalReserve, single: total=31.22MiB, used=0.00B
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;This is on laptop with a single ssd.  It has been written elsewhere, that even if metadata duplication is requested, the ssd may deduplicate it anyway.

&lt;p&gt;So... regular maintenance and scanning is recommended.

&lt;p&gt;For maintenance, the wiki article suggests regular defragmentation (the -t 32M is not needed since Debian 9 (Stretch):

&lt;blockquote&gt;
sudo ionice -c idle btrfs filesystem defragment -f -t 32M -r $PATH
&lt;/blockquote&gt;

&lt;p&gt;The -f  parameter is recommended for flushing after each file, particularly when there are snapshots or reflinked files.

&lt;p&gt;One way to find btrfs formatted file systems:

&lt;blockquote&gt;&lt;pre&gt;
# grep btrfs /etc/fstab
UUID=b5714bf3-eec4-431d-8e3e-6b062f7e5c55 /               btrfs   noatime,nodiratime 0       0
UUID=affc8ed9-c1c0-403d-8ba1-b8ca68d2d7d7 /var            btrfs   noatime,nodiratime 0       0
UUID=b662aa71-5b72-4028-a10a-e286c56b87cf /home/rpb     btrfs    noatime,nodiratime 0 0
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;To check for errors:

&lt;blockquote&gt;&lt;pre&gt;
# btrfs dev stats /home
[/dev/nvme0n1p2].write_io_errs    0
[/dev/nvme0n1p2].read_io_errs     0
[/dev/nvme0n1p2].flush_io_errs    0
[/dev/nvme0n1p2].corruption_errs  0
[/dev/nvme0n1p2].generation_errs  0
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;To manually initiate an online scrub and monitor status:

&lt;blockquote&gt;&lt;pre&gt;
# btrfs scrub start /mnt
scrub started on /mnt, fsid ab27f528-d417-4ff9-9eb4-b59ad940290f (pid=14535)
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;pre&gt;&lt;blockquote&gt;
# btrfs scrub status /mnt
scrub status for ab27f528-d417-4ff9-9eb4-b59ad940290f
        scrub started at Sun Sep 24 19:55:56 2017, running for 00:00:10
        total bytes scrubbed: 2.08GiB with 0 errors
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;A scrub with detailed results running in foreground:

&lt;blockquote&gt;&lt;pre&gt;
# btrfs scrub start -B -d -R /
scrub device /dev/nvme0n1p2 (id 1) done
        scrub started at Sun Oct  8 12:16:54 2017 and finished after 00:00:05
        data_extents_scrubbed: 373524
        tree_extents_scrubbed: 20306
        data_bytes_scrubbed: 13566894080
        tree_bytes_scrubbed: 332693504
        read_errors: 0
        csum_errors: 0
        verify_errors: 0
        no_csum: 25579
        csum_discards: 0
        super_errors: 0
        malloc_errors: 0
        uncorrectable_errors: 0
        unverified_errors: 0
        corrected_errors: 0
        last_physical: 15590227968
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Useful BTRFS pages:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://wiki.archlinux.org/index.php/Btrfs&quot; target=_blank&gt;archlinux&lt;/a&gt; with an entry on doing a btrfs scrub using a timer service
  &lt;li&gt;&lt;a href=&quot;http://marc.merlins.org/perso/btrfs/post_2014-03-19_Btrfs-Tips_-Btrfs-Scrub-and-Btrfs-Filesystem-Repair.html&quot; target=_blank&gt;Marc&#039;s Public Blog - Linux Btrfs Blog Posts&lt;/a&gt;: with some entries about mouting a system with errors and bypassing checksum problems.
  &lt;li&gt;&lt;a href=&quot;https://coreos.com/os/docs/latest/btrfs-troubleshooting.html&quot; target=_blank&gt;Working with btrfs and common troubleshooting&lt;/a&gt; by the Container Linux people.
  &lt;/ul&gt; &lt;br /&gt;&lt;a href=&quot;http://blog.raymond.burkholder.net/index.php?/archives/814-BTRFS-on-Debian.html#extended&quot;&gt;Continue reading &quot;BTRFS on Debian&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 24 Sep 2017 22:45:05 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/814-guid.html</guid>
    
</item>
<item>
    <title>BTRFS Troubleshooting</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/627-BTRFS-Troubleshooting.html</link>
            <category>BTRFS</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/627-BTRFS-Troubleshooting.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=627</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=627</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;Have had couple instances where the user-interface (KDE) of my Linux workstation, which is based upon Debian Testing / Jessie, has become non-responsive.  Yet, I was still able to SSH into the machine.  I see systemd, some IRQ processes, and VirtualBox had high utilization.  Both or all three times, I can&#039;t remember the count now, the issue occurred when debugging a program I&#039;ve been writing which uses OpenGL.  At the same time, I had a VirtualBox running with Windows 10 running.  So there were many things running, any of which might cause issues.  It was probably OpenGL related, but have not yet come up with a mechanism of proving this one way or another.

&lt;p&gt; I am also running BTRFS on the machine.  In looking general BTRFS and NFS configurations, I saw the mailing list article at:
&lt;a href=&quot;http://www.spinics.net/lists/linux-btrfs/msg34419.html&quot; target=_blank&gt;BTRFS hangs - possibly NFS related?&lt;/a&gt;.  In that article, a couple of troubleshooting commands are shown. 
They represent sysrq flags.  I will have to examine them if/when my issue re-asserts itself:

&lt;blockquote&gt;&lt;pre&gt;
echo 1 &gt; /proc/sys/kernel/sysrq
echo w &gt; /proc/sysrq-trigger
dmesg
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;The results may show &#039;SysRq : Show Blocked State&#039; entries.  These will be places to further examine for issues.

&lt;p&gt;In the same article, some other things to think about:

&lt;ul&gt;
  &lt;li&gt;With the right tools CPU/load can be categorized into several areas, low- priority/niced, normal, kernel, IRQ, soft-IRQ, IO-wait, steal, guest, 
  although steal and guest are VM related (steal is CPU taken by the hypervisor or another guest if measured from within a guest, and thus not available to it, 
  guest is of course guests, when measured from the hypervisor) and will be zero if you&#039;re not running them, 
  and irq and soft-irq won&#039;t show much either in the normal case.  And of course niced doesn&#039;t show either unless you&#039;re running something niced.
  &lt;li&gt;or simply use the alt-srq-w combo if you&#039;re on x86 and have it available, there&#039;s more about magic-srq in the kernel&#039;s Documentation/ sysrq.txt file)
  &lt;li&gt;If you don&#039;t have a tool that shows all that, one available tool that does is htop.  It&#039;s a &quot;better&quot; top, ncurses/semi-gui-based so run it in a terminal window or text-login VT.
  &lt;li&gt;Of course you can see which threads are using all that CPU-time &quot;load&quot; that isn&#039;t, while you&#039;re at it.
  &lt;li&gt;Also check out iotop, to see what processes are actually doing IO and the total IO speed.  Both these tools have manpages...
  &lt;/ul&gt;

&lt;p&gt;A work around for the original poster&#039;s problem was to use:

&lt;blockquote&gt;&lt;pre&gt;
btrfs filesystem sync /mnt/btrfs
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;He even went so far as to put that into the crontab and ran once a minute.

&lt;p&gt;Some BTRFS documentation and help links:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technetwork/articles/servers-storage-admin/advanced-btrfs-1734952.html&quot; target=_blank&gt;Oracle Tech Network Article&lt;/a&gt;: How I Use the Advanced Capabilities of Btrfs by Margaret Bierman with Lenz Grimmer
  &lt;/ul&gt; 
    </content:encoded>

    <pubDate>Mon, 06 Apr 2015 17:05:02 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/627-guid.html</guid>
    
</item>

</channel>
</rss>
