I've been using rdiff-backup for 10+ years.  I developed a simple bash
script that did what I wanted, and then I just ran it.  My OS is and has
been Debian Stable.

My script

   - checks to make sure I'm running as root (I forget why I did that 10+
   years ago)
   - for each of  4 rdiff-backup commands, it
      - prints a  header saying what is being backed up
      - backs up /etc, /usr/local (probably intended to capture a GNU MCSim
      custom installation;  I should be able to rebuild that. This may be the
      reason for running as root, too.)
      - runs dpkg to get a list of installed packages
      - backs up my  /home with three exceptions
      - backs up another /home from this machine
   - prints a closing comment

Two things happened this summer: my backup disk failed :-(, and I realized
that Debian 9 was becoming untenable, so I upgraded to Debian 11.

I just got a new WD Blue 4T SATA HDD  and installed it in a UGREEN
chassis.  I plugged the drive into a USB 3.0 port.  I then formatted the
disk with 2 ext4 partitions and created a backups directory in  the desired
partition.  I revised my script to point to the new directory.  I verified
I could write to it, I cleaned off any files I had written, and then I ran
my newly-modified script.

Here is my script, absent the #!/bin/bash, the check for EUID, and the echo
commands and with names obscured and generally shortened. I run it as root:

rdiff-backup /etc
/media/MyUserName/PartitionName/backups/rdiff-backup-MachineName-etc
rdiff-backup /usr/local
/media/MyUserName/PartitionName/backups/rdiff-backup-MachineName-usr-local
dpkg --get-selections | grep -v deinstall > ~/.dpkg-query
rdiff-backup --exclude /home/MyUserName/Documents/RemainingDirectoryPath1
--exclude /home/MyUserName/Documents/RemainingDirectoryPath2 --exclude
/home/MyUserName/Documents/RemainingDirectoryPath3 -b /home/MyUserName
/media/MyUserName/PartitionName/backups/rdiff-backup-MachineName-home-MyUserName
rdiff-backup -b /home/AnotherUserName
/media/MyUserName/PartitionName/backups/rdiff-backup-MachineName-home-AnotherUserName

In the process, I discovered that my old script had permission problems,
and I made some ad hoc and probably incorrect choices.   Here's what I see
now:

  /media/MyUserName/PartitionName:
  total used in directory 28 available 1.6 TiB
  drwxrwxrwx  4 MyUserName MyUserName   4096 Nov  5 20:18 .
  drwxr-x---+ 4 root       root         4096 Nov  5 20:07 ..
  drwxr-xr-x  6 MyUserName MyUserName   4096 Nov  6 10:02 backups
  drwx------  2 root       root        16384 Nov  3 11:56 lost+found

  /media/MyUserName/PartitionName/backups:
  total used in directory 48 available 1.6 TiB
  drwxr-xr-x   6 MyUserName         MyUserName           4096 Nov  6 10:02 .
  drwxrwxrwx   4 MyUserName         MyUserName           4096 Nov  5 20:18
..
  drwxr-xr-x 148 root               root                12288 Nov  5 19:11
rdiff-backup-MachineName-etc
  drwxr-xr-x 226 MyUserName         MyUserName          20480 Nov  5 09:26
rdiff-backup-MachineName-home-MyUserName
  drwxr-xr-x  36 AnotherUserName    AnotherUserName      4096 Sep  1 14:25
rdiff-backup-MachineName-home-AnotherUserFirstName
  drwxr-xr-x  11 root               root                 4096 Sep 25 12:07
rdiff-backup-MachineName-usr-local

I think rdiff-backup-MachineName-home-MyUserName started off as 700 and I
changed it to 755 to be able to see it more readily--or maybe it was
PartitionName as 700 and I changed it to 777?

What should I have for permissions?  Can I simply chmod these existing
directories or should I start over from the beginning?  Should I have to
run this script as root?  Is there a reason to avoid running it as root?  I
see the examples don't run with elevated permissions; perhaps that would be
better.

A quick random scan of those four directories gives what I would expect:
MyUserName is the owner and group of the top-level contents of one
directory, AnotherUserName is of the other directory, and root is for the
other two.  An even more cursory scan suggests permissions match between
the source and backup files.

Thanks,

Bill

PS: For a  really rough benchmark, creating that initial backup of ca. 66
GiB took about 14 hours. I hibernated it overnight, which I think should
subtract ca. 9-10 hours from the real time, giving an overall rate of ca.
13-17 GiB/hour real time.  user + sys was almost exactly 30 minutes.

-- 
Bill Harris

Reply via email to