Client: snapshot of root BTRFS filesystem works, snapshot of secondary BTRFS filesystem error

Hello,

Operating System: Debian Jessie
Server Version: 2.0.33
Client Version: 2.0.32

I’m having a similar issue to https://forums.urbackup.org/t/client-btrfs-snapshots-trying-to-be-made-to-wrong-filesystem/2209/1.

I have two separate btrfs filesystems, one that is my root filesystem and another mounted to /mnt/media. I’d like to backup /mnt/media, but when I add it to the list of backed-up folders I get this error:

Errors09/20/16 07:16 Creating snapshot of "/mnt/media" failed
Errors09/20/16 07:16 ERROR: cannot snapshot '/mnt/media' - Invalid cross-device link
Errors09/20/16 07:16 Create a readonly snapshot of '/mnt/media' in '/mnt/urbackup_snaps/a4799dec76a6e7617eea9c2b61cf77c0eef6f0cac8a29455'
Errors09/20/16 07:16 Creating snapshot of "media" failed.

I realize the error is due to the system trying to make a snapshot for one btrfs filesystem on a different btrfs filesystem. How can I fix the location where these temporary snapshots are being created?

1 Like

can you post your mount command output, contents of fstab and check which user runs the urbackup client? What are the permissions to the /mnt/media?

/etc/fstab:

/dev/mapper/sda2_crypt /               btrfs   defaults,subvol=__active/rootvol        0       1
# /boot was on /dev/sda1 during installation
UUID=a48f9ce5-7dcf-47cb-bc63-6fabb9d96a6a /boot           ext2    defaults        0       2
/dev/mapper/sda5_crypt none            swap    sw              0       0

#BTRFS media pool
/dev/mapper/sdb1_crypt /mnt/media       btrfs   defaults,subvol=__active/media  0       2

#BTRFS root subvolume
/dev/mapper/sda2_crypt /mnt/root_subvol btrfs   defaults        0       1
/dev/mapper/sdb1_crypt /mnt/root_storage        btrfs   defaults        0       0

Mount output:

peetipablo@flexo:~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=503544,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=809632k,mode=755)
/dev/mapper/sda2_crypt on / type btrfs (rw,relatime,ssd,space_cache)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
/dev/mapper/sda2_crypt on /mnt/root_subvol type btrfs (rw,relatime,ssd,space_cache)
/dev/sda1 on /boot type ext2 (rw,relatime)
/dev/mapper/sdb1_crypt on /mnt/root_storage type btrfs (rw,relatime,space_cache)
/dev/mapper/sdb1_crypt on /mnt/media type btrfs (rw,relatime,space_cache)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=404816k,mode=700,uid=1000,gid=1000)

Permissions:

drwxr-xr-x 1 root root 78 Sep 17 00:19 media

Urbackupclientbackend is being run by root (systemd):

peetipablo@flexo:~$ top -U root
Tasks: 253 total,   1 running, 252 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   4048156 total,  3826024 used,   222132 free,       36 buffers
KiB Swap:  1985532 total,     9820 used,  1975712 free.  2658160 cached Mem
 Unknown command - try 'h' for help 
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                                                   
    7 root      20   0       0      0      0 S   0.3  0.0  13:10.60 rcu_sched                                                                                                                                                                 
 1196 root      20   0 1051208   5244   2104 S   0.3  0.1 246:11.48 urbackupclientb

Also, here are my old prefilebackup and postfilebackup scripts that had worked before upgrading from 1.4:

peetipablo@flexo:~$ cat /etc/urbackup/prefilebackup 
#!/bin/sh
if test -d /mnt/root_subvol/__snapshots/snap_root
then
    btrfs subvolume delete /mnt/root_subvol/__snapshots/snap_root
fi
btrfs subvolume snapshot / /mnt/root_subvol/__snapshots/snap_root
if test -d /mnt/root_storage/__snapshots/snap_media
then
    btrfs subvolume delete /mnt/root_storage/__snapshots/snap_media
fi
btrfs subvolume snapshot /mnt/media /mnt/root_storage/__snapshots/snap_media

peetipablo@flexo:~$ cat /etc/urbackup/postfilebackup 
#!/bin/sh
btrfs subvolume delete /mnt/root_subvol/__snapshots/snap_root
btrfs subvolume delete /mnt/root_storage/__snapshots/snap_media

Did you look at /usr/local/share/urbackup/? (Ubuntu 16.04, UrBackup Srv 2.0.38/Clt 2.0.36)

Ahhh that’s it! Thanks so much for replying.