<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<atom:link href="https://seanbehan.ca/posts/tag/raid/rss.xml" rel="self" type="application/rss+xml" />
		<title>Sean Behan — RAID</title>
		<link>https://seanbehan.ca/posts/tag/raid</link>
		<description>Posts tagged “RAID”.</description>
		<language>en-CA</language>
		<!-- RSS wants an address here and readers show the name beside it. -->
		<managingEditor>sean@seanbehan.ca (Sean Behan)</managingEditor>
		<webMaster>sean@seanbehan.ca (Sean Behan)</webMaster>
		<lastBuildDate>Sun, 30 Aug 2026 05:33:55 GMT</lastBuildDate>
		<item>
		<guid isPermaLink="true">https://seanbehan.ca/posts/btrfs</guid>
		<title><![CDATA[BTRFS RAID1 and how to fix it]]></title>
		<description><![CDATA[Setting up a two-disk BTRFS RAID1 for a Steam library, and repairing it when a drive starts throwing errors.]]></description>
		<link>https://seanbehan.ca/posts/btrfs</link>
		<pubDate>Tue, 23 May 2023 14:39:58 GMT</pubDate>
		<category>backup</category><category>linux</category><category>raid</category>
		<content:encoded><![CDATA[<h3>BTRFS RAID1 Setup</h3><p>I mentioned in my previous post that I use an external drive to keep my Steam</p><p>games on. In an attempt to not have to re-download hundreds of gigabytes of</p><p>games I keep them on a RAID1 with 2x5TB drives that I use BTRFS to manage. In</p><p>this post I&#x27;m going to outline how I set it all up, and how I manage it when</p><p>issues arise.</p><h3>Formatting Drives</h3><p>First of all I had to format the drives, so I made sure they were empty and</p><p>everything was backed up. Don&#x27;t do this unless you know for sure that all the</p><p>data on all your drives is backed up somewhere else, or you want to delete it</p><p>permanently.</p><p>Okay so the commands are easy, you just have to make sure you&#x27;re using the</p><p>right ones as not to lose your data. Don&#x27;t run these commands without</p><p>understanding what they do. Replace \_ with your drive letter. A lot of these</p><p>commands need to be run with root, make sure to either elevate to root (<code>sudo -s</code>)</p><p>or prepend the commands with <code>sudo</code>.</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">lsblk</span></span></code></pre><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">mkfs.btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /dev/sd_1</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">mkfs.btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /dev/sd_1</span></span></code></pre><h3>Creating the RAID1 Array</h3><p>Now you can mount the newly formatted drives to a single RAID1.</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">mount</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /dev/sd_1</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /mnt</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> device</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> add</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /dev/sd_1</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /mnt</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> balance</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> -dconvert=raid1</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> -mconvert=raid1</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /mnt</span></span></code></pre><p>The last command might take a little bit of time, but once it&#x27;s finished your</p><p>drives will be all ready to be used.</p><h3>Managing the Array</h3><p>Now if you need to swap out a drive, add another, or you unplug one when it&#x27;s</p><p>writing you can simply balance again and btrfs should be able to balance back</p><p>onto the drive.</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> balance</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> -dconvert=raid1</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> -mconvert=raid1</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /mnt</span></span></code></pre><p>You can view the status of the balance using:</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> balance</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> status</span></span></code></pre><p>You can remove a drive or add another using:</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> device</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> remove</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /dev/sd_1</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> device</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> add</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /dev/sd_1</span></span></code></pre><p>Just make sure you balance right afterwards (which will take a VERY long time</p><p>if you have lots of data, beware)</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">btrfs</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> balance</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> start</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> -dconvert=raid1</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> -mconvert=raid1</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> /mnt</span></span></code></pre>]]></content:encoded>
	</item>
	</channel>
</rss>