Copy all local filesystems, but ignore NFS mounts?

Dan Stromberg strombrg at dcs.nac.uci.edu
Wed Aug 3 19:31:33 GMT 2005


On Wed, 03 Aug 2005 14:15:36 -0400, Keith Warno wrote:

> * <strombrg at dcs.nac.uci.edu> [02/08/2005 2008EDT]:
>> 
>> What's the easiest way, with rsync, to back up all local filesystems to
>> another host, ignoring anything on an NFS volume.
>> 
>> For example, is there a way of giving a list of mount points but still
>> have --one-file-system work?
> 
> I don't think this is a question for rsync, per se, but more of a
> scripting and utility question.
> 
> There's plenty of ways to do this, depending on your version of mount.
> 
> With mount-2.11y on a Linux box:
> 
> 	mount -t nonfs
> 
> shows all mounts that are not NFS.
> 
> Also local disks will correspond to devices in /dev/, right?  So:
> 
> 	mount|grep ^/dev/|cut -d' ' -f3
> 
> should show you all "local" mounts.  Of course you can modify that grep
> regex to be more specific, like "^/dev/[sh]d" to select SCSI and IDE
> disks only.

Thanks for the response Keith, but I've got a firm grip on these aspects
of the problem.

What I don't have a firm grip on, is upon digging up a list of local
filesystems, how do I then rsync all the files in those filesystems with a
single rsync command?  Or at least, how I can do it with at most one
password entry, so I don't have to come back and reauthenticate for each
filesystem?

My first thought was to just list all of the mount points, but then some
of those directories will have NFS mounts under them, making
--one-file-system advantageous, but if I give a list of mount points
to rsync, then it appears that it doesn't want to sync a single
file.  :-S

Thanks!




More information about the rsync mailing list