{"id":12873,"date":"2025-12-16T01:01:00","date_gmt":"2025-12-16T06:01:00","guid":{"rendered":"https:\/\/www.both.org\/?p=12873"},"modified":"2026-01-20T13:25:35","modified_gmt":"2026-01-20T18:25:35","slug":"converting-to-btrfs-episode-4","status":"publish","type":"post","link":"http:\/\/www.both.org\/?p=12873","title":{"rendered":"Converting to BtrFS \u2014 Episode 4"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"12873\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">1    <\/span>\r\n<\/div><\/div>\n<p>In the <a href=\"https:\/\/www.both.org\/?p=12635\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?p=12635\" target=\"_blank\" rel=\"noreferrer noopener\">3rd episode<\/a> of this series, I used the <strong>btrfs-convert<\/strong> command to convert the EXT4 filesystem on an LVM base to BtrFS on LVM. My research hasn&#8217;t revealed any way to convert the LVM volume group and volume to a Linux type 83 partition<sup data-fn=\"3a129675-1d39-411e-a6bb-f35d6326e527\" class=\"fn\"><a href=\"#3a129675-1d39-411e-a6bb-f35d6326e527\" id=\"3a129675-1d39-411e-a6bb-f35d6326e527-link\">1<\/a><\/sup> while also migrating the EXT4 filesystem to BtrFS, so this has been LVM\/BtrFS.<\/p>\n\n\n\n<p>That conversion and the testing I&#8217;ve done for the last two weeks have all gone well so I&#8217;ve started the next stage of my conversion and testing. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Testing BtrFS on LVM<\/h2>\n\n\n\n<p>But let&#8217;s take a quick look at my testing before moving on. <\/p>\n\n\n\n<p>I&#8217;ve been using the <a href=\"https:\/\/www.both.org\/?p=12652\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?p=12652\" target=\"_blank\" rel=\"noreferrer noopener\">stress-ng<\/a> tool for that and it&#8217;s given me good information about my test system with only the filesystem in question under test as well as additional testing with some or all of the other system components under stress, such as memory, CPU, I\/O, DIsk, and more.<\/p>\n\n\n\n<p>I usually start btop and htop on the left terminal of a vertically-split screen session in one tab of the highly flexible and configurable <a href=\"https:\/\/www.both.org\/?p=6672\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?p=6672\" target=\"_blank\" rel=\"noreferrer noopener\">Konsole<\/a> terminal emulator. In the right terminal, I start the <strong>stress-ng<\/strong> utility with whatever set of stressors I want for the current test. Figure 1 shows this setup in one of my early tests much more clearly than words can.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter is-resized\"><a href=\"https:\/\/www.both.org\/wp-content\/uploads\/2025\/12\/stress-ng-01.png\"><img decoding=\"async\" src=\"http:\/\/www.both.org\/wp-content\/uploads\/2025\/12\/stress-ng-01.png\" alt=\"This image has an empty alt attribute; its file name is stress-ng-01.png\" style=\"aspect-ratio:1.8906908287371722;width:856px;height:auto\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 1: Using the Konsole terminal emulator to show both the stress-ng command and its output, with btop monitor of my system. Click to enlarge<\/figcaption><\/figure>\n\n\n\n<p>That testing went very well, and based on that, I decided to proceed to the next step.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Converting to BtrFS on a Linux partition<\/h2>\n\n\n\n<p>Because there&#8217;s no option for an in-place conversion from LVM\/BtrFS to raw Linux partition\/BtrFS, it was necessary to wipe out the entire disk I&#8217;m using for my family pictures and start from scratch. I make multiple backups daily so I don&#8217;t need to do that before wiping out the entire drive. However, I did verify that the backups were good. <\/p>\n\n\n\n<p>I unmounted the drive. Well, I tried to, but the <strong>umount<\/strong> command indicated that the drive was busy. I&#8217;d already ensured that the hosts that share this drive had no open SSHFS connections to this system. I used the <strong>lsof \/var\/Pictures<\/strong> commend to list the open files preventing it from being unmounted. It turns out I had an open SSH connection from my primary workstation, so I exited from that and was able to unmount the drive. <\/p>\n\n\n\n<p>I used <strong>vgremove<\/strong> to delete volume group which also deletes the volume after giving a warning it&#8217;s about to do that. I used <strong>fdisk<\/strong> to create a new Linux partition (83) filling the entire drive, and made a new BtrFS filesystem on the partition.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>mkfs -t btrfs \/dev\/sda1<\/strong>\nbtrfs-progs v6.17.1\nSee https:\/\/btrfs.readthedocs.io for more information.\n\nPerforming full device TRIM \/dev\/sda1 (465.76GiB) ...\nLabel:              (null)\nUUID:               fa014f33-df03-4bc9-9669-030fc2be855b\nNode size:          16384\nSector size:        4096        (CPU page size: 4096)\nFilesystem size:    465.76GiB\nBlock group profiles:\nData:             single            8.00MiB\nMetadata:         DUP               1.00GiB\nSystem:           DUP               8.00MiB\nSSD detected:       yes\nZoned device:       no\nFeatures:           extref, skinny-metadata, no-holes, free-space-tree\nChecksum:           crc32c\nNumber of devices:  1\nDevices:\nID        SIZE  PATH\n1   465.76GiB  \/dev\/sda1<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-small-font-size\">Figure 2: Using the mkfs command to create a new BtrFS filesystem.<\/p>\n\n\n\n<p>Note the UUID entry in the output from the <strong>mkfs<\/strong> command. We use this later in the \/etc\/fstab file as one option for the filesystem ID. Each storage device, partition, and filesystem has a UUID. The one for the filesystem is the one we use in the fstab.<\/p>\n\n\n\n<p>Because the <a href=\"https:\/\/www.both.org\/?p=12727\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?p=12727\" target=\"_blank\" rel=\"noreferrer noopener\">\/etc\/fstab<\/a> entry for the filesystem was for LVM\/BtrFS as seen in Figure 3, I modified that entry for a BtrFS filesystem without LVM. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/mapper\/vg02-Pictures \/var\/Pictures btrfs<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-small-font-size\">Figure 3: The original LVM\/BtrFS entry in \/etc\/fstab.<\/p>\n\n\n\n<p>I changed that to each of the three entries below to use all three filesystem ID types, and all three work as expected. In my early experiments, I did have issues with the subvol option, I think because this is a volume with no subvolumes, so I ended up not using it. <\/p>\n\n\n\n<p>I created a disk label on the BtrFS filesystem because that works the same as a label on an EXT filesystem, making it easy to define the filesystem ID. <\/p>\n\n\n\n<p>Figure 4: Creating the filesystem label.<\/p>\n\n\n\n<p class=\"has-text-align-center has-small-font-size\">Figure 4: Creating the filesystem label.<\/p>\n\n\n\n<p>Use the filesystem UUID from the data provided when the filesystem was created. If you don&#8217;t have a record of it, you can find it using the commands in Figure 5. The first instance displays all BtrFS filesystems, and the second, shows only the defined one. This command also provides information about device size, usage, and the path to the <a href=\"https:\/\/www.both.org\/?p=5446\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?p=5446\" target=\"_blank\" rel=\"noreferrer noopener\">device special files<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>btrfs filesystem show<\/strong>\nLabel: 'fedora'  uuid: 02cae19f-3e4d-479e-a0da-ffeea8afb512\nTotal devices 1 FS bytes used 35.75GiB\ndevid    1 size 474.94GiB used 47.02GiB path \/dev\/nvme0n1p3\n\nLabel: 'Pictures'  uuid: fa014f33-df03-4bc9-9669-030fc2be855b\nTotal devices 1 FS bytes used 17.84GiB\ndevid    1 size 465.76GiB used 21.02GiB path \/dev\/sda1\n\n# <strong>btrfs filesystem show \/dev\/sda1<\/strong>\nLabel: 'Pictures'  uuid: fa014f33-df03-4bc9-9669-030fc2be855b\nTotal devices 1 FS bytes used 17.84GiB\ndevid    1 size 465.76GiB used 21.02GiB path \/dev\/sda1<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-small-font-size\">FIgure 5: Use the <strong>btrfs filesystem show<\/strong> command to find the UUID of a BtrFS filesystem. <\/p>\n\n\n\n<p>We can use the UUID, the device special file path, or the label we already created to specify the device ID for the mount entry in fstab. I tried all of these using the entries shown in Figure 6. I left the one using the UUID uncommented since that&#8217;s the one I&#8217;ll be using for this use case. It&#8217;s also the default for BtrFS filesystems so I want to be consistent with that.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Mount the filesystem containing family pictures.                                                                                           # \/dev\/sda1 \/var\/Pictures btrfs compress=zstd:1 0 0                                                                                          # LABEL=Pictures \/var\/Pictures btrfs compress=zstd:1 0 0                                                                                     UUID=fa014f33-df03-4bc9-9669-030fc2be855b \/var\/Pictures btrfs compress=zstd:1 0 0                                                            <\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-small-font-size\">Figure 6: These three entries in the \/etc\/fstab file can all be used for mounting the filesystem.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>The commands in Figure 7 show the filesystems in a couple different ways. I like seeing things like this in multiple formats as each command has different information and data formats. This makes it easier for me to visualize the filesystems and their structures.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>df -hT<\/strong>\nFilesystem     Type      Size  Used Avail Use% Mounted on\n\/dev\/nvme0n1p3 btrfs     475G   38G  435G   8% \/\ndevtmpfs       devtmpfs   16G     0   16G   0% \/dev\ntmpfs          tmpfs      16G     0   16G   0% \/dev\/shm\ntmpfs          tmpfs     6.3G  1.4M  6.3G   1% \/run\ntmpfs          tmpfs     1.0M     0  1.0M   0% \/run\/credentials\/systemd-journald.service\ntmpfs          tmpfs      16G  4.0K   16G   1% \/tmp\n\/dev\/nvme0n1p3 btrfs     475G   38G  435G   8% \/home\n\/dev\/nvme0n1p2 ext4      2.0G  660M  1.2G  37% \/boot\n\/dev\/sda1      btrfs     466G   18G  446G   4% \/var\/Pictures\ntmpfs          tmpfs     3.2G   96K  3.2G   1% \/run\/user\/980\ntmpfs          tmpfs     3.2G   88K  3.2G   1% \/run\/user\/0\n\n# <strong>lsblk -f<\/strong>\nNAME        FSTYPE FSVER LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINTS\nsda\n\u2514\u2500sda1      btrfs        Pictures fa014f33-df03-4bc9-9669-030fc2be855b  445.9G     4% \/var\/Pictures\nzram0       swap   1     zram0    a890692e-880c-45b6-b32e-7ea8fb914e02                &#91;SWAP]\nnvme0n1\n\u251c\u2500nvme0n1p1\n\u251c\u2500nvme0n1p2 ext4   1.0            055aba03-17f1-4cb7-92ec-3af8233bf5a4    1.1G    34% \/boot\n\u2514\u2500nvme0n1p3 btrfs        fedora   02cae19f-3e4d-479e-a0da-ffeea8afb512  433.2G     8% \/home\n                                                                                      \/<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center has-small-font-size\">Figure 7: Verifying the filesystems.<\/p>\n\n\n\n<p>Note again in Figure 7 that \/ (root) and \/home are both subvolumes of the BtrFS filesystem on the nvme0n1p3 device. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final thoughts<\/h2>\n\n\n\n<p>It may seem that I&#8217;m taking the long way around to get to a completely BtrFS system but I&#8217;m experimenting as I go. In this instance it really is about the trip more than the destination. This gives me an opportunity to learn things about BtrFS &#8212; and migrating there from LVM\/EXT4 &#8212; that I&#8217;d not otherwise have.<\/p>\n\n\n\n<p>Now that I&#8217;ve gotten it all converted to Linux partition\/BtrFS, I&#8217;ll be doing more testing. My testing will continue to become more aggressive as I learn more about the <strong>stress-ng<\/strong> utility. I&#8217;ll post the result in a few weeks. <\/p>\n\n\n\n<p>Then I&#8217;ll move on to creating subvolumes. One step at a time for critical new things like filesystems.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">The Full Series<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.both.org\/?p=12499\" target=\"_blank\" rel=\"noreferrer noopener\">Converting to BtrFS \u2014 Episode 1<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=12582\" target=\"_blank\" rel=\"noreferrer noopener\">Converting to BtrFS \u2014 Episode 2<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=12635\" target=\"_blank\" rel=\"noreferrer noopener\">Converting to BtrFS \u2014 Episode 3<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=12873\">Converting to Btr<\/a><a href=\"https:\/\/www.both.org\/?p=12873\" target=\"_blank\" rel=\"noreferrer noopener\">F<\/a><a href=\"https:\/\/www.both.org\/?p=12873\">S \u2014 Episode 4<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=13137\" target=\"_blank\" rel=\"noreferrer noopener\">Converting to BtrFS \u2014 Episode 5<\/a><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"3a129675-1d39-411e-a6bb-f35d6326e527\">A type 83 partition is used for Linux native filesystems such as BtrFS and EXT4. <a href=\"#3a129675-1d39-411e-a6bb-f35d6326e527-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><\/ol>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1 In the 3rd episode of this series, I used the btrfs-convert command to convert the EXT4 filesystem<\/p>\n","protected":false},"author":2,"featured_media":6986,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":"[{\"content\":\"A type 83 partition is used for Linux native filesystems such as BtrFS and EXT4.\",\"id\":\"3a129675-1d39-411e-a6bb-f35d6326e527\"}]"},"categories":[866,169,5],"tags":[],"class_list":["post-12873","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-btrfs","category-filesystems","category-linux"],"modified_by":"David Both","_links":{"self":[{"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12873"}],"version-history":[{"count":31,"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12873\/revisions"}],"predecessor-version":[{"id":13356,"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/12873\/revisions\/13356"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/6986"}],"wp:attachment":[{"href":"http:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12873"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12873"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}