VMmanager Knowledge Base

Error when deleting dataset: dataset is busy

Error description

The problem is relevant for LXD clusters. When a dataset (data array) is deleted the dataset is busy error occurs.

The result of zfs destroy command is as follows:

zfs destroy zfs0/containers/vm-2673-vm325664
cannot destroy 'zfs0/containers/vm-2673-vm325664': dataset is busy

The dataset deletion error occurs because the snap software deployment and package management system mounts the file system "in layers". This causes the above problem. This snap error is not related with the VMmanager platform and cannot be fixed by ISPsystem.

Solution

To delete data, you need to go to snap LXD namespace and unmount the dataset.

To delete a dataset causing the problem:

  1. Connect to the node server via SSH.
  2. Go to snap LXD namespace:

    nsenter -t $(cat /var/snap/lxd/common/lxd.pid) -m
  3. Get a list of file systems:

    mount

    At the end of the list there will be entries that contain the shmounts string:

    tmpfs on /var/snap/lxd/common/shmounts type tmpfs (rw,relatime,size=1024k,mode=711)
    lxcfs on /var/snap/lxd/common/shmounts/lxcfs type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
    tmpfs on /var/snap/lxd/common/shmounts/instances type tmpfs (rw,relatime,size=100k,mode=711)

    There are also such entries at the beginning of the list, but they do not interfere with proper operation.

  4. Unmount the file systems from these entries, starting at the end of the list:

    umount <file_system>
    Comment
  5. Delete the dataset causing the problem with the command:

    zfs destroy <dataset>