DietPi backup permission denied when trying to copy

TL;DR How to compress dietpi backup dir in order to save it somewhere else in case of needed restoration?

I did backup DietPi on ext4 USB flash drive. I’m using the drive for other stuff, so I wanted to copy the created dir to my PC running Windows, and that’s when the problem started. The partition is ext4, not supported natively by Win. I tried WSL2, but run into another issue, so decided to set up Mint inside VM.

After copying the dir to a location on Mint, I tried copying to Win and got some symlink errors. As I’m not sure will it mess up something in the file/folder structures, I tried compressing the dir in various archives, but every single time it ended up in some permission error.

First, I tried Mint’s right click compress option both with a standard account and elevated privileges with “Open as Root” option, but as soon as it starts compressing, it shows:

Error opening directory '/detpi-backup/data/var/run/user/1000/doc': permission denied

The same error appears when I tried directly from USB flash drive. Also tried zip from cli and Peazip GUI and basically got the same result.

So what would be the right process to compress it to .zip for example?

Best is to do this directly on the DietPi system once backup finished. Important is to use root user.

Is there some software already available in DietPi, or it needs to be installed? If so, which one you suggest?

You can just use tar to create an archive, which will conserve all symlinks and permissions.

tar -czvf archive_of_backup.tar.gz /path/to/dietpi-backup

Then you can copy it also onto your windows machine without loosing file structure etc.

2 Likes

It worked, thank you!

1 Like