euglug.org

[Eug-lug] tar up home for a nuke and pave

작성자

카테고리:



Allen BrownMon Feb 14 10:17:05 PST 2005

Bob Miller wrote:
> Mr O wrote:
> 
> 
>>I've seen it come across the list before but don't know an easy
>>way of searching the archives. How do I tar my home directory
>>and a couple others so I can move them off disk to restore later
>>with all permissions?
> 
> 
> Tar always records the ownership and permission information.  The
> trick is in untarring it correctly.  When you untar it, (a) be the
> superuser and (b) supply the "p" flag.
> 
> 	# tar xfzp somefile.tar.gz
> 	         ^

Tar ignores the "-" in the option string.  Hence doing it as
Bob has shown here "xfzp" is legal.  But I don't think it is
a good idea.

Remember that code is communication.  You are communicating to
two general entity types: the computer, and to humans.  Since
all other programs use a dash to indicate the option, it is more
regular to use it with tar as well.  For the benefit of humans.
Humans can read more quickly and accurately if the writing style
is consistent.

>>Also, when restoring I should untar home first before creating
>>the user right?
> 
> 
> No.  Other way around.
-- 
Allen Brown
   work: Agilent Technologies      non-work: http://www.peak.org/~abrown/
         allen_brown at agilent.com	            abrown at peak.org
   A bartender is a pharmicist with a limited inventory.
                 ---Bernie's UCR Area News