Backing up the root user home directory

Just a quick hint…

I created a file /var/ipfire/backup/addons/includes/roothome containing these lines:

/root/
/var/ipfire/backup/addons/includes/roothome

Now I’m able to save and restore the /root directory.

Hi @redneckmother,

That approach works but there is a file called include.user in /var/ipfire/backup/ where you can add lines for each directory and/or file that you want to have included in the normal IPFire backup file.

In the same directory the file called include lists all the directories/files that are defined as standard, so you can see what is specified as standard.
The exclude and exclude.user files in that same directory list the standard files excluded and the user defined excluded directories/files.

The include.user and exclude.user files are also included in the standard backup so your choices are remembered.

Howdy, Adolf.

I became aware of the include.user and exclude.user files years ago, and my first /root backup attempt was through include.user . I found that the order of evaluation of the files precluded successful backup, as the standard exclude overrides any includes.

I considered changing the order of evaluation, but that would require careful attention to updates, and might have other, unintended, consequences. So, I “subverted” the process by creating the (fake?) roothome addon backup file.

Within the root home directory, I maintain two trees to track changes and customizations of various distribution files. One tree is used to preserve the original files, and the other holds my customizations. Scripts in /root/bin allow quick lists and comparisons of my modifications, especially after upgrades.

I subscribe to the development mailing list, and am very pleased that you are helping with development and maintenance. I am quite impressed with your contributions.

Thank you,
Paul

Hi Paul,

Thanks for the kind words. I am happy to help in whatever way I am capable of.

Interesting point about the order of the include/exclude files. I hadn’t thought of that and the limitations it would cause.

If the order was include, exclude, include.user, exclude.user I presume it would be better as the user would then have more control. Maybe this needs to be submitted as a patch to see what the feedback is.

Have a great Christmas and New Year (within the Covid restrictions)
Adolf.

1 Like

Hi Paul,

I have had a look at the backup.pl code and can see that both exclude and exclude.user are applied to the tar command at the same time and the exclusions override any files listed in include or include.user.

A solution to this would be to do a tar of the exclude and include files and then append a tar of the exclude.user and include.user files. However you can’t append to a compressed tar so the tar and tar append steps would have to be uncompressed and then compress the final combined tar file but then gzip puts .gz on the end of the file so it becomes .ipf.gz
I am still working on the best solution.

I tried to do what you explained (on a vm testbed I have setup) using the bog standard backup.pl file. Not sure if what I did was in line with what you did or not.

I created a directory under /root called bin and then populated this with a few files.
Then I added /root/bin to my include.user file.
When I ran the backup the .ipf file created had the files under /root/bin backed up. I was then able to delete the files and restore from the backup and the files under /root/bin were back in place.
My standard exclude file on my system does not have /root listed at all. If /root was in the exclude file then I could understand you having the problem because and /root/bin definition in include.user would be ignored.

Could you give more details of how you set it up with include.user so I could try and understand why it didn’t work when you ran it and try and replicate it.

I will still keep thinking about the modifications to the backup sequence because the existing approach does have some limitations.

Regards,
Adolf

Hey Adolf… thanks for chasing the issue. I hadn’t given any more thought to it, since I have a “working solution” with the “roothome addon” :-).

Honestly, I can’t recall my steps when I attempted to use “include.user”, as I have had “many sleeps” since then.

I will try to carve out some time to experiment, again.

Thanks (and please, don’t exhaust your time pursuing this)!
Paul

Hey again, Adolf.

Well, I stand corrected. After placing a single line /root/ in /var/ipfire/backup/include.user the resulting backup.pl tar (.ipf) file DID contain the entire /root directory.

Dunno what I did (or didn’t do) before; but, in the words of Emily Litella, “Never mind.”

On the other hand, it’s nice to have a roothome.ipf that contains -just- /root/* for quick and dirty recoveries… I seem to have “fat fingers” these days.

Sorry for the goose chase!
Paul