Attempts to LXD Init and create Storage Pool on 2nd HD fails

I installed a new SSD on my Ubuntu 20.04 system and want to reinstall LXD on my host and have it create.

So I did the following:

$ sudo snap install lxd
lxd 4.20 from Canonical✓ installed

$ sudo lxd init

Would you like to use LXD clustering? (yes/no) [default=no]:
Do you want to configure a new storage pool? (yes/no) [default=yes]:
Name of the new storage pool [default=default]:
Name of the storage backend to use (lvm, zfs, ceph, btrfs, dir) [default=zfs]: btrfs
Create a new BTRFS pool? (yes/no) [default=yes]:
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: yes
Path to the existing block device: /dev/sdd
Would you like to connect to a MAAS server? (yes/no) [default=no]:
Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
Would you like the LXD server to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]:
Port to bind LXD to [default=8443]:
Trust password for new clients:
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
Would you like a YAML “lxd init” preseed to be printed? (yes/no) [default=no]:

After a few seconds it returns with this error:

Error: Failed to create storage pool ‘default’: Failed to format block device: Failed to run: mkfs.btrfs -L default /dev/sdd: /dev/sdd appears to contain a partition table (gpt).

ERROR: use the -f option to force overwrite of /dev/sdd

Before I ran the above I had used FDISK to delete any partition table on that disk (/dev/sdd)

So I am not sure why LXD INIT thinks there is a GPT partition table on it?


It’s not LXD, it’s btrfs giving you that error.

If you’re sure that disk doesn’t contain anything, I’d recommend doing:
dd if=/dev/zero of=/dev/sdd bs=4M count=100 which will completely wipe clean the first 400MB of the drive and any partition label that may be left there.

Stephane… that fixed it?

I had thought using FDISK would remove that 1st 400MB too since I told it to delete all partitions (-d)
but another lesson learned.


No, all that happens when you wipe a partition table is the table itself is removed (first 512 bytes to 4K or so of the disk), the rest is left completely intact.

I wouldn’t recommend doing this for fun, but if you were to delete your partition table, then go and re-create it absolutely identically. You won’t actually lose any data and everything will mount just fine.