[Users] Cloning and permissions

Steve Wray steve.wray at cwa.co.nz
Mon Dec 17 19:54:04 EST 2007


Gregor Mosheh wrote:
> Peter Machell wrote:
>> vzctl stop xx
>> cp -R /vz/private/xx /vz/private/xxx
>> cp -R /etc/vz/conf/xx.conf /etc/vz/conf/xxx.conf
>> vzctl start xxx
> 
> To have cp preserve permissions, use the -p flag.
> 
> I use tar instead of cp, for situation like this. Tar, unlike cp, is 
> smart enough to handle symbolic links, permissions, ownerships, and 
> sparse files. Use this age-old Unix Jedi trick:
> 
> mkdir /home/vz/private/2
> cd /home/vz/private/1
> tar cf - * | ( cd ../2 ; tar xvf - )

That doesn't need a -p option? ie

  'tar xpvf'

I tend to use 'tar --numeric-owner -cf' as well, just in case.




More information about the Users mailing list