Adding nvme to existing btrfs filesystem (non ssd)

Hi,
I have a 2TB hard disc (no ssd) in my system. There are 3 partitions:
/boot/efi on /dev/sda1
one btrsfs partition with / and everything else on /dev/sda2, and
one swap partiton on /dev/sda3.

Now I got my hands on a 500 GB nvme device and plan to add it to my filesystem on /dev/sda2. My question is can I simply call:

btrfs device add /dev/nvme0n1 /

to increase the storage space on my system?

Here are some additional information:

lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda       8:0    0   1.8T  0 disk 
├─sda1    8:1    0   512M  0 part /boot/efi
├─sda2    8:2    0   1.8T  0 part /var
│                                 /usr/local
│                                 /srv
│                                 /root
│                                 /opt
│                                 /home
│                                 /boot/grub2/x86_64-efi
│                                 /boot/grub2/i386-pc
│                                 /.snapshots
│                                 /
└─sda3    8:3    0  32.6G  0 part [SWAP]
sdb       8:16   0   1.8T  0 disk 
├─sdb1    8:17   0   1.8T  0 part 
├─sdb2    8:18   0   537M  0 part 
└─sdb3    8:19   0   537M  0 part 
sr0      11:0    1  1024M  0 rom  
nvme0n1 259:0    0 465.8G  0 disk 
df
Filesystem      1K-blocks       Used Available Use% Mounted on
/dev/sda2      1918776320 1589215632 328942624  83% /
devtmpfs             4096          0      4096   0% /dev
tmpfs            16384696          4  16384692   1% /dev/shm
efivarfs              256        134       118  53% /sys/firmware/efi/efivars
tmpfs             6553880       2504   6551376   1% /run
tmpfs                1024          0      1024   0% /run/credentials/systemd-journald.service
tmpfs                1024          0      1024   0% /run/credentials/systemd-udev-load-credentials.service
tmpfs                1024          0      1024   0% /run/credentials/systemd-tmpfiles-setup-dev-early.service
tmpfs                1024          0      1024   0% /run/credentials/systemd-sysctl.service
tmpfs                1024          0      1024   0% /run/credentials/systemd-tmpfiles-setup-dev.service
tmpfs                1024          0      1024   0% /run/credentials/systemd-vconsole-setup.service
/dev/sda2      1918776320 1589215632 328942624  83% /.snapshots
/dev/sda2      1918776320 1589215632 328942624  83% /boot/grub2/i386-pc
/dev/sda2      1918776320 1589215632 328942624  83% /boot/grub2/x86_64-efi
/dev/sda2      1918776320 1589215632 328942624  83% /home
/dev/sda2      1918776320 1589215632 328942624  83% /opt
/dev/sda2      1918776320 1589215632 328942624  83% /root
/dev/sda2      1918776320 1589215632 328942624  83% /srv
tmpfs            16384696        132  16384564   1% /tmp
/dev/sda2      1918776320 1589215632 328942624  83% /usr/local
/dev/sda2      1918776320 1589215632 328942624  83% /var
/dev/sda1          523244      32092    491152   7% /boot/efi
tmpfs                1024          0      1024   0% /run/credentials/systemd-tmpfiles-setup.service
tmpfs                1024          0      1024   0% /run/credentials/getty@tty1.service
tmpfs             3276936        132   3276804   1% /run/user/1000
tmpfs             3276936         36   3276900   1% /run/user/0

While technically it is possible, there are some considerations

  1. Make sure grub sees this new device, otherwise your system may become unbootable
  2. I have seen reports where grub created invalid configuration for multi-device btrfs.
  3. You should avoid using the whole device - create partition and use it.

I do not plan to change the edit partition, just adding to the file system on the root partition. Should not this be different? Also I have no real use for another mount point, I would prefer to increase the existing file system.

I do not understand what you mean here. There seems to be a language barrier. But when it is an answer to advice #3 of @arvidjaar , I assume you do not understand it.

He means that it is probably better to create one partition on the device (only a partition, no file sytem, no mount point involved, nothing, just the partition) and then use

btrfs device add /dev/nvme0n1p1 /

instead of your original suggestion.

I see, there was indeed a misunderstanding. So I will create a partition on the nvme and then add the partition to root, ok thanks.
Do I need to create a files system on the partition before adding it?

Of course not. We both said: create a partition (probably encompassing all space available). Nobody talked about creating a file system. In any case that would be overwritten as soon as you let Btrfs / take possession of it.

You seem to be confused by the fact that many so called “partition managers” not only do partitioning, but also other actions related to partitioning. Like creating file systems, creating/editing /etc/fstab entries, creating mount points. But that is all NOT partitioning.

Ok, I created the partition, added the partition to the existing fs and am currently balancing the fs. I did not restart the system, I will probably do so tomorrow. I hope that works :slight_smile:

Yes, it’ll do that.

Why?

The perfect example is How to fix GPT PMBR size mismatch? - #21 by GrandDixence2

So I rebooted my system today without any problems. Thank you

It can be the perfect example, but I can’t see why.

Ah, ok, you think about me… :rofl: no, I know how GPT or MBR works, ty. I ask about why you say

because a cursory search can’t show any problems with this, If you know some I’ll like to know it.

Partition table is customary convention to mark (some area) on disk as being in use. It avoids confusion between used disk and free disk. It avoid confusion whether metadata found on this disk belongs to the disk itself or to something this disk is just a part of. It allows for nice goodies like persistent device names or even meaningful partition description. Etc.

It is by no means mandatory. It is just a useful habit that helps to prevent some handling mistakes.

But anyway free-space is all a thing in btrfs, I expect the system can manage that.

Not the “free space” as @arvidjaar means. He means space on disk that is not in use for any organized data.

  • On a partitioned disk it is rather easy to see, because it is all space not allocated to any partition (on a MS-DOS partitioned disk also all space inside an extended partition not allocated to any secondary partition).
  • On a not partitioned disk it is difficult to find out if the bytes in the disk are organized in data of some sort, or just bytes with random (left over from earlier use) bits. One must know if there is “something” on the disk to take care of.

I mean, supporting use a whole device must include take care about this.

There is no special “supporting a whole device”. A whole device is not different from a partition or from a LVM Logical Volume, or a MD RAID device, or any other construct that is usable through block special device file. The file system just lays on /dev/whatever.

Please try to understand the difference between the mass storage containers/volumes of whatever type that are available through the block device files /dev/whatever and file systems that may be on such containers.
The file system as such has no knowledge about the type of container it is on. It only uses the space of that container. It reads/writes to an address withing the container and the Kernel translates that to the address on the device. When on whole disk, then the two addresses are the same, when on a partition, the start address of the partition must be added to it, and similar for other container types. But that is NOT the business of the file system.

Well, without ¿acrimony? it’s that the right word? :slightly_smiling_face:

Support a whole device is similar to support COW, to support RAID, to support SSD, to support anything. A filesystem can support it, or can’t support it.

Support in this context is different that “you can do it”.

I have some experience with old partitions (MBR-MS-DOS scheme) and GPT, also with LVM and Btrfs. I have a entire disk as btrfs in this desktop system and I have some VM with this setting. When you say

and I answer that I expect the filesystem do that, I hope you can point out a bug, an issue… something I don’t know that make better choice avoid that.

Well, I know it’s true you can’t boot a partitionless disk:
https://wiki.archlinux.org/title/Btrfs#Partitionless_Btrfs_disk
but I can’t find any bug or issue implying that it is a bad idea to do that.

You can have /dev/sda1 as EFI, /dev/sda2 as swap and sda3 as /, and increase the size of / adding a whole disk (i.e /dev/sdb). Works fine.

Sorry, I think the language barrier is to big here to understand the fine detail of what you try to tell me.

That depends on the nature of /. E/g/ when / is an ext2/3/4 file system this is impossible.

Well, maybe not a language barrier, but (my interpretation is) a barrier related to individual understanding of:

“the various intricacies of a storage device and the intricacies to configure it and resulting access”

BTW … the OP stated, as per above, no problems :+1:

In Spanish (Castillian) we say: Sin acritud.

But this thread is titled Adding nvme to existing btrfs filesystem :wink:

is arvidjaar who said “avoid that”, and when I asked why he linked a not related topic. But we are all talking about btrfs.