Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshots are not remounted after dataset rename #16843

Closed
tcpluess opened this issue Dec 6, 2024 · 3 comments
Closed

Snapshots are not remounted after dataset rename #16843

tcpluess opened this issue Dec 6, 2024 · 3 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@tcpluess
Copy link

tcpluess commented Dec 6, 2024

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.
@tcpluess tcpluess added the Type: Defect Incorrect behavior (e.g. crash, hang) label Dec 6, 2024
@amotin amotin changed the title Snapshots vanished after dataset rename Snapshots are not remounted after dataset rename Dec 30, 2024
@amotin
Copy link
Member

amotin commented Dec 30, 2024

I've just tried it on the latest FreeBSD/ZFS and got no problem. So either the problem is already fixed in ZFS master or it is Linux-specific.

@tcpluess
Copy link
Author

tcpluess commented Jan 2, 2025

I can confirm, it is probably fixed. I don't know why this happened and I cannot reproduce it. However after a reboot of the machine, all datasets were there again. So it was probably some sort of 'glitch'. Sorry for opening an issue too quickly!

@tcpluess tcpluess closed this as completed Jan 2, 2025
@amotin
Copy link
Member

amotin commented Jan 2, 2025

@tcpluess I had no doubts that reboot should "fix" it, since it must be just a mounting issue. But @ixhamza tested in on Linux and I tested it on FreeBSD, and both worked for us. So please report again if you hit it on ZFS 2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

2 participants