tar backup via NFS excluding NFS mount point

tar backup via NFS excluding NFS mount point

Post by Scrum » Sat, 31 Mar 2001 02:52:17



Linux Newbie here :)
I'm about to backup a Linux installation using tar to an NFS mount point
called /cdrom. /cdrom links to an NFS server on another PC on my home
network.

The syntax I'm thinking of using is:

tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /

My aim is;
a) a complete backup of / with all sub-directories and files but of course
excluding the NFS mount point /cdrom and;
b) preserve permissions in case I need to restore and;
c) to save space on the target by using compression (not bzip2 as it takes
too long).

Will the above syntax achieve my aims?

Will tar preserve permissions by default i.e. without adding any specific
option(s)?

I'm not sure if I've got the NFS mount point /cdrom excluded properly from
the tar command and the NFS server PC contains many gigs of data!

Looking forward to receiving your constructive comments.

Tks, Scrumpy

 
 
 

tar backup via NFS excluding NFS mount point

Post by Stefano Ghirland » Sat, 31 Mar 2001 03:51:04



> Linux Newbie here :)
> I'm about to backup a Linux installation using tar to an NFS mount point
> called /cdrom. /cdrom links to an NFS server on another PC on my home
> network.

> The syntax I'm thinking of using is:

> tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /

It looks fine to me.

Quote:> Will tar preserve permissions by default i.e. without adding any
> specific option(s)?

Yes, but note that if you unpack on another machine some of the user
or group ids may not exist.

Quote:> I'm not sure if I've got the NFS mount point /cdrom excluded
> properly from the tar command and the NFS server PC contains many
> gigs of data!

You can always type Ctrl-C to abort the operation. Add the -v option
that will list the files as they are added to the archive, so you can
see whether /cdrom is skipped or not.

--
Stefano - Hodie quarto Kalendas Apriles MMI est

 
 
 

tar backup via NFS excluding NFS mount point

Post by Scrum » Sat, 31 Mar 2001 06:46:13


Hi Stefano,
Your suggested -v option was definitely helpful.

It helped me discover that
tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /
did not exclude the nfs mount point /cdrom!

After searching more on the web I had a few more ideas and finally found
that the '/' infront of 'cdrom' was the culprit. That surprised me!

What I finally used was
tar --exclude=cdrom --exclude=proc --exclude=mnt -c -z -v -f
/cdrom/hdb2ext2.tar /

It's now working as I'd hoped ;-)

Next time I'll need to refresh the backup archive with changed files only.
Finger's crossed!

Thanks, Scrumpy




>> Linux Newbie here :)
>> I'm about to backup a Linux installation using tar to an NFS mount
>> point called /cdrom. /cdrom links to an NFS server on another PC on my
>> home network.

>> The syntax I'm thinking of using is:

>> tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /

>It looks fine to me.

>> Will tar preserve permissions by default i.e. without adding any
>> specific option(s)?

>Yes, but note that if you unpack on another machine some of the user
>or group ids may not exist.

>> I'm not sure if I've got the NFS mount point /cdrom excluded
>> properly from the tar command and the NFS server PC contains many
>> gigs of data!

>You can always type Ctrl-C to abort the operation. Add the -v option
>that will list the files as they are added to the archive, so you can
>see whether /cdrom is skipped or not.

 
 
 

tar backup via NFS excluding NFS mount point

Post by Lee All » Sat, 31 Mar 2001 22:52:02



The simpler way to accomplish your goal is "--one-file-system" which
excludes all other filesystems mounted under / including your NFS
mount point, proc, and any transient mounts you might have (eg, you
might have your floppy or CD-ROM mounted at the time you take a
backup).

-Lee Allen

Quote:>Linux Newbie here :)
>I'm about to backup a Linux installation using tar to an NFS mount point
>called /cdrom. /cdrom links to an NFS server on another PC on my home
>network.

>The syntax I'm thinking of using is:

>tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /

>My aim is;
>a) a complete backup of / with all sub-directories and files but of course
>excluding the NFS mount point /cdrom and;
>b) preserve permissions in case I need to restore and;
>c) to save space on the target by using compression (not bzip2 as it takes
>too long).

>Will the above syntax achieve my aims?

>Will tar preserve permissions by default i.e. without adding any specific
>option(s)?

>I'm not sure if I've got the NFS mount point /cdrom excluded properly from
>the tar command and the NFS server PC contains many gigs of data!

>Looking forward to receiving your constructive comments.

>Tks, Scrumpy

 
 
 

tar backup via NFS excluding NFS mount point

Post by Gordon.Haverl.. » Sat, 31 Mar 2001 22:27:38



Quote:>Linux Newbie here :)
>I'm about to backup a Linux installation using tar to an NFS mount point
>called /cdrom. /cdrom links to an NFS server on another PC on my home
>network.

>The syntax I'm thinking of using is:

>tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /

>My aim is;
>a) a complete backup of / with all sub-directories and files but of course
>excluding the NFS mount point /cdrom and;
>b) preserve permissions in case I need to restore and;
>c) to save space on the target by using compression (not bzip2 as it takes
>too long).

>Will the above syntax achieve my aims?

>Will tar preserve permissions by default i.e. without adding any specific
>option(s)?

There is a tar directive (option) which tells it not to change
partitions (-mount ?  I'm going from memory here).  That will keep you
from following links and mounts to other places.  You probably don't
want to back up /dev or /proc either.  For bundling up a project, or
some related set of files, tar works fine.  For bundling up
everything, I personally like cpio better.

Gord

 
 
 

tar backup via NFS excluding NFS mount point

Post by Stefano Ghirland » Sun, 01 Apr 2001 00:35:08



> Hi Stefano,
> Your suggested -v option was definitely helpful.

> It helped me discover that
> tar --exclude /cdrom -c -z -f /cdrom/slakhdb2ext2.tar /
> did not exclude the nfs mount point /cdrom!

> After searching more on the web I had a few more ideas and finally found
> that the '/' infront of 'cdrom' was the culprit. That surprised me!

I should have thought about that, sorry. You must also have seen a
warning like 'removing / from absolutely path name'. This is good, for
it means that when you untar the archive it won't try to write in /
but under the current dir. But it seems that this operation is
performed *before* processing the filename against the --exclude
option... so that no file with /cdrom in the name ever is seen by
--exclude.

Quote:> Next time I'll need to refresh the backup archive with changed files
> only.  Finger's crossed!

Look up the --after-date option. I can for instance say
--after-date='1 week ago'.

--
Stefano - Hodie tertio Kalendas Apriles MMI est

 
 
 

tar backup via NFS excluding NFS mount point

Post by Stefano Ghirland » Sun, 01 Apr 2001 00:37:56




> The simpler way to accomplish your goal is "--one-file-system"

But it's the answer to another question...

He asked: how do I exclude /cdrom, not 'how do I limit operation to
the / filesystem. If / is only a boot partition and /usr, /home and so
on are on other partitions the two things are different.

--
Stefano - Hodie tertio Kalendas Apriles MMI est

 
 
 

tar backup via NFS excluding NFS mount point

Post by Martin Kroeke » Sun, 01 Apr 2001 01:38:45



> He asked: how do I exclude /cdrom, not 'how do I limit operation to
> the / filesystem. If / is only a boot partition and /usr, /home and so
> on are on other partitions the two things are different.

On the other hand, the '--exclude' option has the drawback that at least
on some versions of tar it excludes 'everything that contains this path
component somewhere', which e.g. in the case of '--exclude=proc' will
also omit things like /usr/src/linux/fs/proc/*

Martin

--

                      Precision Powered by Penguins

 
 
 

tar backup via NFS excluding NFS mount point

Post by Scrum » Sun, 01 Apr 2001 06:37:50




>> He asked: how do I exclude /cdrom, not 'how do I limit operation to
>> the / filesystem. If / is only a boot partition and /usr, /home and so
>> on are on other partitions the two things are different.

>On the other hand, the '--exclude' option has the drawback that at least
>on some versions of tar it excludes 'everything that contains this path
>component somewhere', which e.g. in the case of '--exclude=proc' will
>also omit things like /usr/src/linux/fs/proc/*

>Martin

Although I've posted to newsgroups occasionally in the past (I've mostly
found answers in FAQs or webpages), this has been my first Linux related
post and I'm very grateful for all of your helpful responses.

The PC in particular that I backed-up is a cludged 486 running Slackware
7.1 (actually Zipslack but that's a long and painful story!) with a 209MB
partition (includes everything), plus a 32MB swap partition.

The --one-file-system option sounds useful in this situ. Also, due to the
syntax reqt's, I had to exclude cdrom, proc and mnt without using '/', then
I guess they would be excluded no matter if they appeared anywhere on the
dir tree as dirs or files!

In my humble opinion this might make a case for a future amendment to tar
to allow for '/' so as to distinguish between dirs and files OR another
option for specifying dirs only (which is perhaps the less confusing
alternative) :)

Thanks once again, Scrumpy

 
 
 

tar backup via NFS excluding NFS mount point

Post by Lee All » Tue, 03 Apr 2001 22:48:05






>> The simpler way to accomplish your goal is "--one-file-system"

>But it's the answer to another question...

>He asked: how do I exclude /cdrom, not 'how do I limit operation to
>the / filesystem. If / is only a boot partition and /usr, /home and so
>on are on other partitions the two things are different.

1) He is a newbie and I assumed he did not realize there are other
things he needs to exclude.  The first several times I backed up "/" I
inadvertantly included /proc which wasted a huge amount of space and
generated many errors.  I thought I would help him anticipate & avoid
those problems.

2) You're right: By the same thinking it is remotely possible he has
other filesystems mounted under "/" which need to be backed up and he
may not be aware of it.  In that case they should be specified as
add'l directories to be backed up, or better yet, should be backed up
separately.

-Lee Allen

 
 
 

tar backup via NFS excluding NFS mount point

Post by John Thompso » Wed, 04 Apr 2001 10:13:44


On 30 Mar 2001 17:37:56 +0200, Stefano Ghirlanda




> >> The simpler way to accomplish your goal is "--one-file-system"

> >But it's the answer to another question...

> >He asked: how do I exclude /cdrom, not 'how do I limit operation to
> >the / filesystem.

In that case, the method is easy: simply unmount /cdrom before
running tar.

--