Hi,
On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote:
Since I know almost no shell scripting, the rsync usb drive A
to usb drive B copy is done with a simple bash script consisting
only of the rsync backup command, with options and parameters, but
without any code to verify that usb drive B is attached.
I really should learn more shell scripting. That is something
else I will get to "Real Soon Now".
:)
If your backup script is a bash script then all you need do is put
something like:
if ! findmnt /mnt/usb-drive-b; then
echo "Mount USB drive B before running this!" >&2
exit 1
fi
why not
if ! mountpoint /mnt/usb-drive-b ; then ...
?
On Tue, May 20, 2025 at 6:00 AM Jonathan Dowland wrote:
On Tue May 20, 2025 at 6:41 AM BST, Kamil Jońca wrote:
why not
if ! mountpoint /mnt/usb-drive-b ; then ...
?
I'd not heard of either `mountpoint` or `findmnt` before. I see they're both part of util-linux, so I guess as likely as each other to be
available (which is one criterion I would use for choosing)
The approach I would have used (and it's not infallible) is
test -f /mnt/usb-drive-b/.some-file
where '.some-file' exists on the device but not on the empty mount
point.
If we're continuing this thread, why would one want to use
/mnt/usb-drive-b for mounting a usb drive instead of automatically
mounting to
/media/$USER/filesystem-UUID ?
On Tue, May 20, 2025 at 9:33 AM wrote:
What do you do if you get two USBs containing file systems with
the same UUID?
Is that possible? I suppose it is.. so I'd go looking for how to
change the UUID for one of the usb drives.
On Tue, May 20, 2025 at 6:00 AM Jonathan Dowland wrote:
On Tue May 20, 2025 at 6:41 AM BST, Kamil Jońca wrote:
why not
if ! mountpoint /mnt/usb-drive-b ; then ...
?
I'd not heard of either `mountpoint` or `findmnt` before. I see they're both part of util-linux, so I guess as likely as each other to be
available (which is one criterion I would use for choosing)
The approach I would have used (and it's not infallible) is
test -f /mnt/usb-drive-b/.some-file
where '.some-file' exists on the device but not on the empty mount
point.
If we're continuing this thread, why would one want to use
/mnt/usb-drive-b for mounting a usb drive instead of automatically
mounting to
/media/$USER/filesystem-UUID ?
I used /mnt/backup because I only wanted the partition mounted while the backup was running (it was one of several on that physical drive). The
backup script did the mount/rsync/unmount as part of the execution.
Really, the only point of this was a "well, I can't accidentally delete
it if it's not mounted" train of thought.
On Tue, May 20, 2025 at 10:08 AM tomas wrote:
On Tue, May 20, 2025 at 09:45:11AM -0400, Lee wrote:
On Tue, May 20, 2025 at 9:33 AM wrote:
[...]
What do you do if you get two USBs containing file systems with
the same UUID?
Is that possible? I suppose it is.. so I'd go looking for how to
change the UUID for one of the usb drives.
If you copy a whole file system (e.g. with dd), the UUID will
travel with it. It's just data, after all. Sometimes you want it,
sometimes not.
If I'm copying from one usb to another it seems like I really would
not want the same UUID on both usb sticks.
And it sounds like it would be fairly easy to fix the duplicate UUID problem..
If you then modify one file system's content, you'll get two
file systems with the same UUID and... with different data =:-o
The horrors :)
Remember: the second "U" in "UUID" is a lie ;-)
uhmm... to remember something one first has to know/learn it.
I'm asking all these ignorant questions because I'm not there yet.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 151:38:27 |
Calls: | 10,383 |
Files: | 14,054 |
Messages: | 6,417,807 |