Creating back ups of particular directories

Hi everyone.
I have two zfs pools on my server, pool01, and pool02, mounted on /mnt/pool01 and /mnt/pool02 respectively. I want to backup particular directories within pool01, mainly Music, Docs, and Photos. I tried to create a snap using sudo snap pool01/Music@music-backup but got an error cannot open 'pool01/Music': dataset does not exist. After some reading I found that I have to create a new volume/dataset. To test I created a folder within pool01, called “test” and some empty files, file01, file02 and file03. Then I created a pool using `sudo zfs create -p pool01/test. I’m glad I did because all the files created earlier within that test folder were gone. How do I backup those folders now. Do i:

  1. copy the files to another temporary folders
  2. create volumes on both pools for each directory ( sudo zfs create pool01/Music, sudo zfs create pool02/Music) same for photos and docs
  3. move the files from the temporary folders to newly created zfs volumes and delete temp folders
  4. create snapshots because it now all works

will this work or am i missing something? Thanks in advance

Your plan is good. I too retroactively wanted to change some big folders to datasets and this is what I did too.

The only thing I would say is, don’t copy the files from ‘Music’ to somewhere else. Music is just a folder so It’s easier/faster to just rename it. Rename it, create the dataset called ‘Music’ and then move the files from ‘music.renamed’ to ‘Music’ and you’re good to go.

thanks. Great idea. I wish I learnt earlier about zfs, it would be so much easier to keep the server in order. Half of my drives are still on ext4.

They say the best time to plant a tree is 10 years ago. The second best time is today.

2 Likes