Proxmox BTRFS - cannot change owner

piknew

New Member
Sep 2, 2022
2
1
3
Hi, I am using BTRFS in all of my installations. I wanted to use it as filesystem for virtual disks for Proxmox (I am using 7.2-11). I was able to successfully create BTRFS storage (which seems to be more similar to Directory storage - means I need to mount it separately as it is not done by proxmox like for other storage backends). So, the only difference is that Proxmox will use features of btrfs like snapshots etc. And what is important for me - scrubbing, snapshotting, cow, etc.

Unfortunately - there is one crucial feature missing (not working) - it is changing owner of disk. In my use cases sometimes I need to switch (move) disks between virtual machines. Unfortunately - it is not supported by Proxmox (there is an error displayed on UI).

Changing owner when storage backend is lvm-thin or zfs - works without any problems.

Of couse I can change the owner manually by renaming volumes/files.

Question - is there some kind of tweak required to make it working on BTRFS storage? Or simply - as btrfs is "technology preview" - feature is still on roadmap for Proxmox?


Test steps:
1. Create BTRFS volume, mount it:

[admin@PKSERVER ~]$ ssh 192.168.10.99
Linux pve 5.15.60-1-pve #1 SMP PVE 5.15.60-1 (Mon, 19 Sep 2022 17:53:17 +0200) x86_64
Last login: Fri Sep 30 12:37:50 2022 from 192.168.10.200
[root@pve ~]# cd /share/Download/
[root@pve /share/Download]# dd if=/dev/zero of=btrfs_disk.img bs=1M count=32K status=progress
34134294528 bytes (34 GB, 32 GiB) copied, 195 s, 175 MB/s
32768+0 records in
32768+0 records out
34359738368 bytes (34 GB, 32 GiB) copied, 213.634 s, 161 MB/s
[root@pve /share/Download]# losetup /dev/loop0 btrfs_disk.img
[root@pve /share/Download]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 32G 0 loop
sda 8:0 0 14.9G 0 disk
├─sda1 8:1 0 128M 0 part /boot/efi
└─sda2 8:2 0 14.8G 0 part /
sdb 8:16 0 119.2G 0 disk
└─sdb1 8:17 0 119.2G 0 part
zd0 230:0 0 16G 0 disk
└─zd0p1 230:1 0 16G 0 part
zd16 230:16 0 16G 0 disk
└─zd16p1 230:17 0 16G 0 part
zd32 230:32 0 16G 0 disk
└─zd32p1 230:33 0 16G 0 part
[root@pve /share/Download]# mkfs.btrfs -L local-btrfs /dev/loop0
btrfs-progs v5.16.2
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM /dev/loop0 (32.00GiB) ...
NOTE: several default settings have changed in version 5.15, please make sure
this does not affect your deployments:
- DUP for metadata (-m dup)
- enabled no-holes (-O no-holes)
- enabled free-space-tree (-R free-space-tree)

Label: local-btrfs
UUID: 42e2e3eb-83af-4a8f-a951-8e7ef9df5845
Node size: 16384
Sector size: 4096
Filesystem size: 32.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 256.00MiB
System: DUP 8.00MiB
SSD detected: yes
Zoned device: no
Incompat features: extref, skinny-metadata, no-holes
Runtime features: free-space-tree
Checksum: crc32c
Number of devices: 1
Devices:
ID SIZE PATH
1 32.00GiB /dev/loop0

[root@pve /share/Download]# mkdir /mnt/pve/local-btrfs
[root@pve /share/Download]# mount /dev/loop0 /mnt/pve/local-btrfs
[root@pve /share/Download]# cd /mnt/pve/local-btrfs
[root@pve /mnt/pve/local-btrfs]# df
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 3.2G 1.1M 3.2G 1% /run
/dev/sda2 ext4 15G 4.3G 9.6G 32% /
tmpfs tmpfs 16G 46M 16G 1% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 16G 0 16G 0% /tmp
/dev/sda1 vfat 127M 291K 126M 1% /boot/efi
local-zfs zfs 66G 128K 66G 1% /local-zfs
/dev/fuse fuse 128M 16K 128M 1% /etc/pve
192.168.10.200:/spool/pve nfs4 5.5T 3.3T 2.3T 59% /mnt/pve/remote-nfs
tmpfs tmpfs 3.2G 0 3.2G 0% /run/user/0
192.168.10.200:/ nfs4 5.5T 3.3T 2.3T 59% /share
/dev/loop0 btrfs 32G 3.6M 32G 1% /mnt/pve/local-btrfs
[root@pve /mnt/pve/local-btrfs]#

2. Add storage:


screenshot.211.png

3. Create two VMs (test1/901 and test2/902) with disks on local-btrfs storage. Disk files are correctly located on btrfs volume:

[root@pve /mnt/pve]# ll
total 16
drwxr-x--- 1 root root 24 Aug 11 23:02 remote-nfs
drwxr-xr-x 1 root root 34 Sep 30 15:05 local-btrfs
[root@pve /mnt/pve]# cd local-btrfs/
[root@pve /mnt/pve/local-btrfs]# ll
total 0
drwxr-xr-x 1 root root 0 Sep 30 15:05 private
drwxr-xr-x 1 root root 0 Sep 30 15:05 dump
drwxr-xr-x 1 root root 12 Sep 30 15:07 images
[root@pve /mnt/pve/local-btrfs]# cd images/
[root@pve /mnt/pve/local-btrfs/images]# ll
total 0
drwxr----- 1 root root 26 Sep 30 15:07 901
drwxr----- 1 root root 26 Sep 30 15:07 902
[root@pve /mnt/pve/local-btrfs/images]# cd 901
[root@pve /mnt/pve/local-btrfs/images/901]# ll
total 0
drwxr----- 1 root root 16 Sep 30 15:07 vm-901-disk-0
[root@pve /mnt/pve/local-btrfs/images/901]# cd ../902
[root@pve /mnt/pve/local-btrfs/images/902]# ll
total 0
drwxr----- 1 root root 16 Sep 30 15:07 vm-902-disk-0
[root@pve /mnt/pve/local-btrfs/images/902]# cd vm-902-disk-0/
[root@pve /mnt/pve/local-btrfs/images/902/vm-902-disk-0]# ll
total 0
-rw-r----- 1 root root 8589934592 Sep 30 15:07 disk.raw
[root@pve /mnt/pve/local-btrfs/images/902/vm-902-disk-0]#

4. Try to move disk (change owner) from test1 to test2. It has failed:

screenshot.215.png
 
Last edited:
yes it's simply not implemented yet for btrfs (like a few other features too), but i think yes, that could be supported by the btrfs plugin. you could open a bug report/feature request here: https://bugzilla.proxmox.com
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!