Jump to content
  • ZFS Snapshot destroy - dataset is busy - Docker


    unr41dus3r
    • Solved Minor

    Hi everyone,

     

    i dont know if this is a Unraid, Docker or Borgmatic problem. (Using RC8)

     

    I want todo the following.

    • Create ZFS Snapshot of dataset appdata for borgmatic
      • cache-mirror/appdata
      • zfs snapshot cache-mirror/appdata@borgmatic
    • Mount the complete cache-mirror pool into borgmatic container
      • /mnt/cache-mirror to /mnt/cache-mirror
    • Try to backup /mnt/cache-mirror/appdata/.zfs/snapshot/borgmatic
      • Problem: If Container is started BEFORE the snapshot is created, i recieve this error when i want to access the folder:
        • dir_open: [Errno 40] Symbolic link loop: 'borgmatic'
          • this happens with the 'ls' command and with borgmatic
      • Solution: If Container is started AFTER the Snapshot is created, it works fine
    • Next problem: Every time the container is started AFTER the Snapshot is created (Solution), i cant delete the snapshot afterwards. It doesnt matter if the borgmatic container is stopped or not.
      • cannot destroy snapshot cache-mirror/appdata@borgmatic: dataset is busy
        • Sometimes (couldnt reproduce it every time) when the container is started BEFORE the snapshot is created (when access in the container is not working to the snapshot (.zfs folder), a snapshot destroy is possible.

     

    It is possible i use the snapshot command wrong or should do this another way, but because its ZFS maybe there is another problem in the RCs

     

     @JorgeB sorry for pinging you directly but we communicated already in the RC7 thread and maybe this is related to the other dataset is busy problems.

     

    Edit:

    Can you tell me how i could force remove the snapshot or unmount? I do every time a reboot if the error happens because the force unmount or force delete snapshot commands dont work for me.

     

     

     

     




    User Feedback

    Recommended Comments

    Not sure what the problem could be, but you could try send/receive that snapshot to a new dataset and the then run the container on that dataset, e.g.:

    zfs snapshot cache-mirror/appdata@borgmatic
    zfs send cache-mirror/appdata@borgmatic | zfs receive cache-mirror/borgmatic

     

    Then run the container on that dataset instead, you don't need to point to the snapshot since the dataset will have the same data, so instead of:

    /mnt/cache-mirror/appdata/.zfs/snapshot/borgmatic

    use

    /mnt/cache-mirror/borgmatic

     

    Once the backup is done try deleting the dataset cache-mirror/borgmatic

     

     

     

     

    Link to comment

    Ok, tested the following.

     

    Working:

    • Create Snapshot
    • Start Container
    • Stop Container
    • Destroy Snapshot

     

    Not Working:

    • Create Snapshot
    • Start Container
      • ls /mnt/cache-mirror/appdata/.zfs/snapshot/borgmatic
        • ls: /mnt/cache-mirror/appdata/.zfs/snapshot/borgmatic/: Symbolic link loop
    • Stop Container
    • Destroy Snapshot
      • cannot destroy snapshot cache-mirror/appdata@borgmatic: dataset is busy

     

     

    Trying to fix the problem:

    • Disable Docker
      • Still Unable to delete Snapshot

     

    • Stop Array
    • Start Array (still stopped docker)
      • Destroy is working

     

    Looks like an process is stuck?

     

    Next step i will try your suggestion

     

    Link to comment

    mmmh, i am afraid this is not what i want to achieve?

     

    zfs send cache-mirror/appdata@borgmatic | zfs receive cache-mirror/borgmatic

     

    The process is now running but i am afraid now it is copying all data from the snapshot time to a cache-mirror/borgmatic dataset?

    I dont want to clone the complete folder. My appdata folder has 150GB ^^

     

    This is contraproductive, the backup would only copy the delta and now i would clone the complete directory for every backup.

    Still will test it, if it works this way, it still needs some time to copy the data

    Edited by unr41dus3r
    Link to comment
    19 minutes ago, unr41dus3r said:

    The process is now running but i am afraid now it is copying all data from the snapshot time to a cache-mirror/borgmatic dataset?

    Yes, but unless I missed something you were also snapshotting the complete appdata folder before:

    zfs snapshot cache-mirror/appdata@borgmatic

    and than backing up the complete snapshot:

    Quote

    Try to backup /mnt/cache-mirror/appdata/.zfs/snapshot/borgmatic

    Or did I misunderstood?

     

    Link to comment
    9 minutes ago, JorgeB said:

    Yes, but unless I missed something you were also snapshotting the complete appdata folder before:

    zfs snapshot cache-mirror/appdata@borgmatic

    and than backing up the complete snapshot:

    Or did I misunderstood?

     

     

    Yeah i did a complete snapshot of the appdata folder but this means, the state is frozen and all new files are written additional.

     

    With the send | recieve command it copys the complete frozen state into a new dataset.

    So i have the cache-mirror/appdata dataset incl. snapshot and now a new dataset cache-mirror/borgmatic

     

    I dont know how zfs exactly works with compression and dedup in this situation but now it uses 2 times the space.

    Also it did a more or less copy operation when i checked the saturation of my SSDs.

     

    Edit:

    With this method, i dont recieve the error with the symlink loop / when trying to destroy that the dataset is busy.

     

    But the problem is still its to much overhead as i understand.

     

    Example:

    • cache-mirror/appdata = 150GB
    • cache-mirror/appdata@borgmatic = Snapshot has only some MB or maybe 1GB

     

    • Now i start abackup of the snapshot (frozen state of the specific time)

     

    When i issue the send | recieve command i need much more space and time/performance

    • cache-mirror/appdata = 150GB
    • cache-mirror/appdata@borgmatic = 1GB (for example)
    • cache-mirror/borgmatic = 150GB

     

    So i need double the space and it needs time to the copy data.

     

    I hope it is understandable what i mean.

    Edited by unr41dus3r
    Link to comment

    You could create a child dataset just for borgmatic, then snapshot and send/receive only that dataset.

    Link to comment
    25 minutes ago, JorgeB said:

    You could create a child dataset just for borgmatic, then snapshot and send/receive only that dataset.

     

    Could you explain what you mean with child dataset? I dont exactly know how to do this.

     

    About the loop error message in an container, is this expected or is their something wrong?

    Link to comment

    On second though I think a zfs clone would be more efficient for what you need, assuming it still works:

    zfs snapshot cache-mirror/appdata@borgmatic
    zfs clone cache-mirror/appdata@borgmatic cache-mirror/borgmatic

     

    This won't take any extra space unless source dataset is changed, same as a snapshot.

     

    Then work with /mnt/cache-mirror/borgmatic and once done destroy the clone and the snapshot:

    zfs destroy cache-mirror/borgmatic
    zfs destroy cache-mirror/appdata@borgmatic

     

    • Like 1
    • Upvote 1
    Link to comment

    Another interesting find.

     

    If i create a snapshot in cache-mirror@borgmatic and the snapshot dataset is stuck.

    I recieve the error which i described in the RC7 thread when stopping the array/ rebooting

     

    Jun 13 15:25:22 tower emhttpd: shcmd (9223): /usr/sbin/zpool export cache-mirror
    Jun 13 15:25:22 tower root: cannot unmount '/mnt/cache-mirror': pool or dataset is busy
    Jun 13 15:25:22 tower emhttpd: shcmd (9223): exit status: 1

     

     

    If i create a snapshot in cache-mirror/appdata@borgmatic and the snapshot dataset is stuck.

    It is possible to stop the array normally.

    Link to comment
    1 minute ago, JorgeB said:

    On second though I think a zfs clone would be more efficient for what you need, assuming it still works:

    zfs snapshot cache-mirror/appdata@borgmatic
    zfs clone cache-mirror/appdata@borgmatic cache-mirror/borgmatic

     

    This won't take any extra space unless source dataset is changed, same as a snapshot.

     

    Then work with /mnt/cache-mirror/borgmatic and once done destroy the clone and the snapshot:

    zfs destroy cache-mirror/borgmatic
    zfs destroy cache-mirror/appdata@borgmatic

     

     

    Thanks will try it later

    Link to comment
    4 hours ago, JorgeB said:

    On second though I think a zfs clone would be more efficient for what you need, assuming it still works:

    zfs snapshot cache-mirror/appdata@borgmatic
    zfs clone cache-mirror/appdata@borgmatic cache-mirror/borgmatic

     

    This won't take any extra space unless source dataset is changed, same as a snapshot.

     

    Then work with /mnt/cache-mirror/borgmatic and once done destroy the clone and the snapshot:

    zfs destroy cache-mirror/borgmatic
    zfs destroy cache-mirror/appdata@borgmatic

     

     

    This works great, this is the solution i was looking for!

    Still a little bit strange the stuck dataset if you use a path in a container

    Edited by unr41dus3r
    • Like 1
    Link to comment


    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Restore formatting

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Status Definitions

     

    Open = Under consideration.

     

    Solved = The issue has been resolved.

     

    Solved version = The issue has been resolved in the indicated release version.

     

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

    Retest = Please retest in latest release.


    Priority Definitions

     

    Minor = Something not working correctly.

     

    Urgent = Server crash, data loss, or other showstopper.

     

    Annoyance = Doesn't affect functionality but should be fixed.

     

    Other = Announcement or other non-issue.

×
×
  • Create New...