DietPi Sync Request

Suggestions for features and software you would like to see in DietPi, goes here.
midnightwatcher
Posts: 54
Joined: Mon Dec 26, 2016 6:54 am

DietPi Sync Request

Post by midnightwatcher » Mon Feb 18, 2019 11:58 pm

I know there is an option to perform a Dry Run, but when performing an actual sync would it be possible to first perform a quick comparison between sync source and sync destination and then have a simple prompt stating the following:

"Number of files to be deleted: X
Number of files to be copied: X

Do you wish to continue? y/n"

It would be nice to have a simple comparison with a y/n prompt before the sync/backup instead it having to do a full fledged Dry Run.

User avatar
MichaIng
Site Admin
Posts: 1749
Joined: Sat Nov 18, 2017 5:21 pm

Re: DietPi Sync Request

Post by MichaIng » Thu Feb 21, 2019 2:12 pm

DietPi-Sync already performs a dry run before the actual sync to check sufficient disk space. But the actual sync is done automatically if disk space test succeeds.

However we could indeed merge both:
- Only offer sync, but add info that a dry run with dedicated question to go on is done.
- Do dry run, show log to user and allow to continue or cancel. But this would be a full log. Perhaps we could add a summary as you suggested to the top of the shown log. But exactly those numbers are already printed at the end of the log by rsync.
- However running the script via input dietpi-sync 1 of course would still automate the sync and skip the user prompt, instead exit automatically with error, if free space check did not succeed.

midnightwatcher
Posts: 54
Joined: Mon Dec 26, 2016 6:54 am

Re: DietPi Sync Request

Post by midnightwatcher » Thu Feb 21, 2019 6:17 pm

I like the idea of merging them both. If space is deemed sufficient, the user prompt could be something like:

"Number of files to be deleted: X
Number of files to be copied: X

Do you wish to continue? <Yes> <No> <View Log>"

If the user chooses to View Log, only then would DietPi-Sync run a full log (I'm assuming this would take a little more time than a simple files to be copied and files to be deleted comparison).

User avatar
MichaIng
Site Admin
Posts: 1749
Joined: Sat Nov 18, 2017 5:21 pm

Re: DietPi Sync Request

Post by MichaIng » Thu Feb 21, 2019 6:25 pm

The log is generated anyway. We use it to determine required disk space. Showing it does not take any recognisable time, but yeah perhaps distracts user, so only sum up the most important info by default.

midnightwatcher
Posts: 54
Joined: Mon Dec 26, 2016 6:54 am

Re: DietPi Sync Request

Post by midnightwatcher » Thu Feb 21, 2019 10:13 pm

Sounds good. It would help people like me who are sometimes too lazy to do a dry run from accidentally deleting the destination drive. (Last week my source drive wasn't mounted properly like I thought. DietPi-Sync thought it was empty and deleted all 7 terabytes of the destination drive. After I figured out what happened I mounted the source drive and did a sync, which took nearly two days to complete).

:o

User avatar
MichaIng
Site Admin
Posts: 1749
Joined: Sat Nov 18, 2017 5:21 pm

Re: DietPi Sync Request

Post by MichaIng » Thu Feb 21, 2019 10:17 pm

Ui jep. Perhaps we should also add a check, if the source dir is empty, which is in very most cases not what users want to sync :o.

midnightwatcher
Posts: 54
Joined: Mon Dec 26, 2016 6:54 am

Re: DietPi Sync Request

Post by midnightwatcher » Thu Feb 21, 2019 10:50 pm

Excellent idea.

midnightwatcher
Posts: 54
Joined: Mon Dec 26, 2016 6:54 am

Re: DietPi Sync Request

Post by midnightwatcher » Thu Feb 28, 2019 3:09 pm

Should I add this to FeatHub?

User avatar
MichaIng
Site Admin
Posts: 1749
Joined: Sat Nov 18, 2017 5:21 pm

Re: DietPi Sync Request

Post by MichaIng » Thu Feb 28, 2019 3:22 pm

Not required. I will add this with v6.22:
- Empty source check
- Prompt info after dry run before real sync with rough summary and options to show full sync log, cancel or continue with real sync.
- Remove dedicated dry run option instead.
- When calling automated sync with cmd argument, do real sync directly, in case dry run succeeded and drive space + empty source checks passed.

https://github.com/MichaIng/DietPi/issues/2602

User avatar
MichaIng
Site Admin
Posts: 1749
Joined: Sat Nov 18, 2017 5:21 pm

Re: DietPi Sync Request

Post by MichaIng » Sat Mar 02, 2019 5:53 pm

@midnightwatcher
I finished the request, including some other minor fixes and enhancements. You can test the new script if you want:

Code: Select all

wget https://raw.githubusercontent.com/MichaIng/DietPi/dev/dietpi/dietpi-sync -O /DietPi/dietpi/dietpi-sync
chmod +x /DietPi/dietpi/dietpi-sync
The changes do not depend on other changes made with v6.22 or even this PR, so you can test this individually. If you face any error or quirks, please report back.

You can always revert to current stable version:

Code: Select all

wget https://raw.githubusercontent.com/MichaIng/DietPi/master/dietpi/dietpi-sync -O /DietPi/dietpi/dietpi-sync
chmod +x /DietPi/dietpi/dietpi-sync

Post Reply