<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Btrfs on tech.notes</title>
    <link>https://newblog.utzer.de/tags/btrfs/</link>
    <description>Recent content in Btrfs on tech.notes</description>
    <generator>Hugo</generator>
    <language>de</language>
    <lastBuildDate>Tue, 11 Jul 2023 09:36:53 +0000</lastBuildDate>
    <atom:link href="https://newblog.utzer.de/tags/btrfs/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Linux cp command with reflink</title>
      <link>https://newblog.utzer.de/2023/07/11/linux-cp-command-with-reflink/</link>
      <pubDate>Tue, 11 Jul 2023 09:36:53 +0000</pubDate>
       <guid isPermaLink="false">https://tech.utzer.de/?p=152</guid> 
      <description>&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp -pRv --reflink=auto /source/folder /destination/folder
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;copy files and directories&lt;br&gt;
-p same as &amp;ndash;preserve=mode,ownership,timestamps&lt;br&gt;
-R, -r, &amp;ndash;recursive&lt;br&gt;
copy directories recursively&lt;br&gt;
-v verbose, show what is going on.&lt;/p&gt;
&lt;p&gt;&amp;ndash;reflink[=WHEN]&lt;br&gt;
control clone/CoW copies.&lt;/p&gt;
&lt;p&gt;This just copied 169GB of files in 20 seconds. This only works on supported filesystems, so for example by &amp;ldquo;#Btrfs, #CIFS, #NFS 4.2, #OCFS2, #overlayfs, and #XFS&amp;rdquo;. See &lt;a href=&#34;https://unix.stackexchange.com/a/631238&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Explainshell tells you &lt;a href=&#34;https://explainshell.com/explain?cmd=cp+-pRv+--reflink%3Dauto+%2Fsource%2Ffolder%2Ffile+%2Fdestination%2Ffolder%2Ffile&#34;&gt;this&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Create Linux dm-crypt BTRFS RAID 1</title>
      <link>https://newblog.utzer.de/2020/02/12/create-linux-dm-crypt-btrfs-raid-1/</link>
      <pubDate>Wed, 12 Feb 2020 08:35:36 +0000</pubDate>
       <guid isPermaLink="false">http://tech.utzer.de/?p=98</guid> 
      <description>&lt;p&gt;To do this you need two empty drives, with the guide below all data on the drive will be lost if it is not empty!&lt;/p&gt;
&lt;h4 id=&#34;1-install-cryptsetup&#34;&gt;1. Install cryptsetup&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get install cryptsetup
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;2-create-the-dm-crypt&#34;&gt;2. Create the dm-crypt&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cryptsetup -y -v luksFormat /dev/sdb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cryptsetup -y -v luksFormat /dev/sdc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(Make sure to use the correct device. To show available devices use &amp;ldquo;lsblk&amp;rdquo;.)&lt;/p&gt;
&lt;h4 id=&#34;3-mount-the-cryptsetup-disk&#34;&gt;3. Mount the cryptsetup disk&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cryptsetup luksOpen /dev/sdb disk1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cryptsetup luksOpen /dev/sdc disk2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;4-check-if-this-was-successful&#34;&gt;4. Check if this was successful&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ls -l /dev/mapper/disk*
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;or
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo cryptsetup -v status disk1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo cryptsetup -v status disk2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;5-create-btrfs-volume-raid-1-this-means-all-data-and-meta-data-is-mirrored-which-means-if-you-use-2-drives-with-ie-4tb-each-you-can-only-use-4tg-over-all-in-the-btrfs-mounted-volume&#34;&gt;5. Create BTRFS volume RAID 1, this means all data and meta-data is mirrored, which means if you use 2 drives with i.e. 4TB each you can only use 4TG over all in the BTRFS mounted volume.&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkfs.btrfs -m raid1 -d raid1 /dev/mapper/disk1 /dev/mapper/disk2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You could list more than two drive, for example to increase redundancy, but if you want to use more drive to increase storage you would have to use a different Raid level.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
