Assistance with setting up storage pool

Hello,

I am a relative newbie to linux administration, so please excuse my ignorance. I’m trying to setup a second LXC storage pool.

After running

lxc storage create storage_pool_2 btrfs source=/dev/sda size=64GB

I get the error message

Error: Failed to create the BTRFS pool: /dev/sda appears to contain a partition table (dos).
ERROR: use the -f option to force overwrite of /dev/sda
btrfs-progs v4.15.1
See http://btrfs.wiki.kernel.org for more information.

Here is what lsblk is showing:

NAME                             FSTYPE        SIZE MOUNTPOINT                         LABEL
loop0                            btrfs          81G /var/lib/lxd/storage-pools/default default
sda                                          446.6G                                    
└─sda1                           LVM2_member 446.6G                                    
  ├─marmoset--eugo--2--vg-root   ext4        445.7G /                                  
  └─marmoset--eugo--2--vg-swap_1 swap          980M [SWAP]      

My lxc storage list is just from the default lxc setup:

+---------+-------------+--------+--------------------------------+---------+
|  NAME   | DESCRIPTION | DRIVER |             SOURCE             | USED BY |
+---------+-------------+--------+--------------------------------+---------+
| default |             | btrfs  | /var/lib/lxd/disks/default.img | 26      |
+---------+-------------+--------+--------------------------------+---------+

Could someone please tell me what am I doing wrong here? (I haven’t tried the -f option yet, as I’m hesitant to force anything to do with the drive when I don’t understand what it does. Just in case it leads to loss of data.)

When passed a block device, LXD expects that it is fully available, as in unformatted.

In your case, you appear to be actively using /dev/sda so you can’t have LXD use it directly.
You appear to be using LVM, so one option would be to create a dedicated LV for LXD, then pass the /dev/mapper/… entry as source= to LXD.

OK, I’ll read up on LVM.

Just to get a better understanding, I’m wondering why LXC didn’t have this problem when it created the ‘default’ pool? Wasn’t /dev/sda already being used then, and the ‘default’ pool created out of that space?

No, the default pool as is visible in the source field, isn’t backed by a physical disk/partition but by a file called default.img instead.