[nSLUG] Thumbdrive filenames problem

Dave Flogeras dflogeras2 at gmail.com
Wed Aug 26 06:39:15 ADT 2015


On Wed, Aug 26, 2015 at 3:17 AM, Mike Spencer <mspencer at tallships.ca> wrote:

> Now working on a shell script that will mount the USB drive, verify
> its identity, then rsync ~/ to a dir there.
You should peek into mounting your drive in your script by filesystem
UUID instead of /dev/sdX1.  This will eliminate the case when your
drive might be sdc instead of sdb because you had another thumbdrive
plugged in. It also _is_ the verification since the UUID will only
change if you reformat the filesystem.  Arguable you could partition
using GPT and then use the partition UUID which wont even change if
you reformat, but that might be too heavy a solution.  Also your older
machine might not support GPT.  You may need to search the exact
details but I think you read the UUID with:

blkid -p /dev/sdX1

Then see man mount for manually mounting by UUID.  Alternatively you
could add an entry to fstab.  Just put:
UUID="12345678-1234-1234......"     /my/mountpoint  ext3   blah,blah  0 0

Instead of /dev/sdb1 or the likes.



> I don't see that rsnapshot's link trick would get around that.
Unfortunately.  That is a weakness of rsync, it does not see file moves.



> I'll see how my shell script goes.  If it's problematic, I'll look at
> rsnapshot (which I just dl'd while writing this.)
rsnapshot, and most likely a lot of incremental solutions including
(I'd bet anyway) osx time machine, heavily draw inspiration from this
classic:

http://www.mikerubel.org/computers/rsync_snapshots/

He explains exactly what is going on, very useful if you want to roll
your own.  Just mind that it is a little dated.  It is still correct
and works, I just always read critically when a document references
the 2.4 kernel :)

HTH
Dave


More information about the nSLUG mailing list