Skip to content

Snapshots are not remounted after dataset rename #16843

@tcpluess

Description

@tcpluess

System information

Type Version/Name
Distribution Name Linux 6.8.12-4-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-4 (2024-11-06T15:04Z) x86_64 GNU/Linux
Distribution Version see above
Kernel Version see above
Architecture see above
OpenZFS Version zfs-2.2.6

Describe the problem you're observing

About a year ago, I created a ZFS datashet that is since then used as a network share. It works well, and I have implemented regular snapshots such that accidental changes can easily be reverted. It works very good.
However, due to some organizational changes, it was necessary to rename the dataset that I used. So I had the dataset tank/data, and of course, there are a lot of snapshots, e.g. tank/data@2024-04-04-1800 for example, or tank/data@backup. I have previously verified that the snapshots work properly and they do. However, I had now to rename the dataset to tank/projects. According to zfs list -t snap, all snapshots are still there, as I expected, and the data in the dataset is also still accessible; however, when I cd into one of the snapshots, e.g. cd /tank/projects/.zfs/snapshot/backup, where should be visible the contents of this snapshot, it is simply empty. However, according to zfs list -t snap, this particular snapshot consumes 872GB of data, but the snapshot folder is just empty!

Also snapshots that are newly created also appear completely empty.

However, I am not 100% sure what is going on. I can manually mount the snapshot as follows

mount -t zfs tank/projects@backup /tmp/test

and then when viewing /tmp/test I can see the snapshot's contents. So it somehow still works, but it looks to me like the automatical mounting of the snapshots is now broken, due to the renaming of the snapshots.

Can I somehow restore the old behaviour, such that the ZFS snapshots are again automatically mounted?

Describe how to reproduce the problem

  1. Create a dataset, e.g. tank/data. Put some files in it. Make a snapshot, i.e. tank/data@snap.
  2. Verify the snapshot has worked: ls -al /tank/data/.zfs/snapshot/snap shows the files that were present at the time the snapshot was taken.
  3. Rename the dataset, e.g. zfs rename tank/data tank/newdata.
  4. Try to look at the snapshot's contents: ls -al /tank/newdata/.zfs/snapshot/snap.
  5. The files seem not to be present and the snapshot cannot be accessed therefore.
  6. However, when manually mounting, the snapshots can be accessed. Make a temporary folder: mkdir -p /tmp/test.
  7. Mount the snapshot: mount -t zfs tank/newdata@snap /tmp/test.
  8. Look at the snapshot contents: ls -al /tmp/test shows the contens of the snapshot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions