:: [DNG] backup
Top Page
Delete this message
Reply to this message
Author: william moss
Date:  
To: Dng
Subject: [DNG] backup
If you set the partition label for the target of a file system archive,
then the use of findmnt eliminates the need for a special location. For
example:
    findmnt -P -t ext4,xfs -o source,target,label


Note, the file systems in the example should be set to what you use for
your archive media.

Since I back up to network attached storage, I parse the output of the
following command to find a sub-directory of the primary mount points.
findmnt -P -t cifs,nfs,auto -o source,target,label |& \
while read Q
do
  [[ "${Q}" =~ LABEL=\"([^\"]*)\" ]] &&     
    LBL="${BASH_REMATCH[1]}"
  [[ "${Q}" =~ TARGET=\"([^\"]*)\" ]] &&     
    TGT="${BASH_REMATCH[1]}/`hostname -s`"
  [[ "${Q}" =~ SOURCE=\"([^\"]*)\" ]] &&     
    SRC="${BASH_REMATCH[1]}"    


[ -n "$SRC" ] || continue
[ -n "$TGT" ] || continue
[ -d "$TGT" ] || continue

# The actions to perform are then based on the source,
# the label (if any) and any other criteria that can be
# found with other options to findmnt.
...
done

I schedule the script that does. I use a custom run-crons
(/usr/lib/cron/run-crons) but a script in /etc/cron.d would also be a
good choice.

Rather than dmesg, try

alias lsblock='lsblk -o name,label,fstype,size,type,tran -x name'

--
William (Bill) Moss
billmoss@???
NY (USA)
Those who will not reason, are bigots,
those who cannot, are fools,
and those who dare not, are slaves.
by Lord Byron
Justice will not be served until those who are
unaffected are as outraged as those who are.
by Benjamin Franklin
Honor, justice and humanity forbid us tamely to
surrender that freedom which we received from
our gallant ancestors and which our innocent
posterity have a right to receive from us. We
cannot endure the infamy and guilt of resigning
succeeding generations to that wretchedness which
inevitably awaits them if we basely entail
hereditary bondage on them.
by Thomas Jefferson
Declaration of the Causes and Necessities of Taking up Arms
6 July 1775