Can I backup MH mail incrementally?
lucmove at gmail.com
Mon Jul 29 18:07:40 UTC 2019
On Mon, 29 Jul 2019 17:39:33 +0000, John Long wrote:
> On Mon, 29 Jul 2019 13:47:34 -0300
> Luciano ES <lucmove at gmail.com> wrote:
> > I want to archive almost all of my email in MH mail boxes to an
> > external disk. The idea is to free up space in the running disk.
> > I thought I could just move ~/Mail to external and start with a new
> > empty Mail directory, but then I realized I want to do incremental
> > backups in the future and I have no idea how to do that.
> TL;DR man rsync
> rsync is an intelligent wrapper that can do all sorts of incremental
> copies. It's the SAK of backups. The man page is rather long and
> complicated so I'll give two commonly-used recipes:
> 1. I've got a directory tree A that I want to copy to directory tree
> B. I want to copy from A only what isn't already present on B, and I
> want everything I ever copied on B to remain there
> rsync -axvn /my/mh /backup
> The "n" above in -axvn says "dry run." I've used rsync for more than a
> decade and under deprivation of sleep and/or coffee I still make
> mistakes. It's best to test any rsync recipe with the -n option, that
> way it will show you what it would have done but not actually do
> anything. When you are convinced it does what you want, recall the
> command line and delete the n. All the examples I'm typing here are
> going to include it so hopefully you won't make any mistakes!
> The other thing about rsync is that ending / characters matter.
> Here I'm copying the mh directory (or file) to /backup
> If I would have used
> rsync -axvn /my/mh/ to /backup/
> then rsync would have copied everything in the mh directory but not
> the mh directory itself. Be careful with this, it's easy to make
> mistakes and shell completion often causes problems by appending
> ending /
> Simply, including a / in the path means "everything in the directory
> but not the directory itself," while not including it means the
> directory *and* everything in it.
> The other common case is when you want to sync two directory trees
> such that the source and destination both contain exactly the same
> files. For example if you delete something from the source, you want
> the next rsync to delete it from the destination also. This doesn't
> sound like your case, but it's useful generally.
> rsync -axvn --delete /my/mh /backup
> does this.
> There are many options and variations. The other great thing about
> rsync is that the source and destination don't have to be on the same
> machine. rsync will use scp or ssh to copy the files depending on your
> command line, ssh config, etc.
> For example I want to copy my mh directory on my desktop to a backup
> directory on a backup server located on ip 192.168.1.15:
> rsync -axvn /my/mh 192.168.1.15:/backup
> The source file can also be on a remote machine...
> The -a flag says "preserve attributes" and it keeps the owner, group,
> atime etc on the backup file
> The -x flag says "don't span filesystems." This may or not be
> necessary but when trying it out I like to use x as a default.
> The -v flag says "be verbose." This way you see most of what rsync
> would do / is doing. If you don't include it you will not see any
> progress indication and it will just end and tell you how many bytes
> it transferred.
You don't understand the problem. Read my initial query again:
"The MH format relies on message file names which are numbers in a sequence.
If I just start with an empty directory (and there are many directories,
which become "folders" in mutt), new messages will be named/numbered
1, 2, 3... all over again. Then I won't be able to just add them to
the master backup with rsync."
New messages will be written to file names (numbers in sequence) that
already exist in the master backup. And they will be newer so rsync
will just wantonly overwrite old messages with new ones.
More information about the Mutt-users