Is it OK to use _ and : in snapshot names?

Status
Not open for further replies.

NASbox

Guru
Joined
May 8, 2012
Messages
650
I know it is syntactically OK to use _ and : in snapshot names, but is it likely to break anything in FreeNAS?

I'm writing an external backup utility and I'd like to make snapshots with the following format TANK/DATASET@__BKPVOLNAME:YYMMSS-HHMMSS so that they are easy to parse/scan for. Any good reason not to do so?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Just my opinion, but I would stay away from the : .
I have been using - and _ ; they have given me zero problems but the : .
I worry too much that it could be an issue. I have not tested it.
Why do you want a : ?
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
underscores "_" should be fine but I would avoid any other special characters.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194

NASbox

Guru
Joined
May 8, 2012
Messages
650
underscores "_" should be fine but I would avoid any other special characters.

Just my opinion, but I would stay away from the : .
I have been using - and _ ; they have given me zero problems but the : .
I worry too much that it could be an issue. I have not tested it.
Why do you want a : ?

@kdragon75 , @Chris Moore @Ericloewe - Thanks much for the reply...

@Ericloewe I saw the link you referred to, and tried it, so I know it's valid. I was more concerned about it maybe being reserved by FreeNAS code or some other reason I hadn't thought of. I know ':' can't be used on Windows, but I can't think of why I would want to, but I guess there is a remote chance that it might come back an bite me in the butt.

@Chris Moore in answer to your reply my main reason was aesthetics as ':' would be used in that position in a sentence so it makes sense) and to make it super unique for parsing. TANK/DATASET@__RMDISK01:180418-123242, but I can live with TANK/DATASET@__RMDISK01_180418-123242

I'm working on a "guided" removable backup utility that uses zfs send/receive.

The process is roughly:

I load the removable drive caddy into the box, type backup in a root shell, and the backup script:
  • detects the drive
  • imports the correct pool (Config parameter maps Ser# to Pool Name)
  • based on the pool contents, the script knows what datasets to update
  • (Adding a dataset to a backup volume would be another manual script)
For example if the disk contains BACKUPDRIVE01 and the following backup datasets.
  • BACKUPDRIVE01/DATASET1
  • BACKUPDRIVE01/DATASET2
  • BACKUPDRIVE01/DATASET3
The backup script will then:
  • search the backup drive for the last snapshot of BACKUPDRIVE01/DATASET1 ("BULAST")
  • create a snapshot TANK/DATASET1@__RMDISK01_180418-123242 ("BUNEW")
  • find the snapshot corresponding to "BULAST" in TANK/DATASET1 ("BUMARK")
  • Differential zfs send TANK/DATASET1@BUMARK TANK/DATASET1@BUNEW | zfs receive BACKUPDRIVE01/DATASET1
  • repeat for BACKUPDRIVE01/DATASET2, BACKUPDRIVE01/DATASET3
  • scrub
  • list backup drive contents and provide the option to delete old snapshot(s)
    (Deletions would be a manual decision based on space consumed/space available/changes made/data importance. I would likely delete most snapshots not created by the backup script and keep the current and last markers)
  • Remove Deleted markers from TANK/DATASETn
  • ask permission to zpool export BACKUPDRIVE01 (or do it later manually if I want to do another scrub or other housekeeping on the backup)
FYI the server is mostly library/archive data that don't change too much/too often, and daily backups.
 

anmnz

Patron
Joined
Feb 17, 2018
Messages
286
Snapshot names appear as directory names under .zfs/.

A long time ago I tracked down a nasty bug triggered by timestamp-based directory names containing colons. They were ending up in environment variables like PATH and LD_LIBRARY_PATH, whose parsing they break.

So I just wouldn't do that.
 
Last edited:

NASbox

Guru
Joined
May 8, 2012
Messages
650
Snapshot namea appear as directory names under .zfs/.

A long time ago I tracked down a nasty bug triggered by timestamp-based directory names containing colons. They were ending up in environment variables like PATH and LD_LIBRARY_PATH, whose parsing they break.

So I just wouldn't do that.

Thanks... that's what I was looking for - I definately won't do it.
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
From the FreeNAS smb4.conf file:
Code:
  veto files = /.snapshot/.windows/.mac/.zfs/

So I would avoid those too.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
/.snapshot/.windows/.mac/.zfs/
Not sure exactly what you mean - can you please clarify?
Do you mean avoid the strings .snapshot .windows .mac and .zfs?
 

kdragon75

Wizard
Joined
Aug 7, 2016
Messages
2,457
Not sure exactly what you mean - can you please clarify?
Do you mean avoid the strings .snapshot .windows .mac and .zfs?
Yes, that.
 

NASbox

Guru
Joined
May 8, 2012
Messages
650
Good to know
 
Status
Not open for further replies.
Top