Funny ZFS error
Today, this post is more like a very quick note about a funny error message in the ZFS. ZFS is amazing file systems. I often mention why it is so powerful here on the blog. However, even ZFS can sometimes give us unlogic messages. Today we will look into one of them.
Recently when I was trying to remove one of my filesystems on ZFS, I received a very interesting error msg:
# zfs destroy pool/data
cannot destroy ‘pool/data’: dataset already exists
The dataset already exists? Ehm… I’m trying to remove it.What this message really means is that the dataset is somehow in use. Still, we have a couple of options that we can check and use for this issue. However, the main problem is that we don’t really know what we are looking for, so we must use multiple tools to check for all of them:
- Existing snapshots – zfs list -t snapshot
- Existing bookmarks – zfs list -t bookmark
- Clones – zfs get clones
- Ongoing receive – ps aux | grep ‘zfs recv’
- Token for resumable send – zfs get receive_resume_token
Although, it may be more useful to have all this data in one place. To get all this information in one place we can use command. The ‘zdb -d` will display information about the dataset.
# zdb -d pool | grep pool/data
Could not open pool/data/%recv, error 16
Dataset pool/data [ZPL], ID 291, cr_txg 112281839, 219K, 7 objects
In this particular situation, we had an ongoing recv process which couldn’t read the data from network. Therefore, the zdb command might be a very useful and quick option to solve such situations