<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Kubuntu Forums - BTRFS</title>
		<link>https://www.kubuntuforums.net/</link>
		<description>Dedicated to BTRFS questions and information</description>
		<language>en</language>
		<lastBuildDate>Fri, 11 Sep 2026 20:39:15 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>images/misc/rss.png</url>
			<title>Kubuntu Forums - BTRFS</title>
			<link>https://www.kubuntuforums.net/</link>
		</image>
		<item>
			<title>Moving, resizing, and replacing BTRFS file systems and their partitions</title>
			<link>https://www.kubuntuforums.net/forum/general/miscellaneous/btrfs/694072-moving-resizing-and-replacing-btrfs-file-systems-and-their-partitions</link>
			<pubDate>Sat, 29 Aug 2026 23:35:24 GMT</pubDate>
			<description><![CDATA[I was checking my 4 NMVE drives for wear and my boot NVME drive showed &quot;Percentage Used: 49%&quot; while the other NVME drives are 0-3%. This number is...]]></description>
			<content:encoded><![CDATA[I was checking my 4 NMVE drives for wear and my boot NVME drive showed &quot;<b>Percentage Used: 49%</b>&quot; while the other NVME drives are<b> 0-3%.</b> This number is the manufacturers best guess about the life span of the drive - so half dead.<br />
I decided to move my booting BTRFS file system to a different drive and use the more worn one for backups. I detailed this here thinking someone else might find it useful.<br />
<br />
The root file system takes the whole drive - 932G and is 50% full, The target drive also was 932G and had about 550G of backups on it. I wanted to reverse the setup: make the current backup drive the boot drive and vice versa. After reviewing all my file systems, I decided I would move the backup file system <i>somewhere</i>, move the root file system onto that drive, then move the backup file system to the worn drive, but I didn't have enough free space available and contiguous to do it.<br />
<br />
I ended up following these steps:<br />
<br />
<b>Step 1) </b>I had 2 EXT4 file systems - VM drives and their backups - that were less than half full so I moved the files off of one onto the other.<div style="margin-left:40px">This left 290G free on that drive. There was also a sacrificial partition of 410G on the same drive, if combined: enough room in total to hold the backup file system, but still not contiguous.<br />
Between these two available partitions was my Steam partition (BTRFS) of 250G and about 85% full.</div> <br />
<b>Step 2) </b>I used the &quot;btrfs add&quot; command to add the Steam file system to the 290G partition. This happens instantly. I then used <b>&quot;</b>btrfs remove&quot; to remove the 250G partition from the combined file system. This took about 50 minutes to complete.<div style="margin-left:40px">I now had 590G free (290+250) and contiguous which is enough to hold the backup file system. A bonus was the getting-close-to-full Steam partition now has 40G more space.<br />
<br />
Next, to move the backup file system to this drive so I can put the root file system in it's place.</div> <br />
<b>Step 3) </b>I again did &quot;btrfs add&quot; followed by &quot;btrfs remove&quot;. This time it took about 2 hours to complete.<div style="margin-left:40px">Note that since the target partition is <b>smaller</b> than the source, the file system will be reduced in size to fit in the smaller space. If there isn't enough room on the target partition for all the data, the command will abort immediately.​<br />
<br />
Next, to move the <b>root file system</b> to the now empty backup drive.</div> <br />
<b>Step 4)</b> This time, rather than add+remove which is slow, I used the &quot;btrfs<b> replace</b>&quot; command, which is <i>much</i> faster. This took less than 20 minutes.<div style="margin-left:40px">Note that the &quot;replace&quot; command requires one extra step to run it. You need to know the device ID number which appears as &quot;devid&quot; when you use &quot;btrfs filesystem show&quot;.</div><div style="margin-left:40px">I now was more than half-way to completing my task. However, up to this point I had not rebooted and was still using the system for other tasks while btrfs did it's thing.</div> <br />
<br />
<b>UH-OH!) </b>Then I snafu'd by deciding to run &quot;partprobe&quot; since I had been moving partitions around. This froze the system <b>immediately</b> requiring a hard reset to reboot.<div style="margin-left:40px">To make it more fun, on reboot I ended up in the GRUB console and had to manually boot from it. No biggie as I had done that before (too many times). Once I was booted, I simply ran &quot;update-grub&quot; and it rebooted successfully. I suspect had I updated grub <b>without</b> running partprobe, I would have been able to proceed without a reboot.</div> <br />
<br />
<b>Step 5)</b> Last task to complete my goal was to move the root backup file system from the Steam drive to the old root drive. Here, I used &quot;btrfs replace&quot; again.<div style="margin-left:40px">However this time the file system was only 590G in size and was &quot;replaced&quot; to a 953G partition. In this scenario you have to <b>&quot;grow&quot; the file system </b>before you can use the additional free space.​</div> <br />
<b>Step 6) </b>The command is simple and immediate: &quot;btrfs fi resize max &lt;mount point&gt;&quot;<br />
<br />
My goal was complete. All that was left was to re-create the deleted EXT4 partition for the VM backups and move the files back.<br />
<br />
<br />
<span style="font-size:16px"><b>Key Take-aways and more info:</b></span><br />
<br />
<b>These operations are potentially harmful</b> if you were to lose power. Backups are essential, and if possible, also a battery backup system for a desktop PC.<br />
<br />
<b>Notice that at no time </b>did I document editing fstab or updating grub after moving btrfs file systems around. That's because I didn't need to. The add, remove, and replace functions <b>retain and move file system labels and UUIDs.</b> Unless you are mounting using something other than one of these two entries to mount or boot, there's no need to edit anything.<br />
<br />
<b>Except for my snafu,</b> all of this happened while continuing to use the system normally. In fact, all the file systems must be mounted to use these commands. The whole operation (minus the grub repair) took about 4 hours.<br />
<br />
<b>In Step 2 </b>I could have added the two partitions together <i>without</i> using &quot;add|remove&quot; to relocate the Steam partition. However, then Step 4 would have required <b>two</b> sets of &quot;add|remove&quot; commands instead of the single and <i>much</i> faster &quot;replace&quot; command.<br />
<br />
<b>The &quot;btrfs replace&quot; command</b> cannot be cancelled or interrupted. To use &quot;replace&quot; the file system <i>must</i> be equal to or smaller that the target partition. Space permitting, you can shrink the file system in place and then use the command.<br />
<br />
<b>The &quot;remove&quot; command </b>can be cancelled and resumed later. The &quot;add&quot; command is quickly reversible with &quot;remove&quot; unless you added files to the combined file system or have run a &quot;balance&quot; command.<br />
<br />
<br />
<b><span style="font-size:16px">Commands used and examples</span></b>(all require sudo rights):<br />
<br />
<b>btrfs device add</b> &lt;device name&gt; &lt;mountpoint&gt;<div style="margin-left:40px">btrfs de ad /dev/nvme3n1p3 /mnt/steam</div> <br />
<b>btrfs device remove</b> &lt;device name&gt; &lt;mountpoint&gt;<div style="margin-left:40px">btrfs dev remove /dev/nvme3n1p4 /mnt/steam<br />
 </div> <b>btrfs filesystem show</b>     (to retrieve the &quot;devid&quot; to use the replace command)<div style="margin-left:40px">btrfs fi sh </div> <br />
<b>btrfs replace start</b> &lt;devid&gt; &lt;device-to-remove&gt; &lt;mount point&gt;<div style="margin-left:40px">btrfs rep start 2 /dev/nvme1n1 /mnt/root_backup</div> <br />
<b>btrfs replace status</b>     (to see how the command is proceeding)<div style="margin-left:40px">btrfs rep status</div>  <br />
<b>btrfs filesystem resize &lt;mount point&gt;</b><div style="margin-left:40px">btrfs fi re max /mnt/root_backup/</div>]]></content:encoded>
			<category domain="https://www.kubuntuforums.net/forum/general/miscellaneous/btrfs">BTRFS</category>
			<dc:creator>oshunluvr</dc:creator>
			<guid isPermaLink="true">https://www.kubuntuforums.net/forum/general/miscellaneous/btrfs/694072-moving-resizing-and-replacing-btrfs-file-systems-and-their-partitions</guid>
		</item>
	</channel>
</rss>
