Jump to content

In about a day or so I will finally have something for the first time - a complete 2nd copy of all my data! That's still in the process of copying over from one NAS to another.

 

So the next part of my backup plan is to look at snapshots.

 

Firstly to check I understand how it works in ZFS, take the following scenario.

 

Day 1: I write files A, B, and C, then create a snapshot1 at the end of the day. So these will always be available as long as snapshot1 exists, even if I modify or delete them, the snapshotted version can be pulled from the snapshot. At this point, no extra space is taken.

Day 2: I write file D, delete file A, create snapshot2. If I understand correctly, file A will still be taking up space as it resides in the snapshot from day 1.

Day 3: I modify file B, and create snapshot3. This would freeze this version of file B, but the extra space it reserves is only the changes in file B, since original B is still in snapshot1.

Day 4: I delete snapshot1. File A is now gone and its space is freed up. The original file B is no more, but the modified version remains in snapshot3. The space unique to original file B that is not in modified B is freed.

 

Q1: Is above example correct?

 

Q2: Any suggested tools to help with creating/managing snapshots on Unraid? Note my NAS currently aren't on 24/7 so schedules wont work. I'd have to manually run them as needed.

 

Q3: Is there best practice in creating snapshots? I don't mean when, but how big in scope? Let's say for now, I want to snapshot EVERYTHING on the NAS. 99+% of it will never change so it shouldn't cost increased capacity. I see this as giving me a kind of undelete fallback in case something goes wrong at user level. Do I just say Snapshot everything, or is it better to break it down into smaller units? Note as I'm using Unraid in hybrid ZFS mode, the biggest ZFS unit is one disk.

 

Q4: One of my NAS uses XFS, not ZFS, as it was originally created way before ZFS support existed. In a quick look, I don't see the same snapshot features on XFS. Since it is in Unraid mode, switching it to ZFS a drive at a time would be a bit of a pain but can be done without rebuilding the array from scratch or losing protection. It would just take a lot of time and file moving which can be largely automated. I could also enable ZFS file compression at the same time. Any reason I shouldn't do this, or other better ideas?

Gaming system: R7 7800X3D, Asus ROG Strix B650E-F Gaming Wifi, Thermalright Phantom Spirit 120 SE ARGB, Corsair Vengeance 2x 32GB 6000C30, MSI Ventus 3x OC RTX 5070 Ti, MSI MPG A850G, Fractal Design North, Samsung 990 Pro 2TB, Alienware AW3225QF (32" 240 Hz OLED)
Productivity system: i9-7980XE, Asus X299 TUF mark 2, Noctua D15, 64GB ram (mixed), RTX 4070 FE, NZXT E850, GameMax Abyss, Samsung 980 Pro 2TB, iiyama ProLite XU2793QSU-B6 (27" 1440p 100 Hz)
Gaming laptop: Lenovo Legion 5, 5800H, RTX 3070, Kingston DDR4 3200C22 2x16GB 2Rx8, Kingston Fury Renegade 1TB + Crucial P1 1TB SSD, 165 Hz IPS 1080p G-Sync Compatible

Link to comment
https://linustechtips.com/topic/1628923-snapshotting-thoughts/
Share on other sites

Link to post
Share on other sites

48 minutes ago, porina said:

Day 2: I write file D, delete file A, create snapshot2. If I understand correctly, file A will still be taking up space as it resides in the snapshot from day 1.

Yes the data usage size is then currently A+B+C+D

 

48 minutes ago, porina said:

Day 3: I modify file B, and create snapshot3. This would freeze this version of file B, but the extra space it reserves is only the changes in file B, since original B is still in snapshot1.

Yes, only the changed blocks (the diff between B1 and B2) will increase the used storage capacity

 

48 minutes ago, porina said:

Day 4: I delete snapshot1. File A is now gone and its space is freed up. The original file B is no more, but the modified version remains in snapshot3. The space unique to original file B that is not in modified B is freed.

Correct, all files that reference underlying storage blocks will remain.

 

48 minutes ago, porina said:

Q1: Is above example correct?

Yes.

 

48 minutes ago, porina said:

Q2: Any suggested tools to help with creating/managing snapshots on Unraid? Note my NAS currently aren't on 24/7 so schedules wont work. I'd have to manually run them as needed.

Don't know about Unraid but you can still use cron schedules to create snapshots. Instead of basic commands executed by cron you can use a script with intelligent logic in it and just have it run every 5-15 minutes and if a logic rule is met then a snapshot is created or deleted.

 

I.e. If it is currently 0 hour then do a snapshot, if it is not 0 hour but there has not been a snapshot within 3 hours create one. If more than 24 snapshots exist delete oldest snap etc etc.

 

48 minutes ago, porina said:

Q3: Is there best practice in creating snapshots? I don't mean when, but how big in scope? Let's say for now, I want to snapshot EVERYTHING on the NAS. 99+% of it will never change so it shouldn't cost increased capacity. I see this as giving me a kind of undelete fallback in case something goes wrong at user level. Do I just say Snapshot everything, or is it better to break it down into smaller units? Note as I'm using Unraid in hybrid ZFS mode, the biggest ZFS unit is one disk.

General rule is more granular, aka more taken, within working/waking hours and less/none outside of that i.e. 1 every hour between 8am to 5pm then every 4 hours.

 

Since ZFS and snapshots are all metadata based there is almost no penalty or drawback to taking snapshots and more of them. At home you shouldn't hit any scaling limits that would start to cause problems. Just keep it sensible but you also don't need to be worrying about taking too many either. Simple is good.

 

48 minutes ago, porina said:

Q4: One of my NAS uses XFS, not ZFS, as it was originally created way before ZFS support existed. In a quick look, I don't see the same snapshot features on XFS. Since it is in Unraid mode, switching it to ZFS a drive at a time would be a bit of a pain but can be done without rebuilding the array from scratch or losing protection. It would just take a lot of time and file moving which can be largely automated. I could also enable ZFS file compression at the same time. Any reason I shouldn't do this, or other better ideas?

The only reason not to is the time, reduced resiliency risk during the conversion and if the process goes wrong for some reason. Unless there is a specific benefit to converting from XFS to ZFS then I wouldn't do it without a secondary copy of the data "just in case".

Link to comment
https://linustechtips.com/topic/1628923-snapshotting-thoughts/#findComment-16842572
Share on other sites

Link to post
Share on other sites

3 hours ago, leadeater said:

The only reason not to is the time, reduced resiliency risk during the conversion and if the process goes wrong for some reason. Unless there is a specific benefit to converting from XFS to ZFS then I wouldn't do it without a secondary copy of the data "just in case".

The slightly bigger picture:

NAS1 - "main" NAS where primary copy of stored files live. Unraid with individual drives formatted XFS. 1 drive redundancy. Currently have enough spare capacity to move data off a single drive, reformat that now empty drive to ZFS. Move data from another drive onto it, repeat until all converted to ZFS. I will always retain 1 disk redundancy during this time (unless any disk fails), and will still have another copy of all files on NAS2.

 

NAS2 - "backup" NAS, exists primarily to hold a 2nd copy of whatever is on NAS1. No redundancy. Individual drives formatted ZFS in Unraid array. I decided to not have redundancy on this one since if a drive fails, surviving drives will still have their data intact. As long as I have sufficient capacity, re-running a backup from NAS1 would restore any lost files.

 

The "why" is ideally I want snapshotting on NAS1, not NAS2 which is the one that currently can support it. I can't switch their roles for various technical limitations that can only be solved by throwing significant time and money at it.

 

Reasons for switching FS: gain ability to use ZFS snapshots, and also filesystem level compression. Which I found I forgot to turn on on some drives on NAS2, and have now corrected. If it gains me a bit more effective disk capacity transparently I'll take it. It would take roughly a day to convert each disk, with moving files in between. 

Gaming system: R7 7800X3D, Asus ROG Strix B650E-F Gaming Wifi, Thermalright Phantom Spirit 120 SE ARGB, Corsair Vengeance 2x 32GB 6000C30, MSI Ventus 3x OC RTX 5070 Ti, MSI MPG A850G, Fractal Design North, Samsung 990 Pro 2TB, Alienware AW3225QF (32" 240 Hz OLED)
Productivity system: i9-7980XE, Asus X299 TUF mark 2, Noctua D15, 64GB ram (mixed), RTX 4070 FE, NZXT E850, GameMax Abyss, Samsung 980 Pro 2TB, iiyama ProLite XU2793QSU-B6 (27" 1440p 100 Hz)
Gaming laptop: Lenovo Legion 5, 5800H, RTX 3070, Kingston DDR4 3200C22 2x16GB 2Rx8, Kingston Fury Renegade 1TB + Crucial P1 1TB SSD, 165 Hz IPS 1080p G-Sync Compatible

Link to comment
https://linustechtips.com/topic/1628923-snapshotting-thoughts/#findComment-16842617
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×