Total noob question about very old snapshot

Status
Not open for further replies.

marian78

Patron
Joined
Jun 30, 2011
Messages
210
Hi,

i search for answer for my total noob question. :oops:

My situation:
Have two old freenas box (with FN 9.10.2 U3 installed).

In begining, i used replications for backuping data. But after some time i decided use rsync for backup and not replications. I disabled autosnapshot task and disabled replication task.

Time is gone, some beer, some fun,....

Today i again setted new auto snapshot task (every 1 day for 1 week), but for now for protecting data on dataset.

Next i decided, that i will check, if snapshots are generate. But my blind eyes o_O saw some very old snapshots from 2015.

I want ask, it is safe to delete these snapshots without loosing data? If it is safe, how to properly delete these very old snapshots, because today i start again generate new auto-snapshots....
 
Last edited:

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Simply click destroy snapshot under volumes > snapshots. It's safe as long as you have a newer one that you've verified the integrity of. Basically, if you're sure you don't need the old snapshot it is safe to delete.
 

marian78

Patron
Joined
Jun 30, 2011
Messages
210
Thx sir for quick reply.

So, if i now create new auto snapshot for "/mnt/volume" recursive, after deleting all old snapshots from 2015, this dont delete data on volume (data from 2014 to 2017)? <--- this is very noob question...:oops:

Is there some automated way for deletion (delete all snapshots from year 2015), because i have it over 500...
 
Last edited:

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Snapshots are just the ability to rollback the filesystem, deleting files won't delete them from the snapshot, and deleting a snapshot won't delete the files, just the ability to go back to what you had in 2015. Also, you can set a lifespan on snapshots so they don't last several years like that. I don't know of a way to delete all of them at once though.
 

marian78

Patron
Joined
Jun 30, 2011
Messages
210
I'm cautious, because after deleting the snapshots i lost the data from volume. It was on the backup freenas, to which I replicated the data.
It's been a long time ago, probably on version FN9.3.1 ....
 

Vito Reiter

Wise in the Ways of Science
Joined
Jan 18, 2017
Messages
232
Don't think that's how it should work.. I don't want you to lose everything either, but I assume if you deleted a snapshot and the volume lost data, that that data wasn't in the volume anyway just held by the snapshot. Can't help much further than that.
 
Joined
Dec 2, 2015
Messages
730
Run zfs list -t snapshot to get a list of all snapshots.

zfs destroy can be used to destroy a range of snapshots, by specifying the first one, and the last one, with a "%" in between. The "-n" flag is used for a dry run, in which case it simply lists the snapshots that would be destroyed.

Example, zfs list -t snapshot shows lines like this:

Code:
backup/plex@auto-20170218.2055-1y										1.22M	  -   514G  -
backup/plex@auto-20170319.0100-1y										1.46M	  -   535G  -
backup/plex@auto-20170416.0100-1y										1.32M	  -   576G  -
backup/plex@auto-20170419.0000-30d									   2.28G	  -   607G  -
backup/plex@auto-20170420.0000-30d									   1.19M	  -   623G  -
backup/plex@auto-20170421.0000-30d									   1.05M	  -   626G  -
backup/plex@auto-20170422.0000-30d									   1.03M	  -   626G  -
backup/plex@auto-20170423.0000-30d									   5.98G	  -   645G  -
backup/plex@auto-20170424.0000-30d									   1.17M	  -   661G  -
backup/plex@auto-20170425.0000-30d									   1.08M	  -   649G  -
backup/plex@auto-20170426.0000-30d									   1.26M	  -   632G  -
backup/plex@auto-20170427.0000-30d									   1.19M	  -   639G  -


If I want to destroy the snapshots in rows 2 through 5, I would run a command like this:

zfs destroy -rvn backup/plex@auto-20170319.0100-1y%auto-20170420.0000-30d

Output:

Code:
would destroy backup/plex@auto-20170319.0100-1y
would destroy backup/plex@auto-20170416.0100-1y
would destroy backup/plex@auto-20170419.0000-30d
would destroy backup/plex@auto-20170420.0000-30d
would reclaim 4.56G


If I really wanted to destroy those snapshots, I would run that command again without the "-n" flag

zfs destroy -rv backup/plex@auto-20170319.0100-1y%auto-20170420.0000-30d

Good luck. I have used the above commands in the past, but no warranty is provided.
 

marian78

Patron
Joined
Jun 30, 2011
Messages
210
Thanks you all for the answers.
I'm still a bit lost in "snapshots" and I'm afraid to erase them. I do not want lost any data.

I guess we'll have to risk it and try some less important dataset. :rolleyes:
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
I'm afraid to erase them. I do not want lost any data.
Would it help to say that a snapshot simply records what a dataset looked like at some point in the past? Therefore, if the current state of the dataset includes all the data you want to keep, deleting a snapshot can't possibly do any harm. Conversely, if you think you might want to recover data from a snapshot of a dataset that no longer includes everything you want, deleting that snapshot could be harmful.
 
Status
Not open for further replies.
Top