Problem deleting snapshots

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
Hi,

The auto snapshot task created these snapshots without error:
# zfs list -t snapshot NAME USED AVAIL REFER MOUNTPOINT SSDpool/LongDatasetNameToPreventTooLongPaths/SMB@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 0 - 128K - SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 0 - 41.3M - SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Roms_SSD@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 0 - 22.5G - SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/StuffX_SSD@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 0 - 117K - SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Stuff_SSD@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 0 - 4.79M -

All other Snapshot tasks faild with errors like this:
cannot create snapshot 'SSDpool/LongDatasetNameToPreventTooLongPaths/JLS@SSDpool/LongDatasetNameToPreventTooLongPaths/JLS_daily-2020-06-19_03-00': trailing slash in name no snapshots were created.
Looks like using "/" in the names of the new snapshot tasks wasn't a good idea...

I can't use the GUI to delete them. I get this error:
[EFAULT] Snapshot SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 not found

I can't delete it using the shell:
# zfs destroy SSDpool/LongDatasetNameToPreventTooLongPaths/SMB@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 could not find any snapshots to destroy; check snapshot names.

I removed all slashes from the snapshot task names and hope they will run successfully tomorrow...but how to delete the old snapshot?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Have you tried escaping the slashes after the @ with backslashes? I.e., zfs destroy SSDpool/LongDatasetNameToPreventTooLongPaths/SMB@SSDpool\/LongDataSetNameToPreventTooLongPaths\/SMB-daily-2020-06-19_03-00.
 
Last edited:

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
No, but it is the same with escaped slashes:
# zfs destroy SSDpool/LongDatasetNameToPreventTooLongPaths/SMB@SSDpool\/LongDatasetNameToPreventTooLongPaths\/SMB_daily-2020-06-19_03-00 could not find any snapshots to destroy; check snapshot names.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Can you manually rm -rf it from within the /mnt/SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/.zfs/snapshot/ directory?
 

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
I change the snapshot directories to visible but even ls can't show the file right:
ls -la /mnt/SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents/.zfs/snapshot ls: SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00: No such file or directory total 0 dr-xr-xr-x+ 3 root wheel 3 Jun 19 18:02 . dr-xr-xr-x+ 3 root wheel 3 Jun 13 20:05 ..
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
How about echo *?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Also try single-quoting zfs destroy SSDpool/LongDatasetNameToPreventTooLongPaths/SMB@'SSDpool/LongDataSetNameToPreventTooLongPaths/SMB-daily-2020-06-19_03-00'.
 

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
# cd /mnt/SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents/.zfs/snapshot # echo * SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00

# zfs destroy SSDpool/LongDatasetNameToPreventTooLongPaths/SMB@'SSDpool/LongDataSetNameToPreventTooLongPaths/SMB-daily-2020-06-19_03-00' could not find any snapshots to destroy; check snapshot names.

# cd /mnt/SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents/.zfs/snapshot # rm -rf SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00
finishes without error but "echo *" still shows it
 
Last edited:

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
OK, while you're in /mnt/SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents/.zfs/snapshot, try rm -rf *.
 

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
# rm -rf * zsh: sure you want to delete the only file in /mnt/SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents/.zfs/snapshot [yn]? y # echo * SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Well, unfortunately, the only remaining thing I can see doing is to destroy and recreate the SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents dataset, which will zap all its snapshots as a side effect, and then restore its contents.
 

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
Ok, I will try that tomorrow. Atleast it is only the small SSD pool and not the big HDD one.
 

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
Deleting datasets doesn't work neither...

GUI gives me the error:
"Error deleting dataset <i>Documents</i>.
[EFAULT] Failed to delete dataset: internal error: Invalid argument"
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Yeesh. This means you’ll have to take drastic action. First, get everything off that pool. Then you’ll need to zpool export SSDpool to remove it from FreeNAS, reformat every SSD formerly in the pool, and then rebuild the pool completely.
 

Dunuin

Contributor
Joined
Mar 7, 2013
Messages
110
Do you have any hints on how to save all the jails and restore them on a freshly formated new pool? I'm running 10 jails from that pool what took me 6 months to configure and don't want to loose them.

I would do:
1.) shutdown all jails/VMs
2.) create a snapshot of all datasets from pool "SSDpool" exept for the broken ones
3.) create a copy of all files on another pool like with this for the iocage dataset: zfs send -Rv SSDPool/iocage@copy | zfs receive -F HDDpool/RPL/SSDpool/iocage
4.) export and destroy "SSDpool"
5.) reboot the system
6.) create a new pool named "SSDpool"
7.) create basic dataset structure
8.) copy everything back using "zfs send" like in step 3

But what will FreeNAS do if I delete a pool where jails/VMs are running from? I would think it is not enough to just copy all the files. I don't want to create all the jails new jails from scretch.


Could it become a problem later if I just don't use the malfunctioning datasets anymore and keep them and the defect snapshots on the pool? They only use "22.53 GiB" of the 4x 480GB raidz1 pool so the lost capacity wouldn't be the problem.


Edit:
These are the errors I get if I try to delete the datasets via cli:
root@BM-Homeserver[~]# zfs destroy SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents cannot destroy 'SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents': filesystem has children use '-r' to destroy the following datasets: SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents@SSDpool/LongDatasetNameToPreventTooLongPaths/SMB_daily-2020-06-19_03-00 root@BM-Homeserver[~]# zfs destroy -r SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents internal error: Invalid argument zsh: abort (core dumped) zfs destroy -r SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents root@BM-Homeserver[~]# zfs destroy -fr SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents internal error: Invalid argument zsh: abort (core dumped) zfs destroy -fr SSDpool/LongDatasetNameToPreventTooLongPaths/SMB/Documents
 
Last edited:

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
This thread may help with exporting jails off and then reimporting them back in, with the caveat that jail fstabs need to be restored manually afterwards.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Of course, if you're willing to live with this unkillable snapshot, that's an option too.
 
Top