billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.49k stars 327 forks source link

Use temporary directories for mounting #102

Closed matthijskooijman closed 3 months ago

matthijskooijman commented 3 years ago

This creates a temporary directory for src and dst mounts, rather than hardcoding /mnt/clone and /mnt/clone-src. This allows running the script twice in parallel, without conflicts.

To prevent littering tons of directories around, automatic cleanup of these directories is added (which has the added advantage of also unmounting and cleaning up when the script is somehow interrupted or fails in an unexpected way).

This also changes the interface to the rpi-clone-setup script slightly, since that also used to hardcode this directory name.

See commit messages for some more details.

matthijskooijman commented 3 months ago

I've resubmitted this PR in a more actively maintained fork: https://github.com/geerlingguy/rpi-clone/pull/17